Skip to content
LeetQuant
F4 Random Variables and Expectation

F4 · Random Variables and Expectation · Lesson 4 of 8

Continuous & Geometric Probability

Probabilities as areas, order statistics of uniforms, broken sticks and meeting problems.

25 min

Probability is area

When XX and YY are independent and uniform on [0,1][0, 1], the pair (X,Y)(X, Y) is uniform on the unit square, so the probability of any event is the area of the region where it holds. Draw the square, shade the region, and compute the area, usually with triangles rather than integrals.

For example, P(X+Y<1.5)P(X + Y < 1.5) is the square minus the corner triangle above the line x+y=1.5x + y = 1.5. That triangle has legs of length 0.50.5, so

P(X+Y<1.5)=1−12(0.5)2=0.875.P(X + Y < 1.5) = 1 - \tfrac12(0.5)^2 = 0.875 .

With three uniforms, the same idea uses volumes in the unit cube. P(U1+U2+U3<1)=1/3!=1/6P(U_1 + U_2 + U_3 < 1) = 1/3! = 1/6, and in general P(U1+⋯+Un<1)=1/n!P(U_1 + \dots + U_n < 1) = 1/n!.

Worked example

a quarter-hour wait

Two people each arrive at a uniformly random time in the same hour and wait 15 minutes for the other. What is the probability they meet?

Show solution

Measure time in hours. They meet when ∣X−Y∣≤14|X - Y| \le \tfrac14. The complement is two corner triangles, each with legs 34\tfrac34:

P(meet)=1−2⋅12(34)2=1−916=716.P(\text{meet}) = 1 - 2 \cdot \tfrac12\Big(\tfrac34\Big)^2 = 1 - \tfrac{9}{16} = \tfrac{7}{16} .

In general, with a waiting time that is a fraction ww of the window, P=1−(1−w)2P = 1 - (1 - w)^2.

Order statistics of uniforms

Drop nn independent uniform points on [0,1][0, 1]. They cut the interval into n+1n + 1 gaps, and by symmetry every gap has the same distribution, each with mean 1n+1\tfrac{1}{n+1}. So the kk-th smallest point has

E[U(k)]=kn+1.\mathbb{E}[U_{(k)}] = \frac{k}{n+1} .

The maximum has CDF P(max⁡≤x)=xnP(\max \le x) = x^n and density nxn−1n x^{n-1}; the minimum has P(min⁡>x)=(1−x)nP(\min > x) = (1 - x)^n. The expected distance between two uniform points is 13\tfrac13: the middle gap of three.

Worked example

the broken stick

A stick of length 1 is broken at two independent uniform points. What is the probability the three pieces form a triangle?

Show solution

Three lengths form a triangle exactly when each is less than 12\tfrac12 (each side shorter than the sum of the other two).

The three pieces are the gaps made by two uniform points, and (G1,G2,G3)(G_1, G_2, G_3) is uniform on the triangle g1+g2+g3=1g_1 + g_2 + g_3 = 1. The region where all three are below 12\tfrac12 is the triangle formed by joining the midpoints of the sides, which has a quarter of the area. So P=14P = \tfrac14.

A second check: P(some piece>12)=3×P(G1>12)=3×14=34P(\text{some piece} > \tfrac12) = 3 \times P(G_1 > \tfrac12) = 3 \times \tfrac14 = \tfrac34, since only one piece can exceed a half and P(G1>12)=(1−12)2P(G_1 > \tfrac12) = (1 - \tfrac12)^2.

When the shape is curved

Regions like {xy<t}\{xy < t\} or {x2<y}\{x^2 < y\} need a short integral. Integrate over one variable and keep the other as a bound:

P(Y<X2)=∫01x2 dx=13.P(Y < X^2) = \int_0^1 x^2\,dx = \tfrac13 .

For a function of one continuous variable, convert through the CDF: if Y=g(X)Y = g(X) with gg increasing, P(Y≤y)=P(X≤g−1(y))P(Y \le y) = P(X \le g^{-1}(y)). For instance, if UU is uniform then −ln⁡U-\ln U is Exp(1), because P(−ln⁡U>t)=P(U<e−t)=e−tP(-\ln U > t) = P(U < e^{-t}) = e^{-t}. This is the basis of inverse-transform sampling.

Knowledge check

Three numbers are drawn independently and uniformly from [0, 1]. What is the expected value of the smallest?

Knowledge check

XX and YY are independent and uniform on [0,1][0, 1]. What is P(X+Y>1.5)P(X + Y > 1.5)?

Knowledge check

Two points are chosen independently and uniformly on a stick of length 1. What is the expected distance between them?

Practice problems

Finished reading?

Answer the 3 knowledge checks to complete this lesson (0 done).