What is the probability that two randomly selected positive integers are coprime?

April 28, 2018

Two integers are not coprime if they share a prime factor. They are coprime if they share no prime factors. For two integers to be coprime, they can't both have a factor of 2, or 3, or 5, or any other prime. If one of them has some prime factor p, then the other one can't have that factor.

Since multiples of p are spaced apart by p, the probability that a randomly chosen integer is divisible by some number p is:

$$ \frac{1}{p} $$

Thus the probability that two randomly chosen integers are both divisible by p is:

$$ \frac{1}{p^2} $$

And the probability that two randomly selected integers are not both divisible by p is:

$$ 1-\frac{1}{p^2} $$

Thus the probability that two randomly selected integers are not both divisible by any prime is:

$$ \prod_{p \hspace{1mm} prime}(1-\frac{1}{p^2}) $$

This is the probability that two numbers are coprime.

Now consider the Riemann Zeta Function:

$$ \zeta(s)=\sum_{n=0}^\infty\frac{1}{n^s}=\prod_{p\hspace{1mm}prime}(1-\frac{1}{p^s})^{-1} $$

Our answer then is:

$$ \frac{1}{\zeta(2)} $$

In 1734, Leonhard Euler showed that:

$$ \zeta(2)=1+\frac{1}{2^2}+\frac{1}{3^2}+\frac{1}{4^2}+... = \frac{\pi^2}{6} $$

Thus the solution to our problem, the probability that two positive integers are coprime, is:

$$ \boxed{\frac{6}{\pi^2}} $$