Library · Geometric Probability · Chapter 22
Expected number of pieces cut by random chords
Problem 22.1
chords are drawn independently on a disc, each determined by two independent uniform random endpoints on the boundary circle. Into how many pieces do the chords partition the disc, on average?
Solution. Start with the disc as a single region (one piece). As each chord is added, the number of new pieces it creates equals one plus the number of times it crosses previously-drawn chords — every new crossing splits an existing region into two.
Let be the indicator that chord crosses chord . The total number of crossings among all chords is , with (from Chapters 12 and 18)
The number of pieces is (one initial piece, plus one for each chord, plus one for each crossing). Therefore
For we expect pieces. For : . For : . For : .
The formula is an instance of Euler’s formula for planar graphs: , where is the number of connected components of the graph and includes the exterior face. When chords with crossings are drawn in a disc, the planar graph has vertices (chord endpoints plus crossings), edges (chord pieces plus boundary arcs), and because the circle boundary connects all chord endpoints. Thus , and subtracting the exterior face leaves pieces inside the disc.
import numpy as np
# For n = 5 random chords, expected pieces = 1 + 5 + 10/3 = 28/3.
# Count crossings using the side-of-line test (same as the chapter on crossing pairs), then add 1 + n.
n, N = 5, 10**4
pieces = []
for _ in range(N):
theta = np.random.rand(2*n) * 2*np.pi
x, y = np.cos(theta), np.sin(theta)
def side(A, B, C):
return (B[0]-A[0])*(C[1]-A[1]) - (B[1]-A[1])*(C[0]-A[0])
cr = 0
for i in range(n):
for j in range(i+1, n):
A, B = (x[i], y[i]), (x[n+i], y[n+i])
C, D = (x[j], y[j]), (x[n+j], y[n+j])
if np.sign(side(A,B,C))*np.sign(side(A,B,D)) < 0 and \
np.sign(side(C,D,A))*np.sign(side(C,D,B)) < 0:
cr += 1
pieces.append(1 + n + cr)
print(f"sim: {np.mean(pieces):.4f} exact: {1+n+n*(n-1)/6:.4f}")
# sim: 9.3485 exact: 9.3333