Interviews I: Maths, Probability and Speed · Carrières
12Continuous 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
Answer to Question 12.1.
The longer piece averages . The ratio of shorter to longer averages .
The longer piece is uniform on , with density 2, so its mean is . With length for the longer piece, the ratio is , and
Classic wrong answer. Dividing the two means, . 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
and are independent and uniform on . What is the probability that ?
Answer
Answer to Question 12.2.
The probability is .
Draw the unit square and the curve . For , the curve lies above the square, so every qualifies, which contributes . For , the allowed height is , which contributes
Classic wrong answer. Answering , by treating as if it were uniform. The product is skewed low: its median is only about , so is well up in its upper tail.
Question 12.3 ★ QR, QT, Trader, DS • any • junior
and are independent and uniform on . What are the mean and variance of ?
Answer
Answer to Question 12.3.
The mean is and the variance is .
The event is two corner triangles of total area . So the density of is on , and .
For the variance, , so the variance is .
Follow-up. And for two independent standard normals? has variance 2, so .
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
Answer to Question 12.4.
The probability is .
The pair of arrival times is uniform on a square of side 1 hour. They meet when , a band around the diagonal. Outside the band are two corner triangles, each with legs , which together have area .
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 dimensions. What is the probability that it lies within of the boundary, for , 10 and 100? What is the probability that it lies in the largest ball that fits in the cube, for and for ? What does this say about high-dimensional data?
Answer
Answer to Question 12.5.
Within of the boundary: , about and about . In the ball: about for , and about for .
The point is at least away from the boundary only if each coordinate lies in , a chance of each, so the chance is . The ball of diameter 1 has volume for , and for it is .
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 , about at .
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
Answer to Question 12.6.
Breaking twice gives . Breaking the longer piece gives , and breaking a random piece gives half of that, about .
Three pieces form a triangle exactly when each is below , since the longest must be less than the sum of the other two, which is minus itself. For two cuts at , this needs , and . In the unit square that is the shaded area in Figure 12.1, which has area .
For the longer piece, let its length be . The shorter piece is already below . A cut at leaves two pieces below when , which is a fraction of the piece. Averaging over gives the same integral as the ratio of pieces: .
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 . So the chance is half of the above.
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
, and are independent and uniform on . What is the probability that three sticks of those lengths can form a triangle?
Answer
Answer to Question 12.7.
The probability is .
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 , has probability : it is the corner of the unit cube at , a pyramid with volume . So the probability of failure is .
Classic wrong answer. Using , 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 , so the answer is .
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
Answer to Question 12.8.
A needle of length 1 crosses with probability . A needle of length 3 makes crossings on average.
For the first, let be the angle to the lines, uniform on . The needle’s extent across the lines is , and for that angle the crossing probability is , because the needle’s position relative to the lines is uniform. Its average is .
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 . In fact this holds for any shape: the mean crossing number is , with the length and the spacing. A circle of diameter 1 has and crosses twice for sure, and the formula gives 2, which is a neat proof of the constant.
Classic wrong answer. Trying to find 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 points independently and uniformly on a circle. What is the probability that they all lie in some semicircle? Give the answer for and . What does it say about whether a triangle on three points contains the centre?
Answer
Answer to Question 12.9.
The probability is , so for and for . A triangle on three points contains the centre with probability .
If the points lie in a semicircle, then going clockwise there is a unique first point of the arc. The events “point is first” are disjoint. Given that point is first, all the others must fall in the half-circle clockwise from it, which has probability . There are such events, so the total is .
A triangle contains the centre exactly when its three corners do not fit in a semicircle, so that is .
Classic wrong answer. Fixing the first point, and asking that the others lie in the half-circle after it, which gives . That forgets that any of the points could be the start of the arc.
Follow-up. And for ? 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
Answer to Question 12.10.
Two chords cross with probability , 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 .
There are 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 .
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
Answer to Question 12.11.
The answers are , and , depending on the method. This is Bertrand’s paradox.
The side of the inscribed equilateral triangle has length , and such a chord lies at a distance of from the centre. So the chord is longer exactly when it passes within of the centre.
Random endpoints: fix one end. The other must lie on the third of the circle opposite to it: .
Random distance along a radius: the distance from the centre is uniform on , so being below has chance .
Random midpoint in the disc: the midpoint must lie in the disc of radius , which has a quarter of the area: .
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
and are independent standard normal variables. What is the probability that and ? What is the probability that , given that ?
Answer
Answer to Question 12.12.
The first probability is , and the second is .
Two independent standard normals have a density that depends only on the distance from the origin, so the direction of is uniform. Each event becomes a sector, and its probability is its angle over the whole.
For and : the line is at degrees, and the region runs from there to the vertical axis, a sector of degrees. So the chance is .
For given : the half-plane is degrees. The half-plane overlaps it in the sector from to degrees, which is degrees. So the chance is .
Classic wrong answer. Conditioning on and integrating a normal tail. This works but it is slow, and it misses what makes normals special.
Follow-up. In correlation terms? and have a correlation of , and the sign-agreement formula gives the same .
Question 12.13 ★★ QR, QT, DS, Risk • any • junior
and are independent standard normal variables. What is the probability that ? What are the mean and variance of the larger of and ?
Answer
Answer to Question 12.13.
. The larger has mean and variance .
In polar coordinates, is exponential with mean 2, so the chance that it exceeds 4 is .
Write the larger as . The first part has mean 0, and is normal with variance 2, so . So the mean is .
For the second moment, there is a one-line symmetry. Replacing by turns the larger into minus the smaller, so the squares of the larger and the smaller have the same mean. They add up to , with mean 2, so each has mean 1. The variance is .
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 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
Answer to Question 12.14.
The rate-1 machine fails last with probability . All three have failed after years on average.
Use the race property of exponentials: the next failure among those still working is machine 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 ) and then 3 beats 1 (chance ), or 3 goes first (chance ) and then 2 beats 1 (chance ). That is .
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
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
Answer to Question 12.15.
The probability of at least one is . Given exactly 3 in the minute, none came in the first half with probability , 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 .
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 . The first is the minimum of 3 uniforms, with mean 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
and are independent and uniform on . What is the distribution of the smaller of them divided by the larger? What is the average of , and how is that consistent with the median of being 1?
Answer
Answer to Question 12.16.
The ratio of the smaller to the larger is uniform on . The mean of is infinite, and that sits comfortably with a median of 1.
For , the event is the area of the two triangles near the axes: below the line and above the line . Each has area , so the chance is . So the ratio is uniform, and its mean is .
For : by symmetry it is as likely to be below 1 as above 1, so the median is 1. But . The tail of the distribution is too heavy, because can be very small.
Classic wrong answer. Giving as the mean of the ratio. Independence gives the product of and , and is not .
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 by throwing 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 with 95% confidence?
Answer
Answer to Question 12.17.
The standard error is about , and for at 95% you need about points.
A point falls in the quarter disc with probability . The fraction of hits has variance . The estimate is 4 times that fraction, so its standard error is .
To get , you need . Each further digit needs 100 times the points.
Classic wrong answer. Thinking the error is , 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 , 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
, and are jointly normal with mean 0, variance 1 and pairwise correlation . What is the probability that all three are positive? Give a formula for correlation . What happens at , and why is that the lowest possible value?
Answer
Answer to Question 12.18.
The probability is , and the general formula is . At it reaches 0, which is the lowest correlation possible for three variables.
Count sign disagreements. Two of the variables differ in sign with probability , from the angle between them. Let 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,
At , the arcsine is , and that is .
A second route for that value: write with independent standard normals . These have correlation , and all three are positive exactly when is the largest of the four, which has chance .
Limit checks: gives , and gives . At you have with certainty, because the variance of the sum is . 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 , by chaining the pairwise sign probability. Given that and are both positive, is more likely to be positive than given alone: the chance is , not .
Follow-up. And variables at correlation ? The same construction gives . For a general and , 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
Answer to Question 12.19.
The shortest averages , and the longest averages .
Use the exponential representation: the spacings of a stick cut at uniform points have the same law as 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 .
For exponentials with mean 1, the smallest of has mean . Taking away that smallest from all of them, the other are fresh exponentials by lack of memory. So the sorted values have gaps with means , , …, . The largest thus has mean .
Divide by . The shortest piece has mean , and the longest . The shortest is a tenth of the average piece of , and the longest is about three times that average.
Classic wrong answer. Giving 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 pieces, and say why it looks like the probability that points on a circle lie in a semicircle.
Answer
Answer to Question 12.20.
The probability is . For pieces it is .
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 . Two pieces cannot both be or more, except on a null set, so those events are disjoint.
A particular piece is at least with probability : for the first piece, all cuts must lie in the upper half, and the pieces are exchangeable. So the chance that some piece does is , and the answer is its complement. For that is , and for it is the familiar .
The link with points on a circle is exact. Cutting a circle at uniform points gives arcs with the same joint law as those pieces. All points lie in a semicircle exactly when some arc is at least . So the two formulas are one fact.
Classic wrong answer. Multiplying the triangle’s 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
Answer to Question 12.21.
The average area is .
Let the arcs between neighbouring points be , and , adding up to . 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:
and this works even when the centre lies outside, because the sine of an arc above is negative, and then the formula subtracts that part. The arcs have the same marginal distribution by symmetry. A single arc has density on , so
So the expected area is . 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 , so the mean is just over a third of the best.
Classic wrong answer. Taking the area of the triangle with the average arcs, each, which gives the equilateral . 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
Answer to Question 12.22.
The probability is .
Put the centre at the origin, so the square spans . By symmetry, consider the slice of the square nearest the right side, where ; 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 , and it is closer to the centre if
which is a parabola, the locus of points as far from a point as from a line. The curve meets the slice’s edge where , at . So the slice has area
Multiplying by 4 gives . As shown in Figure 12.2, the region is a square with bulging sides. Its area lies between that of the disc of radius , which is about , and that of the disc of radius .
Classic wrong answer. Using a disc of radius , which gives . 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 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
Answer to Question 12.23.
The painted fraction is .
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 has density .
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 , which has chance . The two other gaps are independent, so the gap stays unpainted with chance . Averaging:
So stays unpainted and 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 is , and the chance of being unpainted has mean , so of the gaps are painted. Those are the short ones, which is why they hold only 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
Answer to Question 12.24.
The probability is .
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 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 contains the centre exactly when lies in the triangle . Exactly one of the eight triangles contains . So the chance is , whichever you have.
The same argument on a circle gives , and in general, in dimensions, the chance that points surround the centre is . 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: . Wendel’s sum for and is .
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
Answer to Question 12.25.
It crosses lines on average, and it crosses at least one with probability .
The mean is linearity. The grid is two sets of parallel lines, and Buffon’s result gives crossings from each, so together .
For the chance of at least one, fix the angle 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 . Averaging over with density :
Inclusion-exclusion gives the same: each set is crossed with chance , and both with chance , so the chance of at least one is .
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 , 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.