---
title: "Continuous and Geometric Probability"
book: "Interviews I: Maths, Probability and Speed"
subject: quant
language: en
chapter: 12
exercises: 0
source: https://one-course.com/books/quant/18/en/chapter/12-continuous-and-geometric-probability
license: CC-BY-NC-SA-4.0
credit: "One Quant Book, One Course (one-course.com)"
---

# Chapter 12 — Continuous and Geometric Probability

Turning a question about uniform or normal variables into a region whose area you can see. The early questions are pictures on a square; the later ones use symmetry on circles and spheres, the angle of a pair of normals, and the structure of spacings.

**Question 12.1 ★ QR, QT, Trader, Analyst • any • junior.**

A stick of length 1 is cut at a uniform random point. What is the average length of the longer piece? What is the average ratio of the shorter piece to the longer one?

**Answer to Question 12.1.**

The longer piece averages $3/4$. The ratio of shorter to longer averages $2\ln 2 - 1 \approx 0.386$.

The longer piece is uniform on $[\tfrac12, 1]$, with density 2, so its mean is $3/4$. With length $\ell$ for the longer piece, the ratio is $(1 - \ell)/\ell$, and

$$
E\Bigl[\frac{1 - \ell}{\ell}\Bigr] = \int_{1/2}^{1} 2\Bigl(\frac1\ell - 1\Bigr) d\ell = 2\ln 2 - 1.
$$

**Classic wrong answer.** Dividing the two means, $(1/4)/(3/4) = 1/3$. The mean of a ratio is not the ratio of the means, because a ratio changes more for a short denominator.

**Question 12.2 ★ QR, QT, Trader • any • junior.**

$X$ and $Y$ are independent and uniform on $[0, 1]$. What is the probability that $XY < 1/2$?

**Answer to Question 12.2.**

The probability is $\tfrac12 + \tfrac12 \ln 2 \approx 0.847$.

Draw the unit square and the curve $y = 1/(2x)$. For $x \le \tfrac12$, the curve lies above the square, so every $y$ qualifies, which contributes $\tfrac12$. For $x > \tfrac12$, the allowed height is $1/(2x)$, which contributes

$$
\int_{1/2}^{1} \frac{dx}{2x} = \tfrac12 \ln 2.
$$

**Classic wrong answer.** Answering $1/2$, by treating $XY$ as if it were uniform. The product is skewed low: its median is only about $0.19$, so $1/2$ is well up in its upper tail.

**Question 12.3 ★ QR, QT, Trader, DS • any • junior.**

$X$ and $Y$ are independent and uniform on $[0, 1]$. What are the mean and variance of $|X - Y|$?

**Answer to Question 12.3.**

The mean is $1/3$ and the variance is $1/18$.

The event $|X - Y| > t$ is two corner triangles of total area $(1 - t)^2$. So the density of $D = |X - Y|$ is $2(1 - t)$ on $[0, 1]$, and $E[D] = \int_0^1 2t(1 - t)\,dt = 1/3$.

For the variance, $E[D^2] = E[(X - Y)^2] = 2\,\mathrm{Var}(X) = 1/6$, so the variance is $1/6 - 1/9 = 1/18$.

**Follow-up.** *And for two independent standard normals?* $X - Y$ has variance 2, so $E|X - Y| = \sqrt{2}\sqrt{2/\pi} = 2/\sqrt{\pi}$.

**Question 12.4 ★ QR, QT, Trader, Analyst • any • junior.**

Two people agree to meet at a cafe between noon and 1 p.m. Each arrives at an independent uniform time in that hour and waits 15 minutes for the other before leaving. What is the probability that they meet?

**Answer to Question 12.4.**

The probability is $7/16$.

The pair of arrival times is uniform on a square of side 1 hour. They meet when $|X - Y| \le \tfrac14$, a band around the diagonal. Outside the band are two corner triangles, each with legs $\tfrac34$, which together have area $(\tfrac34)^2 = 9/16$.

If they each wait the whole hour, the formula gives 1, and if neither waits at all, it gives 0, which is a quick check.

**Classic wrong answer.** One half, by doubling a 15-minute window to 30 minutes out of 60. The window is cut off at the ends of the hour, for someone who arrives near noon or 1 p.m.

**Question 12.5 ★ QR, DS, QD, QT • any • junior.**

A point is uniform in a unit cube in $d$ dimensions. What is the probability that it lies within $0.05$ of the boundary, for $d = 1$, 10 and 100? What is the probability that it lies in the largest ball that fits in the cube, for $d = 3$ and for $d = 10$? What does this say about high-dimensional data?

**Answer to Question 12.5.**

Within $0.05$ of the boundary: $0.1$, about $0.651$ and about $0.99997$. In the ball: about $0.524$ for $d = 3$, and about $0.0025$ for $d = 10$.

The point is at least $0.05$ away from the boundary only if each coordinate lies in $[0.05, 0.95]$, a chance of $0.9$ each, so the chance is $0.9^d$. The ball of diameter 1 has volume $\pi/6$ for $d = 3$, and for $d = 10$ it is $\pi^5/(5! \cdot 2^{10})$.

So in high dimensions, nearly all of a cube is at its corners and edges, and almost none of it is near the middle. Data points are far from one another and also far from any centre: the typical distance from the centre of the unit cube grows like $\sqrt{d/12}$, about $2.9$ at $d = 100$.

**Why it matters.** This is why nearest-neighbour methods and density estimates fail with many features: with 100 features there is no such thing as a “nearby” point, and every point looks like an outlier.

**Question 12.6 ★★ QR, QT, Trader, Analyst • any • junior.**

A stick of length 1 is broken at two independent uniform points. What is the probability that the three pieces form a triangle? If instead you break it once at a uniform point, and then break the longer piece at a uniform point, what is it? And if you break a piece picked at random with equal chance?

**Answer to Question 12.6.**

Breaking twice gives $1/4$. Breaking the longer piece gives $2\ln 2 - 1 \approx 0.386$, and breaking a random piece gives half of that, about $0.193$.

Three pieces form a triangle exactly when each is below $\tfrac12$, since the longest must be less than the sum of the other two, which is $1$ minus itself. For two cuts at $u < v$, this needs $u < \tfrac12$, $v - u < \tfrac12$ and $v > \tfrac12$. In the unit square that is the shaded area in [Figure 12.1](#fig-iv1-stick), which has area $1/4$.

For the longer piece, let its length be $\ell$. The shorter piece is already below $\tfrac12$. A cut at $a$ leaves two pieces below $\tfrac12$ when $\ell - \tfrac12 < a < \tfrac12$, which is a fraction $(1 - \ell)/\ell$ of the piece. Averaging over $\ell$ gives the same integral as the ratio of pieces: $2\ln 2 - 1$.

Choosing a piece at random picks the longer one half the time. Breaking the shorter can never work, because the untouched longer piece is already above $\tfrac12$. So the chance is half of the above.

![Two independent cuts on a stick. The pieces form a triangle in the two shaded triangles, a quarter of the square.](https://one-course.com/images/onecourse/chapters/quant-18/iv1-continuous-and-geometric-probability/fig-1f8f67ca1077.svg)

***Figure 12.1.** Two independent cuts on a stick. The pieces form a triangle in the two shaded triangles, a quarter of the square.*

**Classic wrong answer.** Treating the second problem as the same as the first. Choosing the longer piece makes a triangle more likely, because it removes the worst case.

**Question 12.7 ★★ QR, QT, Trader • any • junior.**

$X$, $Y$ and $Z$ are independent and uniform on $[0, 1]$. What is the probability that three sticks of those lengths can form a triangle?

**Answer to Question 12.7.**

The probability is $1/2$.

They fail to form a triangle exactly when one is longer than the sum of the other two. No two of these three events can occur together, since only the longest stick can break the rule. Each event, such as $Z > X + Y$, has probability $1/6$: it is the corner of the unit cube at $(0, 0, 1)$, a pyramid with volume $\tfrac13 \cdot \tfrac12 \cdot 1$. So the probability of failure is $3 \cdot \tfrac16 = \tfrac12$.

**Classic wrong answer.** Using $1/4$, by recalling the broken stick. In that problem the three lengths must add up to 1, and they are not independent. Here each can be anything, and the chance of a triangle is larger.

**Follow-up.** *With four sticks and a four-sided figure?* The longest must be less than the sum of the other three. Each failure event has probability $1/24$, so the answer is $1 - 4/24 = 5/6$.

**Question 12.8 ★★ QR, QT, Trader, QD • any • junior.**

A floor has parallel lines one unit apart. You drop a needle of length 1 at a random position and angle. What is the probability that it crosses a line? If the needle has length 3, how many crossings does it make on average? Find the second without doing any integral for that length.

**Answer to Question 12.8.**

A needle of length 1 crosses with probability $2/\pi \approx 0.637$. A needle of length 3 makes $6/\pi \approx 1.91$ crossings on average.

For the first, let $\theta$ be the angle to the lines, uniform on $[0, \pi)$. The needle’s extent across the lines is $\sin\theta$, and for that angle the crossing probability is $\sin\theta$, because the needle’s position relative to the lines is uniform. Its average is $2/\pi$.

For the second, use linearity. A needle of length 3 is three needles of length 1 end to end. Each has the same mean number of crossings, whatever the joins, so the mean is $3 \cdot 2/\pi$. In fact this holds for any shape: the mean crossing number is $2L/\pi d$, with $L$ the length and $d$ the spacing. A circle of diameter 1 has $L = \pi$ and crosses twice for sure, and the formula gives 2, which is a neat proof of the constant.

**Classic wrong answer.** Trying to find $P(\text{at least one})$ for the long needle. That needs an integral over angles, while the mean does not. The question asks for the mean because linearity makes it almost free.

**Question 12.9 ★★ QR, QT, Trader • any • junior.**

You place $n$ points independently and uniformly on a circle. What is the probability that they all lie in some semicircle? Give the answer for $n = 3$ and $n = 5$. What does it say about whether a triangle on three points contains the centre?

**Answer to Question 12.9.**

The probability is $n/2^{n - 1}$, so $3/4$ for $n = 3$ and $5/16$ for $n = 5$. A triangle on three points contains the centre with probability $1/4$.

If the points lie in a semicircle, then going clockwise there is a unique first point of the arc. The events “point $i$ is first” are disjoint. Given that point $i$ is first, all the others must fall in the half-circle clockwise from it, which has probability $2^{-(n - 1)}$. There are $n$ such events, so the total is $n/2^{n - 1}$.

A triangle contains the centre exactly when its three corners do not fit in a semicircle, so that is $1 - 3/4 = 1/4$.

**Classic wrong answer.** Fixing the first point, and asking that the others lie in the half-circle after it, which gives $2^{-(n - 1)}$. That forgets that any of the $n$ points could be the start of the arc.

**Follow-up.** *And for $n = 2$?* The formula gives 1, which is right: two points always lie in a semicircle.

**Question 12.10 ★★ QR, QT, Trader • any • junior.**

You place 4 independent uniform points on a circle, join the first two with a chord and the last two with another. What is the probability that the chords cross? If 20 such points are joined in 10 fixed pairs, how many crossings are there on average?

**Answer to Question 12.10.**

Two chords cross with probability $1/3$, and 10 chords have 15 crossings on average.

Label the four points in order around the circle. Whatever their positions, three pairings are possible, each equally likely: the first point pairs with its neighbour clockwise, with the one opposite, or with its neighbour anticlockwise. Only the opposite pairing crosses, so the chance is $1/3$.

There are $\binom{10}{2} = 45$ pairs of chords, and each pair is a setup of four independent random points. So by linearity, whatever the dependence between pairs, the mean number of crossings is $45 \cdot \tfrac13 = 15$.

**Classic wrong answer.** Trying a calculation over the lengths of arcs. Only the relative order of the four points matters, which is why the answer has no integral.

**Follow-up.** *Are the crossings independent?* No, but linearity does not need it. A question about the variance would need the correlations, and then the work starts.

**Question 12.11 ★★ QR, QT, DS • any • junior.**

A chord of a unit circle is chosen “at random”. How likely is it to be longer than the side of the equilateral triangle inscribed in that circle? Compute it for three natural ways of choosing the chord, and say what the differing answers show.

**Answer to Question 12.11.**

The answers are $1/3$, $1/2$ and $1/4$, depending on the method. This is Bertrand’s paradox.

The side of the inscribed equilateral triangle has length $\sqrt{3}$, and such a chord lies at a distance of $\tfrac12$ from the centre. So the chord is longer exactly when it passes within $\tfrac12$ of the centre.

Random endpoints: fix one end. The other must lie on the third of the circle opposite to it: $1/3$.

Random distance along a radius: the distance from the centre is uniform on $[0, 1]$, so being below $\tfrac12$ has chance $1/2$.

Random midpoint in the disc: the midpoint must lie in the disc of radius $\tfrac12$, which has a quarter of the area: $1/4$.

All three are correct answers to different questions. “At random” does not define a distribution on an infinite set. The first thing to do when a question says this is to ask what mechanism produced the object.

**Why it matters.** The same issue arises whenever you assign a flat prior. Flat in volatility and flat in variance are different beliefs, and which one you take can change a result. State the parameterisation before you state the answer.

**Question 12.12 ★★ QR, QT, Trader, DS • any • junior.**

$X$ and $Y$ are independent standard normal variables. What is the probability that $X > 0$ and $Y > \sqrt{3}\,X$? What is the probability that $X + Y > 0$, given that $X > 0$?

**Answer to Question 12.12.**

The first probability is $1/12$, and the second is $3/4$.

Two independent standard normals have a density that depends only on the distance from the origin, so the direction of $(X, Y)$ is uniform. Each event becomes a sector, and its probability is its angle over the whole.

For $X > 0$ and $Y > \sqrt{3}X$: the line $y = \sqrt{3}x$ is at $60$ degrees, and the region runs from there to the vertical axis, a sector of $30$ degrees. So the chance is $30/360 = 1/12$.

For $X + Y > 0$ given $X > 0$: the half-plane $x > 0$ is $180$ degrees. The half-plane $x + y > 0$ overlaps it in the sector from $-45$ to $90$ degrees, which is $135$ degrees. So the chance is $135/180 = 3/4$.

**Classic wrong answer.** Conditioning on $X$ and integrating a normal tail. This works but it is slow, and it misses what makes normals special.

**Follow-up.** *In correlation terms?* $X + Y$ and $X$ have a correlation of $1/\sqrt{2}$, and the sign-agreement formula $\tfrac12 + \arcsin(\rho)/\pi$ gives the same $3/4$.

**Question 12.13 ★★ QR, QT, DS, Risk • any • junior.**

$X$ and $Y$ are independent standard normal variables. What is the probability that $X^2 + Y^2 > 4$? What are the mean and variance of the larger of $X$ and $Y$?

**Answer to Question 12.13.**

$P(X^2 + Y^2 > 4) = e^{-2} \approx 0.135$. The larger has mean $1/\sqrt{\pi} \approx 0.564$ and variance $1 - 1/\pi \approx 0.682$.

In polar coordinates, $R^2 = X^2 + Y^2$ is exponential with mean 2, so the chance that it exceeds 4 is $e^{-4/2}$.

Write the larger as $\max(X, Y) = \tfrac12(X + Y) + \tfrac12|X - Y|$. The first part has mean 0, and $X - Y$ is normal with variance 2, so $E|X - Y| = \sqrt{2}\sqrt{2/\pi} = 2/\sqrt{\pi}$. So the mean is $1/\sqrt{\pi}$.

For the second moment, there is a one-line symmetry. Replacing $(X, Y)$ by $(-X, -Y)$ turns the larger into minus the smaller, so the squares of the larger and the smaller have the same mean. They add up to $X^2 + Y^2$, with mean 2, so each has mean 1. The variance is $1 - 1/\pi$.

**Why it matters.** Maximum and minimum of Gaussian returns come up in tail risk and best-of options. A best-of-two option on two independent zero-mean normal returns is worth about $0.56$ of one standard deviation.

**Question 12.14 ★★ QR, QT, Risk, DS, QD • any • junior.**

Three machines fail after independent exponential times with rates 1, 2 and 3 per year. What is the probability that the machine with rate 1 fails last? How long does it take on average until all three have failed?

**Answer to Question 12.14.**

The rate-1 machine fails last with probability $7/12$. All three have failed after $73/60 \approx 1.22$ years on average.

Use the race property of exponentials: the next failure among those still working is machine $i$ with probability proportional to its rate, and after a failure the others start afresh, by lack of memory.

For the rate-1 machine to be last, either 2 goes first (chance $2/6$) and then 3 beats 1 (chance $3/4$), or 3 goes first (chance $3/6$) and then 2 beats 1 (chance $2/3$). That is $\tfrac14 + \tfrac13 = \tfrac{7}{12}$.

For the mean of the largest, use inclusion-exclusion on the times. The minimum of a set is exponential with the sum of the rates, so

$$
E[\max] = 1 + \tfrac12 + \tfrac13 - \tfrac13 - \tfrac14 - \tfrac15 + \tfrac16 = \tfrac{73}{60}.
$$

**Classic wrong answer.** Using the slowest machine’s mean of 1 year, which forgets the others can fail later, or summing all the means. The largest is below the sum of the means, and above any one of them.

**Question 12.15 ★★ QR, QT, DS, QD, LLE • any • junior.**

Orders arrive as a Poisson process at 2 per minute. How likely is one order or more in a given 30 seconds? Given that exactly 3 orders came in a given minute, what is the probability that none came in its first half? When, on average, did the first of them come?

**Answer to Question 12.15.**

The probability of at least one is $1 - e^{-1} \approx 0.632$. Given exactly 3 in the minute, none came in the first half with probability $1/8$, and the first of them came after 15 seconds on average.

In 30 seconds at 2 per minute, the count is Poisson with mean 1, so the chance of none is $e^{-1}$.

Given the count, the arrival times are independent and uniform over the minute, whatever the rate. So all 3 fall in the second half with chance $(1/2)^3$. The first is the minimum of 3 uniforms, with mean $1/4$ of a minute. A simulation of the actual exponential gaps, keeping only minutes with exactly 3 arrivals, confirms this.

**Classic wrong answer.** Using the rate’s mean gap of 30 seconds. Once you know that there are three in the minute, the gaps are shorter, and the rate has no more to say.

**Why it matters.** This lets you test whether events really are Poisson: given the count, times should look uniform. Clustering on news is seen at once.

**Question 12.16 ★★ QR, QT, Trader, DS • any • junior.**

$X$ and $Y$ are independent and uniform on $[0, 1]$. What is the distribution of the smaller of them divided by the larger? What is the average of $X/Y$, and how is that consistent with the median of $X/Y$ being 1?

**Answer to Question 12.16.**

The ratio of the smaller to the larger is uniform on $[0, 1]$. The mean of $X/Y$ is infinite, and that sits comfortably with a median of 1.

For $t \in (0, 1)$, the event $\min/\max < t$ is the area of the two triangles near the axes: below the line $y = tx$ and above the line $y = x/t$. Each has area $t/2$, so the chance is $t$. So the ratio is uniform, and its mean is $1/2$.

For $X/Y$: by symmetry it is as likely to be below 1 as above 1, so the median is 1. But $E[X/Y] = E[X]\,E[1/Y] = \tfrac12 \int_0^1 dy/y = \infty$. The tail of the distribution is too heavy, because $Y$ can be very small.

**Classic wrong answer.** Giving $E[X]/E[Y] = 1$ as the mean of the ratio. Independence gives the product of $E[X]$ and $E[1/Y]$, and $E[1/Y]$ is not $1/E[Y]$.

**Why it matters.** Averaging ratios is dangerous for this reason, because a small denominator can dominate. Average returns over small capital bases, or a price-to-earnings mean across firms with tiny earnings, are the same problem.

**Question 12.17 ★★ QR, QT, QD, Dev, DS • any • junior.**

You estimate $\pi$ by throwing $n$ uniform points at a unit square and counting those inside the quarter disc of radius 1 centred at one corner. What is the standard error of your estimate? About how many points do you need to be within $0.001$ with 95% confidence?

**Answer to Question 12.17.**

The standard error is about $1.642/\sqrt{n}$, and for $\pm 0.001$ at 95% you need about $1.04 \times 10^7$ points.

A point falls in the quarter disc with probability $p = \pi/4$. The fraction of hits has variance $p(1 - p)/n$. The estimate is 4 times that fraction, so its standard error is $4\sqrt{p(1 - p)/n} = 1.642/\sqrt{n}$.

To get $1.96 \cdot 1.642/\sqrt{n} = 0.001$, you need $n = (1.96 \cdot 1.642/0.001)^2 \approx 1.04 \times 10^7$. Each further digit needs 100 times the points.

**Classic wrong answer.** Thinking the error is $1/n$, as for a sum you add up, or that one digit more costs 10 times the work. The error falls with the square root of $n$, which is why plain Monte Carlo is expensive.

**Follow-up.** *Can you do better without more points?* Yes. Stratify the square into a grid, or use a smooth control variate, or low-discrepancy points. Each gives the same answer with lower variance.

**Question 12.18 ★★★ QR, QT, Risk • hedge fund, bank • junior, experienced.**

$X$, $Y$ and $Z$ are jointly normal with mean 0, variance 1 and pairwise correlation $0.5$. What is the probability that all three are positive? Give a formula for correlation $\rho$. What happens at $\rho = -1/2$, and why is that the lowest possible value?

**Answer to Question 12.18.**

The probability is $1/4$, and the general formula is $\tfrac18 + \tfrac{3}{4\pi} \arcsin \rho$. At $\rho = -\tfrac12$ it reaches 0, which is the lowest correlation possible for three variables.

Count sign disagreements. Two of the variables differ in sign with probability $d = \tfrac12 - \arcsin(\rho)/\pi$, from the angle between them. Let $a$ be the chance that all three are positive, which is also the chance that all three are negative, by symmetry. A triple of mixed signs disagrees on exactly 2 of its 3 pairs, so adding up over the pairs,

$$
3d = 2(1 - 2a), \qquad\text{which gives}\qquad a = \tfrac12 - \tfrac34 d = \tfrac18 + \frac{3}{4\pi}\arcsin\rho.
$$

At $\rho = \tfrac12$, the arcsine is $\pi/6$, and that is $\tfrac18 + \tfrac18$.

A second route for that value: write $X_i = (W_0 - W_i)/\sqrt{2}$ with independent standard normals $W_0, \dots, W_3$. These have correlation $\tfrac12$, and all three are positive exactly when $W_0$ is the largest of the four, which has chance $1/4$.

Limit checks: $\rho = 0$ gives $1/8$, and $\rho = 1$ gives $1/2$. At $\rho = -\tfrac12$ you have $X + Y + Z = 0$ with certainty, because the variance of the sum is $3 + 6\rho = 0$. They cannot all be positive, and a lower correlation would make that variance negative. So the formula has the right sign exactly at the feasibility limit.

**Classic wrong answer.** Giving $\tfrac12 \cdot \tfrac23 \cdot \tfrac23 = 2/9$, by chaining the pairwise sign probability. Given that $X$ and $Y$ are both positive, $Z$ is more likely to be positive than given $X$ alone: the chance is $3/4$, not $2/3$.

**Follow-up.** *And $n$ variables at correlation $\tfrac12$?* The same construction gives $1/(n + 1)$. For a general $\rho$ and $n \ge 4$, there is no such simple formula, and the three-variable result is a special property of that case.

**Question 12.19 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced.**

A stick of length 1 is cut at 9 independent uniform points, which gives 10 pieces. What is the average length of the shortest piece? Of the longest?

**Answer to Question 12.19.**

The shortest averages $1/100$, and the longest averages $H_{10}/10 \approx 0.293$.

Use the exponential representation: the $n$ spacings of a stick cut at $n - 1$ uniform points have the same law as $n$ independent exponentials divided by their sum, and that sum is independent of the shape. So you can compute with exponentials, and divide by the mean of the sum, which is $n$.

For exponentials with mean 1, the smallest of $n$ has mean $1/n$. Taking away that smallest from all of them, the other $n - 1$ are fresh exponentials by lack of memory. So the sorted values have gaps with means $1/n$, $1/(n-1)$, …, $1$. The largest thus has mean $H_n$.

Divide by $n$. The shortest piece has mean $1/n^2 = 1/100$, and the longest $H_n/n = 2.929/10$. The shortest is a tenth of the average piece of $0.1$, and the longest is about three times that average.

**Classic wrong answer.** Giving $1/10$ for the shortest, which is the mean position of the first cut. That is the mean of one given piece. The shortest is the minimum of ten such pieces, and it has a much smaller mean.

**Why it matters.** This explains how gaps in events look when they arrive at random. With 10 gaps at random times, you should expect one of them to be 3 times the average, and one to be a tenth of the average: neither means anything.

**Question 12.20 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced.**

A stick of length 1 is cut at 4 independent uniform points, which gives 5 pieces. What is the probability that the pieces can form a polygon with 5 sides? Give the formula for $k$ pieces, and say why it looks like the probability that $k$ points on a circle lie in a semicircle.

**Answer to Question 12.20.**

The probability is $11/16$. For $k$ pieces it is $1 - k/2^{k - 1}$.

Pieces can form a closed polygon exactly when no piece is at least the sum of the others, and because the total is 1, this means that no piece has length at least $\tfrac12$. Two pieces cannot both be $\tfrac12$ or more, except on a null set, so those events are disjoint.

A particular piece is at least $\tfrac12$ with probability $(\tfrac12)^{k - 1}$: for the first piece, all $k - 1$ cuts must lie in the upper half, and the pieces are exchangeable. So the chance that some piece does is $k/2^{k - 1}$, and the answer is its complement. For $k = 5$ that is $1 - 5/16$, and for $k = 3$ it is the familiar $1/4$.

The link with points on a circle is exact. Cutting a circle at $k$ uniform points gives $k$ arcs with the same joint law as those pieces. All $k$ points lie in a semicircle exactly when some arc is at least $\tfrac12$. So the two formulas are one fact.

**Classic wrong answer.** Multiplying the triangle’s $1/4$ by a factor for each extra piece, as if things got harder. With more pieces it gets easier, because it is less likely that any one piece is very long.

**Question 12.21 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced.**

Three independent uniform points on a unit circle form a triangle. What is its average area?

**Answer to Question 12.21.**

The average area is $\frac{3}{2\pi} \approx 0.477$.

Let the arcs between neighbouring points be $a$, $b$ and $c$, adding up to $2\pi$. Join the three corners to the centre. The triangle’s area is the sum of three triangles with sides of 1 and a corner angle of an arc:

$$
\text{Area} = \tfrac12 (\sin a + \sin b + \sin c),
$$

and this works even when the centre lies outside, because the sine of an arc above $\pi$ is negative, and then the formula subtracts that part. The arcs have the same marginal distribution by symmetry. A single arc has density $\frac{1}{\pi}\bigl(1 - \frac{a}{2\pi}\bigr)$ on $(0, 2\pi)$, so

$$
E[\sin a] = \int_0^{2\pi} \frac{\sin a}{\pi}\Bigl(1 - \frac{a}{2\pi}\Bigr) da = \frac{1}{\pi}.
$$

So the expected area is $\tfrac32 \cdot \tfrac1\pi$. A simulation of the area from coordinates matches this, and it confirms the signed formula point by point. The largest possible triangle, the equilateral one, has area $3\sqrt{3}/4 \approx 1.30$, so the mean is just over a third of the best.

**Classic wrong answer.** Taking the area of the triangle with the average arcs, $2\pi/3$ each, which gives the equilateral $1.30$. Area is concave near the centre of the simplex, so the mean falls short of that value by a long way.

**Question 12.22 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced.**

A point is chosen uniformly in the unit square. What is the probability that it is closer to the centre of the square than to the square’s boundary?

**Answer to Question 12.22.**

The probability is $\frac{4\sqrt{2} - 5}{3} \approx 0.219$.

Put the centre at the origin, so the square spans $[-\tfrac12, \tfrac12]^2$. By symmetry, consider the slice of the square nearest the right side, where $|y| \le x$; there are four such slices, and each is a triangle from the centre to a side. A point in it has distance to the boundary of $\tfrac12 - x$, and it is closer to the centre if

$$
\sqrt{x^2 + y^2} < \tfrac12 - x \iff x < \tfrac14 - y^2,
$$

which is a parabola, the locus of points as far from a point as from a line. The curve meets the slice’s edge $y = x$ where $x^2 + x - \tfrac14 = 0$, at $y_0 = (\sqrt{2} - 1)/2 \approx 0.207$. So the slice has area

$$
2\int_0^{y_0} \Bigl(\tfrac14 - y^2 - y\Bigr) dy = 2\Bigl(\frac{y_0}{4} - \frac{y_0^3}{3} - \frac{y_0^2}{2}\Bigr).
$$

Multiplying by 4 gives $(4\sqrt{2} - 5)/3$. As shown in [Figure 12.2](#fig-iv1-parabola), the region is a square with bulging sides. Its area lies between that of the disc of radius $\tfrac14$, which is about $0.196$, and that of the disc of radius $\tfrac12$.

![The points of the unit square closer to the centre than to the boundary. Each of the four arcs is a parabola, with the centre as focus and a side as directrix. The dashed diagonals split the square into four slices.](https://one-course.com/images/onecourse/chapters/quant-18/iv1-continuous-and-geometric-probability/fig-0743b52b0522.svg)

***Figure 12.2.** The points of the unit square closer to the centre than to the boundary. Each of the four arcs is a parabola, with the centre as focus and a side as directrix. The dashed diagonals split the square into four slices.*

**Classic wrong answer.** Using a disc of radius $\tfrac14$, which gives $\pi/16 \approx 0.196$. That is right only along the axes. Towards a corner the boundary is further away, so the true region reaches beyond the disc, as far as a distance of about $0.293$ from the centre.

**Question 12.23 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced.**

A very large number of birds sit at independent uniform positions along a wire. Each bird paints the stretch of wire between itself and its nearest neighbour. What fraction of the wire is painted?

**Answer to Question 12.23.**

The painted fraction is $7/18 \approx 0.389$.

For many birds, the gaps between neighbours behave like independent exponentials. Take the gap containing a random point of the wire. It is size-biased, so with mean gap 1, its length $L$ has density $Le^{-L}$.

The gap is painted when at least one of its two end birds has it as its shorter side. The bird on the left does not paint it if that bird’s other gap is shorter than $L$, which has chance $1 - e^{-L}$. The two other gaps are independent, so the gap stays unpainted with chance $(1 - e^{-L})^2$. Averaging:

$$
E[(1 - e^{-L})^2] = \int_0^\infty Le^{-L}\bigl(1 - 2e^{-L} + e^{-2L}\bigr) dL = 1 - \tfrac24 + \tfrac19 = \tfrac{11}{18}.
$$

So $11/18$ stays unpainted and $7/18$ is painted, which a simulation of birds on a wire matches.

**Classic wrong answer.** Saying one half or more, on the grounds that every bird paints something. Short gaps get painted, sometimes by both ends, and long gaps tend not to be. Long gaps hold most of the wire.

**Follow-up.** *What fraction of gaps, as a count, gets painted?* Without size-biasing the density of $L$ is $e^{-L}$, and the chance of being unpainted has mean $1 - 2 \cdot \tfrac12 + \tfrac13 = \tfrac13$, so $2/3$ of the gaps are painted. Those are the short ones, which is why they hold only $7/18$ of the length.

**Question 12.24 ★★★★ QR, QT • hedge fund, market maker • experienced.**

Four independent uniform points on a sphere are the corners of a tetrahedron. What is the probability that it contains the centre of the sphere? Find a proof that needs no integral.

**Answer to Question 12.24.**

The probability is $1/8$.

Draw the points as follows: first choose four random lines through the centre, and then choose one of each line’s two points by flipping a coin. That is the same as choosing four independent uniform points. There are 16 sign choices, and you only have to count how many of them give a tetrahedron around the centre.

Fix the point $p_4$ on the fourth line. The other three lines each give two choices, and these make the 8 spherical triangles into which the three great circles (through pairs of the lines) cut the sphere. The eight triangles cover the sphere with no overlap, except for edges. The tetrahedron with corners $\pm p_1, \pm p_2, \pm p_3, p_4$ contains the centre exactly when $-p_4$ lies in the triangle $\pm p_1, \pm p_2, \pm p_3$. Exactly one of the eight triangles contains $-p_4$. So the chance is $1/8$, whichever $p_4$ you have.

The same argument on a circle gives $1/4$, and in general, in $d$ dimensions, the chance that $d + 1$ points surround the centre is $2^{-d}$. Wendel’s sum extends this to more points.

**Classic wrong answer.** Trying to integrate over solid angles. The trick removes all of the calculation. This is what the interviewer hopes you will find, perhaps after the two-dimensional case.

**Follow-up.** *And all four in some hemisphere?* The complement: $7/8$. Wendel’s sum for $d = 3$ and $n = 4$ is $2^{-3}\bigl(\binom30 + \binom31 + \binom32\bigr) = 7/8$.

**Question 12.25 ★★★★ QR, QT • hedge fund, market maker • experienced.**

A floor has a square grid of lines, one unit apart in each direction. You drop a needle of length 1 at a random position and angle. What is the average number of grid lines it crosses? What is the probability that it crosses at least one?

**Answer to Question 12.25.**

It crosses $4/\pi \approx 1.273$ lines on average, and it crosses at least one with probability $3/\pi \approx 0.955$.

The mean is linearity. The grid is two sets of parallel lines, and Buffon’s result gives $2/\pi$ crossings from each, so together $4/\pi$.

For the chance of at least one, fix the angle $\theta \in (0, \pi/2)$ to one of the directions; other angles are the same by symmetry. Horizontal and vertical positions are independent, so the needle misses both sets with probability $(1 - \cos\theta)(1 - \sin\theta)$. Averaging over $\theta$ with density $2/\pi$:

$$
\frac{2}{\pi} \int_0^{\pi/2} (1 - \cos\theta)(1 - \sin\theta) d\theta = \frac{2}{\pi}\Bigl(\frac{\pi}{2} - 1 - 1 + \frac12\Bigr) = 1 - \frac{3}{\pi}.
$$

Inclusion-exclusion gives the same: each set is crossed with chance $2/\pi$, and both with chance $\frac{2}{\pi}\int_0^{\pi/2}\cos\theta\sin\theta\, d\theta = 1/\pi$, so the chance of at least one is $4/\pi - 1/\pi$.

A needle of this length crosses some line almost every time, but it crosses lines of both directions only about a third of the time.

**Classic wrong answer.** Using $2 \cdot 2/\pi - (2/\pi)^2$, treating the two sets as independent. Positions are independent, but the angle is shared: a needle lying near one direction crosses that set less, and the other set more.

**Why it matters.** Mixing over a shared hidden factor creates dependence, even when each piece is independent given it. Treat hidden common factors as the first thing to check in any calculation of the chance of joint events.
