03 August 2013

A few posts back, we saw how to generate Pythagorean triples. We used the following parametrization: primitive triples are uniquely generated by the following equations,

\[a = 2mn,\; b = m^2 - n^2, c = m^2 + n^2\]

Where \(0 < n < m\), \(gcd(m, n) = 1\), and \(m - n\) is odd. It is easy to check that (a, b, c) is a Pythagorean triple. Checking that this triple is primitive is also quite straightforward. Let us consider that a, b, and c have a common prime divisor u.

  • If u = 2, then \(b = (m-n)(m+n)\) is even which is in contradiction with m-n being odd.
  • If \(u \geq 2\) as \(a = 2mn\) u divides either m or n. Suppose that m is divisible by u, then as \(b = m^2 - n^2\), u divides n which is in contradiction with m and n being coprime. The same argument holds for the case where n is divisible by u.

So we know have proven that (a, b, c) as defined above is a primitive triple. Proving the converse is slightly more involved. However the proof technique is quite interesting as it can be used to obtain parametrization (and so fast solving algorithms) for other Diophantine equations.

If (a, b, c) is a primitive Pythagorean triple, a and b cannot be both even so let us assume - without loss of generality - that b is not even. We want to prove that for any such primitive Pythagorean triple (a, b, c) there exists a pair (m, n) such that \(a = 2mn\), \(b = m^2 - n^2\), and \(c = m^2 + n^2\).

Let \(\alpha\) be the rational number \(a/c\). \((1-b/c) / \alpha\) is also a rational number hence there exists a coprime pair (m, n) such that \((1-b/c)/\alpha = m/n\), so we have \(b/c = 1 - \alpha m/n\). Then \(a^2 + b^2 = c^2\) gives us that:

\[\left(1-\alpha\frac{m}{n}\right)^2 + \alpha^2 = 1\] \[2\alpha\frac{m}{n} = \alpha^2\left(1+\frac{m^2}{n^2}\right)\] \[\alpha = \frac{2m/n}{1+m^2/n^2} = \frac{2mn}{m^2+n^2}\]

And so we obtain that:

\[\frac{a}{c} = \frac{2mn}{m^2+n^2},~\mbox{ and } \frac{b}{c} = \frac{m^2-n^2}{m^2+n^2}\]

As m and n are coprime, the only prime that could divide both \(2mn\) and \(m^2+n^2\) is 2. If \(m^2+n^2\) is even, m and n have the same parity so they are both odd and \(m^2-n^2\) is divisible by 4. Hence as \(a/b = 2mn/(m^2-n^2)\), b is even which is in contradiction with our hypothesis.

If \(m^2-n^2\) is odd, \(2mn\) and \(m^2+n^2\) are coprime, so there exists an integer \(\beta\) such that \(a = 2\beta mn\), \(c = \beta(m^2+n^2)\), and so \(b = \beta (m^2-n^2)\). As triple (a,b ,c) is coprime, \(\beta\) is equal to 1 and we obtain the awaited result.