Probability that any two numbers are relatively prime
July 3, 2019

Two numbers are relatively prime if they have no common divisors except 1. It also means that the numbers have no prime factor in common.

The probability that a number is divisible by $2$ is $1/2$.
The probability that two numbers are both divisible by $2$ is $(\frac{1}{2}) .\frac{1}{2} = \frac{1}{2^2}$. And thus, probability that neither of the two numbers are divisible by $2$ is $(1 - \frac{1}{2^2})$

Similarly, probability that neither of the two numbers are divisible by $3$ is $(1-\frac{1}{3^2})$

Thus the probability that neither of the two numbers are divisible by any of the prime numbers is $$P(Relatively Prime) = (1-\frac{1}{2^2}).(1-\frac{1}{3^2}).(1-\frac{1}{5^2}).(1-\frac{1}{7^2})...$$ However, this is the minimum probability limit for any two numbers being relatively prime.

"Wait, but that's an infinite product. What am I gonna do with that big product?"

We'll see.

Let's intruduce an infinite sum, $$S = \frac{1}{1^2} + \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \frac{1}{5^2} + ...$$ Multiplying both sides by $\frac{1}{2^2}$,

$$\frac{1}{2^2}.S = \frac{1}{2^2}.\frac{1}{1^2} + \frac{1}{2^2}.\frac{1}{2^2} + \frac{1}{2^2}.\frac{1}{3^2} + \frac{1}{2^2}.\frac{1}{4^2} + \frac{1}{2^2}.\frac{1}{5^2} + ...$$ $$\frac{1}{2^2}.S = \frac{1}{2^2} + \frac{1}{4^2} + \frac{1}{6^2} +\frac{1}{8^2} +\frac{1}{10^2} + ...$$

Subtracting the last term from $S$, $$(1 - \frac{1}{2^2}).S = 1 + (\frac{1}{2^2} - \frac{1}{2^2}) + \frac{1}{3^2} + (\frac{1}{4^2} - \frac{1}{4^2}) + \frac{1}{5^2} + ...$$

$$S_1 = (1 - \frac{1}{2^2}).S = 1 + \frac{1}{3^2} + \frac{1}{5^2} + \frac{1}{7^2} + \frac{1}{9^2} ...$$

All the multiples of 2 are gone.

Now, multiply $S_1$ by $\frac{1}{3^2}$. $$\frac{1}{3^2}.S_1 = \frac{1}{3^2}.1 + \frac{1}{3^2}.\frac{1}{3^2} + \frac{1}{3^2}.\frac{1}{5^2} + \frac{1}{3^2}.\frac{1}{7^2} ...$$

Subtracting the last term from $S_1$. $$(1 - \frac{1}{3^2}).S_1 = 1 + \frac{1}{5^2} + \frac{1}{7^2} + (\frac{1}{9^2} - \frac{1}{9^2}) + ...$$ $$(1 - \frac{1}{3^2}).S_1 = 1 + \frac{1}{5^2} + \frac{1}{7^2} + \frac{1}{11^2} + ... + \frac{1}{23^2} + \frac{1}{25^2} + ...$$ $$(1 - \frac{1}{3^2}).(1 - \frac{1}{2^2}).S = 1 + \frac{1}{5^2} + \frac{1}{7^2} + \frac{1}{11^2} + ... + \frac{1}{23^2} + \frac{1}{25^2} + ...$$

All the remaining multiples of 3 are gone.

If we continue this with all the prime numbers, all the terms on the right are gone except 1. $$S.(1 - \frac{1}{2^2}).(1 - \frac{1}{3^2})(1 - \frac{1}{5^2})(1 - \frac{1}{7^2})(1 - \frac{1}{11^2})... = 1$$ So, $$S = \frac{1}{(1 - \frac{1}{2^2}).(1 - \frac{1}{3^2})(1 - \frac{1}{5^2})(1 - \frac{1}{7^2})(1 - \frac{1}{11^2})...}$$ $$(1 - \frac{1}{2^2})(1 - \frac{1}{3^2})(1 - \frac{1}{5^2})(1 - \frac{1}{7^2})(1 - \frac{1}{11^2})... = \frac{1}{S}$$ At the beginning, we defined $$S = \frac{1}{1^2} + \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \frac{1}{5^2} + ...$$ This is a very famous sum defined as, $$\zeta(2) = \frac{1}{1^2} + \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \frac{1}{5^2} + ...$$ The very beautiful symbol $\zeta$ is called Reimann Zeta Function named after the mathematician Bernhard Riemann. It is defined for all complex numbers as, $$\zeta(s) = \frac{1}{1^s} + \frac{1}{2^s} + \frac{1}{3^s} + \frac{1}{4^s} + \frac{1}{5^s} + ...$$ where $s$ is a complex number.

It might be surprising, but it is true that $$\zeta(2) = \frac{\pi^2}{6}$$ The proof to this fact is here.

So, going back to our original question, $$P(Relatively Prime) = (1-\frac{1}{2^2}).(1-\frac{1}{3^2}).(1-\frac{1}{5^2}).(1-\frac{1}{7^2})...$$ $$P(Relatively Prime) = \frac{1}{\zeta(2)}$$ $$P(Relatively Prime) = \frac{1}{\frac{\pi^2}{6}}$$ $$P(Relatively Prime) = \frac{6}{\pi^2}$$

There we go!! Probability that any two numbers are relatively prime to each other is not a very complicated expression.

[July 04 2019, Patan Dhoka]