Probability That Two Random Numbers Are Coprime: The 6/π² Formula
Today we take a small detour from group theory — here is a remarkable fact about probability.
What is the probability that two randomly chosen natural numbers turn out to be coprime, meaning their only common divisor is 1?
At first glance it sounds complicated, but mathematics surprises us once again. The answer is 6/π², or approximately 0.608.
Why the Coprime Numbers Probability Equals 6/π²
Let’s walk through the reasoning step by step:
The probability that a single number is divisible by 2 is 1/2. The probability that both numbers are divisible by 2 is therefore 1/4.
The probability that both numbers are divisible by 3 is 1/9.
For any prime p, the probability that both numbers are divisible by p is 1/p².
Now we want the probability that no prime divides both numbers simultaneously. For a single prime p, that probability is 1 − 1/p². To account for all primes at once, we multiply these probabilities together:
Total probability = ∏(1 − 1/p²), taken over all primes p.
This infinite product converges to the famous result 6/π².
The Connection to the Riemann Zeta Function
The reason π appears here is not a coincidence. The product ∏(1 − 1/p²) is directly related to the Riemann zeta function. Euler proved that:
ζ(s) = ∏ 1/(1 − p⁻ˢ)
Setting s = 2 gives ζ(2) = π²/6, a result Euler himself established. The coprime probability is simply 1/ζ(2) = 6/π². The primes and π are connected through one of the deepest identities in all of mathematics.
What This Result Means in Practice
This means that if you pick two random numbers, in roughly 60.8% of cases their greatest common divisor will be 1.
This probability is not just a curiosity — it underpins a wide range of theoretical and applied results, from number theory to cryptography. For example, algorithms that rely on modular arithmetic or random prime generation implicitly lean on the density of coprime pairs in the integers.
Where Else Does Mathematics Surprise Us Like This?
It is remarkable that a simple question about divisibility leads straight to π — a constant we usually associate with circles and geometry. Yet here it emerges from the multiplicative structure of the integers, with no circle in sight.
This kind of unexpected connection is what makes number theory so compelling: the answer to a combinatorial question about primes turns out to live inside one of the most important functions in all of mathematics.