Trouble in the alley
You're walking alone at night through a dark alley in the middle of the night[1] when a hooded figure stops you. They tell you: "Solve the following mathematical problem right now OR I WILL SHOOT YOU DEAD.". They give you a piece of paper with the problem statement.
Three points are chosen independently and uniformly at random from the interior of a unit circle. What is the probability that their circumcircle is entirely contained within the unit circle?
They have a gun so you have no choice but to solve it. Now, because you're super stressed you have no idea how to do this in some funky clever way by appealing to symmetry or whatever. You'll just have to do it the old fashioned way and painstakingly calculate the result. Luckily the hoodlum doesn't seem to care how long it takes you to arrive at the answer. He told you as much. He provides a notebook and pen.
The Cartesian start
You are dealing with 3 points, so 6 coordinates in total: 3
Now you know you're dealing with a circular problem (heh). So even though you're in grave danger (the ruffian keeps twirling the gun on his fingers as if to emphasize just how much danger) you've got the mental wherewithal to realise there's a potential variable transformation you can do to make it easier for yourself.
Let's express everything in terms of the circumcircle center
This gives you a mapping from
You have
Now, you have to calculate the Jacobian since this is a non-trivial transformation, and you'll have to adjust the integral appropriately. The hoodlum reminds you the columns represent the partials with respect to the given output variable, and the rows are with respect to the same input variable. You proceed.
The good news is that this is quite a regular Jacobian. The first two columns have a nice pattern, the third is straightforward (as long as you remember the
Nice, you think to yourself. Now this is a 6x6 matrix. You really don't want to be calculating the determinant... But you need it. You begin trying to calculate the determinant but the masked figure stops you. They remind you of determinant properties that will make your job much easier:
- You can factor out a number from a whole row / column and multiply the determinant by the same factor instead.
- The determinant doesn't change if you add or subtract one row from another.
- For
Block Triangular Matrices Where:
is a square matrix is a block of zeros and are the other chunks...
Then you know:
First, you notice the common factor of
You continue. You want to clear the
You're very happy. Since the top left
You can now subtract row 1 from row 3, and subtract row 2 from row 4. You get
Now you can expand down colum 2 instead of the dense column 1.
You start wondering if maybe you should have stuck with the original Cartesian product. Those sines look scary. You crack on nonetheless.
And then, remembering about the
Now, you know that
You're ecstatic. You love sines and cosines now. You loudly point out that
and hence
Your thug gives you a supportive nod. You don't care about the sign of
At this point you notice that this kind of makes sense because three collinear points won't make any kind of circumcirle. You carry on but you make a mental note to remember this problem if you ever need to interview someone for a software role. This is trivial now after all.
Okay, the Jacobian is all sorted. You move on to the probability calculation. In general, since we're picking points from the unit circle (area
Very generally
and less generally
where the condition you're after is
You hit this head on: you can split this into the angular part (the sine difference bit from the determinant of the Jacobian) and the geometric part.
For the geometric part, you realise that
So, the
Now, the angular part is just
Now, you grab a spare bit of paper and try to tackle this triple angular integral that has cost you so much effort already.
You start scribbling on the second page to quickly work out this triple integral...
Let the integrand be
By shift invariance[2], you integrate over the differences
For more detail
Formally, you can perform a change of variables:
Substituting this into the integral:
Now, substitute
The term
You use the product-to-sum formula
Using the product-to-sum formula on the inner term:
Substituting back into
Evaluating the two integrals separately:
(via integration by parts)
and you finally get the answer:
You feel you're very close now. You go back to the integral expression for
You simplify and expand the polynomial.
Distribute everything. The criminal seems very happy you're at this stage of the calculation.
Just the fractions now...
You've done it! The hooligan looks happy. He says you can go. He also says that everyone always calculates it this way, and he's yet to see a clever way that doesn't involve a sextuple integration. He invites you to share a clever solution later on by emailing it to him.
You wonder if you actually got the right answer. It was a nice fraction but did you not overcount? Undercount? Did you mess up the integral? The whole angular thing had like 6 permutations to it after all... Well, the villain seemed satisfied either way. You go home. You're very tired. You plan on not doing the "dark alley at night" thing any more.
Addendum: A Missed Symmetry
Added on Feb 8, 2026
Sub note: I received some great feedback and notes by email after publishing the original post. Thank you very much to everyone who reached out!
After the adrenaline wore off and I was safely back home, I realized I could have saved myself some work. While I was panicked in the alley, I missed a crucial simplification regarding the center of the circle.
The problem is 6-dimensional but we can "remove" 2 dimensions by symmetry considerations.
- The triangle has rotational symmetry of the three points relative to each other.
- The circumcenter has rotational symmetry, i.e. we only care about the radial part of the circumcenter.
We already exploited the rotational symmetry of the three points relative to each other (in the shift invariance part) to solve that nasty angular integral and get
The probability depends only on the relative configuration of the points and the radial position of their circumcenter. The angular position of the circumcenter,
We can switch the center coordinates from Cartesian
So, instead of the sextuple integral, we can combine our constants:
- Normalization:
- Angular Part:
- Center Rotational Symmetry:
This leaves us with a much cleaner double integral over the circumradius
Simplifying the constants gives us a leading factor of
And so (substituting
Same answer, less work. I suspect if I had done it this way, the mugger might have let me keep the pen.
- ← Previous
Why the Liar Is the Helpful One - Next →
Verifying the fraction