ML Interview Q Series: Probability of Intersecting Random Chords in a Circle via Combinatorics
Browse all the Probability Interview Questions here.
Suppose you have a circle, and you select two chords at random. What is the probability that these two chords will intersect inside the circle?
Short Compact solution
A chord is determined by two endpoints on the circle. When you pick two chords at random, you can imagine first choosing four distinct points on the circle. Label these four points in any order. There are
ways to form a pair of endpoints for the first chord and then the remaining two points form the second chord. However, each chord gets counted twice because chord AB is the same as chord BA, so there are effectively three distinct ways to pair up the four points into two chords. Out of these three ways, only one pairing will produce intersecting chords inside the circle. Therefore, the probability is
Comprehensive Explanation
Geometric Reasoning
A chord is simply a line segment whose endpoints lie on the circle’s circumference. If you pick two chords at random, you can break down the problem by explicitly choosing four distinct points on the circle. We label them A, B, C, and D in clockwise order around the circle.
The key insight is that the chords intersect inside the circle if and only if their endpoints are arranged in an alternating fashion around the circle. For example, if you connect A to B and C to D, then they do not intersect inside the circle (they’ll intersect outside, or not at all). In contrast, if you connect A to C and B to D, those chords will intersect inside the circle. This interleaving of endpoints is the primary condition for intersection.
Once we observe that every set of four points has exactly three ways to form two chords, and only one of these ways yields intersecting chords, it directly follows that the probability is 1/3.
Counting Method
We can count the pairings more formally:
First, choose four distinct points A, B, C, and D on the circle.
The total number of ways to select which pair of points makes the first chord is
Each pair of endpoints can form the same chord in two directions (e.g., AB or BA), so to account for this duplication, we divide by 2, obtaining 3 unique ways to form two chords.
In exactly one of these three ways, the chords cross each other inside the circle.
Hence, probability = number of intersecting configurations / total configurations = 1 / 3.
Alternate Perspective (Interspersing Endpoints)
Another way to see it is to place four points on the circle: A, B, C, D in clockwise order. The chords intersect if and only if you choose endpoints such that they “alternate” around the circle. If you label the points A, B, C, D in clockwise sequence, then:
Chords A–B and C–D do not intersect.
Chords A–C and B–D do intersect.
Chords A–D and B–C do not intersect.
Thus we again see only one intersecting arrangement out of three possible distinct pairings.
Randomness Assumption
It is important to note that in interview settings, one must clarify how chords are chosen “at random.” A standard convention (and presumably the one used here) is to choose two random chords by selecting four points uniformly at random on the circumference. Under that assumption, the result 1/3 holds. If a different notion of “random chord” is used, the result might differ.
Potential Follow-up Questions
How can you verify this probability via simulation?
To verify this probability computationally, you can write a simple Python script:
import random
import math
import statistics
def random_point_on_circle():
# Pick an angle uniformly from [0, 2π)
angle = random.random() * 2 * math.pi
return (math.cos(angle), math.sin(angle))
def chords_intersect(p1, p2, p3, p4):
# We can check intersection by using a cross-product sign check.
# Specifically, we check orientation of points around each chord.
# Helper function to check orientation
def orientation(a, b, c):
return (b[0] - a[0])*(c[1] - a[1]) - (b[1] - a[1])*(c[0] - a[0])
# Check if the segments p1-p2 and p3-p4 intersect
o1 = orientation(p1, p2, p3)
o2 = orientation(p1, p2, p4)
o3 = orientation(p3, p4, p1)
o4 = orientation(p3, p4, p2)
return (o1 * o2 < 0) and (o3 * o4 < 0)
num_trials = 10_000_00
count_intersect = 0
for _ in range(num_trials):
A = random_point_on_circle()
B = random_point_on_circle()
C = random_point_on_circle()
D = random_point_on_circle()
if chords_intersect(A, B, C, D):
count_intersect += 1
sim_prob = count_intersect / num_trials
print("Estimated probability of intersection:", sim_prob)
In such a simulation, with a sufficiently large number of trials, the empirical result should converge near 1/3.
Could the answer change if we define “random chords” in a different way?
Yes. There is a famous “Bertrand’s paradox” in probability theory which highlights how different definitions of “random chord” lead to different probabilities. For instance, if you randomly select the midpoint of the chord uniformly from the area of the circle, you get a different probability for other chord-related questions. In this problem, we specifically assume that the endpoints are chosen uniformly on the circumference. This assumption fixes the probability at 1/3.
How would the probability change if the chords are allowed to share endpoints?
If the chords were allowed to share an endpoint (or if there is some possibility that the four endpoints are not all distinct), the counting might change because the event of intersecting chords with a shared endpoint is trivially impossible inside the circle (if two chords share an endpoint, they can only intersect at that endpoint on the boundary, which usually is not considered an intersection “inside” the circle). So you would have to adjust the methodology for counting chord pairs. In the standard statement of the puzzle, the four endpoints are distinct, so that scenario does not arise.
What is the geometrical criterion for two chords to intersect in terms of the circle arcs?
Two chords AB and CD inside a circle will intersect if and only if the endpoints around the circle are interspersed. In a more formal geometry sense, if you traverse the circle in a clockwise direction, you must encounter the endpoints in an order such as A, C, B, D (or any cyclic permutation of that pattern), rather than A, B, C, D or A, C, D, B. This directly maps to the combinatorial pairing argument, giving us the 1/3 result.
Are there practical applications of this result?
Although this specific puzzle is more of a recreational geometry problem, it can illustrate fundamental techniques in geometric probability and combinatorial reasoning. Such methods arise in various computational geometry tasks (for example, random sampling of edges in large geometric graphs), computational design, or even in verifying random sampling assumptions in certain algorithms.
It also serves as a reminder that in probability problems involving geometry, you must clarify how “randomness” is defined, or you risk contradictory or paradoxical results.
Below are additional follow-up questions
What happens if we pick only from a discrete set of points on the circle, rather than continuously around the circumference?
When the circle’s circumference is populated by a finite set of evenly spaced points, the process of choosing chords no longer involves continuous uniform randomness over the entire circle. Instead, it becomes a combinatorial problem with a finite set of points. In this scenario:
If there are N
distinct points equally spaced on the circle, then a chord is formed by choosing any 2 of these points, giving
possible chords in total.
Picking two distinct chords at random among these discrete chords involves choosing pairs of points in a finite set of ways. We can count how many ways the endpoints interlace around the circle so that the chords intersect.
For large N
, one might expect the fraction of intersecting chord pairs to approximate the continuous case (i.e., approach
). However, for smaller N
, you may see deviations due to discrete effects. For instance, if
N=4
(the smallest non-trivial case), you would effectively get exactly one set of four points, and by the standard counting, you’d find exactly one intersecting configuration out of three possible ways to form two chords, so the probability is still
. If you increase
N
to 5, 6, or 7, you can compute the ratio of intersecting configurations to non-intersecting configurations and see whether the ratio remains stable around
or fluctuates due to combinatorial constraints.
A potential pitfall arises if you forget the difference between continuous vs. discrete sampling. As soon as you switch to discrete points, the geometry must be translated into a purely combinatorial counting. Relying on continuous intuition might lead to incorrect assumptions for smaller
N
Could the probability change if we only consider chords longer than a certain threshold?
Consider the possibility that instead of selecting any random chord, we impose the condition that the chord length must exceed some fraction of the circle’s diameter (for example, at least half the diameter). This new condition filters the potential chords to those that are “long enough.” The primary subtlety is that “random chord, subject to a length constraint” can be interpreted in multiple ways:
One interpretation is to first select a chord at random from the entire set of possible chords, then reject it if it fails the length requirement, and repeat until you get a chord that meets the criterion.
Another interpretation might be to fix a geometric constraint on chord midpoints or angles to ensure the chord meets the length condition in a uniform manner.
In either case, the probability of intersection may differ from
because restricting chord length imposes a non-uniform selection of chords from the space of all possible chords. Chords that are very long must have midpoints lying closer to the center of the circle, so the random selection is no longer uniform on the circle’s circumference for each endpoint. This typically breaks the original argument that each chord is simply determined by two uniform points on the circumference. Exactly how the probability changes depends on the distribution of chord lengths in the new sampling scheme.
How does the probability behave if we choose more than two chords? For instance, the chance that three randomly chosen chords all intersect in one common point inside the circle?
When extending to three or more chords, the question can become significantly more intricate. Specifically, for three chords to all intersect at one interior point, their endpoints must be arranged so that each pair of chords intersects. Some clarifications include:
If all three chords intersect at exactly the same interior point, that imposes a geometric constraint that is quite restrictive. For three chords to share a single interior intersection point, they must all pass through the same location. This typically suggests each chord’s endpoints are on opposite sides of that common point, in a precise alignment.
If you only want each pair of chords to intersect (not necessarily at the same point), you then need every pair of chords to have endpoints in an interlaced arrangement. However, ensuring all three pairs are interlaced is more complicated to count. You’d need to look at how six distinct points around the circle might be arranged so that chord 1 intersects chord 2, chord 2 intersects chord 3, and chord 1 intersects chord 3 inside the circle.
A key subtlety is that these intersection events are not independent. Even if chord 1 intersects chord 2, and chord 2 intersects chord 3, it does not automatically mean chord 1 intersects chord 3. Hence, you have to do a careful combinatorial enumeration of valid arrangements of six points to see how many ways each set of points can form three chords that are all mutually intersecting. This approach is more advanced and typically requires robust combinatorial reasoning or a programming-based enumeration to avoid mistakes.
If the center of the circle is chosen to define chords (for instance, picking an angle and drawing a chord that passes through the circle’s center), how does the probability change?
A drastically different selection mechanism is to always pick a chord by choosing a random angle, then drawing the chord that goes through the center at that angle. In this scenario, each chord is effectively a diameter. The question of two diameters intersecting inside the circle is trivial: any two diameters must intersect at the center. So in this special scenario, the probability that the chords intersect inside the circle becomes 1 (or 100%). This outcome makes clear that the definition of a “random chord” is crucial to the problem. A well-known pitfall is to assume that any chord selection method leads to the same probability. In fact, changing how you pick chords can drastically alter the final probability of intersection, as illustrated by this extreme example where all chords are diameters.
What if the circle is replaced by an ellipse or some other convex shape?
Replacing the circle with a more general ellipse, or any arbitrary convex shape, changes how we measure “randomness” of chord endpoints along the boundary:
If you select endpoints randomly on the boundary of an ellipse, do you pick them by uniform arc length parameterization around the ellipse, or do you pick them by uniform angle in some coordinate system, or something else? Different definitions can yield different chord distributions.
The condition for chords to intersect still relies on the notion of interlaced endpoints around the boundary. However, for an ellipse, the “clockwise order” can be more complicated to reason about if the shape is not perfectly symmetrical like a circle. Usually, there is still a concept of moving around the perimeter in a consistent direction, but the geometry can become more cumbersome to visualize.
Despite these complications, the fundamental combinatorial principle of choosing four distinct points on a convex boundary in “interspersed order” still applies. You can still label them A, B, C, D in the order in which they appear around the perimeter (in a single traversal), and the chord intersection criterion is that the endpoints must interlace. As a result, if you truly pick endpoints uniformly around the boundary perimeter, you might still conclude that 1 out of 3 pairings results in an intersection. Yet care is needed when verifying that the perimeter-based selection is indeed uniform in the ellipse setting.
The main pitfall is incorrectly assuming that every chord distribution in an ellipse is directly analogous to the circle case. The geometry of the boundary might give identical topological relationships, but if the chord generation is not strictly “pick two points uniformly around the boundary perimeter,” the probability can deviate from 1/3.
Could any approximations or numerical methods fail if the number of trials is too small, or if floating-point precision issues arise?
In a computational simulation of random chord intersection, floating-point precision might pose practical challenges:
When using orientation tests or cross-products, very small floating-point rounding errors can lead to misclassification of whether two line segments intersect. If the cross-product is extremely close to zero, the chord might be nearly collinear or share endpoints, but floating-point inaccuracy could push the check in or out of the threshold.
If the number of simulation trials is not large enough, the estimates may differ significantly from the true probability. This is a common pitfall in Monte Carlo methods: you need enough trials for the law of large numbers to bring the empirical frequency close to the theoretical probability.
Moreover, if random angle generation or random coordinate sampling is implemented incorrectly, biases can sneak in. For instance, picking angles with poor pseudo-random generators can skew the distribution of chords and yield a result that does not converge to 1/3.
The remedy is to use higher-precision computations (e.g., Python’s decimal
module if needed), robust geometric intersection tests that handle near-collinearity, and a sufficiently large number of samples. In addition, verifying the distribution of angles or boundary points is indeed uniform is crucial to ensure the simulation correctly models the geometry.
What if we allow chords to be oriented or weighted according to some external distribution, like a radial weighting from the center?
In some applications, chords might be generated by picking their midpoint from some radial distribution inside the circle. For instance, if the midpoint is chosen closer to the center with higher probability, then on average you get longer chords. The probability of intersection depends on the relative frequency of chords of different lengths and orientations:
When two chords’ midpoints are more likely to lie near the center, a higher fraction of them tend to be longer chords that can have greater overlap within the circle. Intuitively, you might guess a higher chance of intersection, but the exact effect depends on how the chord orientation is assigned once the midpoint is placed.
A typical approach is “pick a midpoint at random from the area of the circle,” and then pick a random orientation. In such a scenario, you can’t simply say the endpoints are uniform along the circumference. Instead, chords with midpoints near the boundary might be shorter, chords with midpoints near the center might be longer, and the resulting intersection probability cannot be easily stated as 1/3 without further derivation or simulation.
A subtlety here is that you must carefully track both the midpoint distribution and the orientation distribution. If either is non-uniform or correlated, the result shifts. One might need advanced geometric probability methods or thorough Monte Carlo simulations to find an exact or approximate answer.
Are there scenarios where selecting four endpoints is ambiguous or degenerate (e.g., points coincide or lie in a straight line)?
Finally, degenerate cases can occur if you pick endpoints that overlap or lie in special positions:
Overlapping endpoints: If the same point on the circle is chosen more than once, then you don’t really have two distinct chords. You either have a chord plus a degenerate “point chord,” or you end up with just one chord. Such outcomes typically have probability zero in continuous uniform sampling, yet they can arise in discrete sampling or in poorly coded simulations.
Collinear endpoints: In a circle, any chord endpoints by definition cannot be collinear with the circle’s center in the sense of all four points lying on a straight line, but you could imagine a scenario where you pick exactly two antipodal points repeated. This again reduces to degenerate chord definitions. Usually, these events also have probability zero in a continuous model, but they can still appear in finite numerical simulations.
These degeneracies highlight the importance of verifying that your random selection method precludes duplicates or near-duplicates if you want a clean probability of intersection. They also remind us that, in a purely theoretical continuous setting, certain edge cases technically occur with measure zero, so they do not affect the final probability. However, in discrete or computational approximations, you might need to handle them explicitly.