Solutions of Pythagorean Equation/Primitive

From ProofWiki
Jump to navigation Jump to search


The set of all primitive Pythagorean triples is generated by:

$\tuple {2 m n, m^2 - n^2, m^2 + n^2}$


$m, n \in \Z_{>0}$ are (strictly) positive integers
$m \perp n$, that is, $m$ and $n$ are coprime
$m$ and $n$ are of opposite parity
$m > n$

Proof 1

First we show that $\tuple {2 m n, m^2 - n^2, m^2 + n^2}$ is a Pythagorean triple:

\(\ds \paren {2 m n}^2 + \paren {m^2 - n^2}^2\) \(=\) \(\ds 4 m^2 n^2 + m^4 - 2 m^2 n^2 + n^4\)
\(\ds \) \(=\) \(\ds m^4 + 2 m^2 n^2 + n^4\)
\(\ds \) \(=\) \(\ds \paren {m^2 + n^2}^2\)

So $\tuple {2 m n, m^2 - n^2, m^2 + n^2}$ is indeed a Pythagorean triple.

Now we establish that $\tuple {2 m n, m^2 - n^2, m^2 + n^2}$ is primitive:

Aiming for a contradiction, suppose to the contrary, that $\tuple {2 m n, m^2 - n^2, m^2 + n^2}$ is not primitive.

So there is a prime divisor $p$ of both $2 m n$ and $m^2 - n^2$.

That is:

$p \in \mathbb P: p \divides \paren {2 m n}, p \divides \paren {m^2 - n^2}$

Then from Prime Divides Power:

$p \divides \paren {2 m n}^2$ and $p \divides \paren {m^2 - n^2}^2$

Hence from Common Divisor Divides Integer Combination:

$p \divides \paren {m^2 + n^2}^2$

and from Prime Divides Power again:

$p \divides \paren {m^2 + n^2}$

So from Common Divisor Divides Integer Combination:

$p \divides \paren {m^2 + n^2} + \paren {m^2 - n^2} = 2 m^2$
$p \divides \paren {m^2 + n^2} - \paren {m^2 - n^2} = 2 n^2$

But $p \ne 2$ as, because $m$ and $n$ are of opposite parity, $m^2 - n^2$ must be odd.

So $p \divides n^2$ and $p \divides m^2$ and so from Prime Divides Power, $p \divides n$ and $p \divides m$.

But as we specified that $m \perp n$, this is a contradiction.

Therefore $\paren {2 m n, m^2 - n^2, m^2 + n^2}$ is primitive.


Now we need to show that every primitive Pythagorean triple is of this form:

So, suppose that $\tuple {x, y, z}$ is any primitive Pythagorean triple given in canonical form.

From Parity of Smaller Elements of Primitive Pythagorean Triple, $x$ and $y$ are of opposite parity.

By definition of canonical form $x$ is even and $y$ and $z$ are both odd.

As $y$ and $z$ are both odd, their sum and difference are both even.

Hence we can define:

$s, t \in Z: s = \dfrac {z + y} 2, t = \dfrac {z - y} 2$.

Note that $s \perp t$ as any common divisor would also divide $s + t = z$ and $s - t = y$, and we know that $z \perp y$ from Elements of Primitive Pythagorean Triple are Pairwise Coprime.

Then from the Pythagorean equation:

$x^2 = z^2 - y^2 = \paren {z + y} \paren {z - y} = 4 s t$


$\paren {\dfrac x 2}^2 = s t$

As $x$ is even, $\dfrac x 2$ is an integer and so $s t$ is a square.

So each of $s$ and $t$ must be square as they are coprime.

Now, we write $s = m^2$ and $t = n^2$ and substitute back:

$x^2 = 4 s t = 4 m^2 n^2$ and so $x = 2 m n$
$y = s - t = m^2 - n^2$
$z = m^2 + n^2$

Finally, note that:

$m \perp n$ from $s \perp t$ and Prime Divides Power
$m$ and $n$ have opposite parity otherwise $y$ and $z$ would be even.

Thus, our primitive Pythagorean triple is of the form $\tuple {2 m n, m^2 - n^2, m^2 + n^2}$.


Proof 2

Let $\tuple {A, B, C}$ be a Pythagorean Triple:

$A^2 + B^2 = C^2$

By the Pythagorean theorem, this equation describes the sides of a right triangle:


By the definitions of sine and cosine:

\(\ds \sin \theta\) \(=\) \(\ds \frac A C\)
\(\ds \cos \theta\) \(=\) \(\ds \frac B C\)

That is,

\(\ds A\) \(=\) \(\ds C \sin \theta\)
\(\ds B\) \(=\) \(\ds C \cos \theta\)

Next, we invoke Equiangular Triangles are Similar and Proportion is Equivalence Relation to write:

\(\ds A\) \(\propto\) \(\ds B \propto C\)
\(\ds \leadsto \ \ \) \(\ds C \sin \theta\) \(\propto\) \(\ds C \cos \theta \propto C\) from above
\(\ds \leadsto \ \ \) \(\ds \sin \theta\) \(\propto\) \(\ds \cos \theta \propto 1\) dividing throughout by $C$

We construct the following restriction of $\tan \dfrac \theta 2$.

From Shape of Tangent Function, $\tan \dfrac \theta 2: \openint 0 \pi \leftrightarrow \openint 0 {+\infty}$ is a bijection.

Restrict $\tan \dfrac \theta 2$ on this interval so that its image is the set of strictly positive rational numbers:

$\tan \dfrac \theta 2: \tan^{-1} \sqbrk {\Q_{>0} } \cap \openint 0 \pi \leftrightarrow \Q_{>0}$

Then $\ds \tan \frac \theta 2 = \frac p q$ for some $\dfrac p q \in \Q_{>0}$, where $\dfrac p q$ is the canonical form of a rational number.

From the Double Angle Formulas:

\(\ds \sin \theta\) \(=\) \(\ds 2 \sin \frac \theta 2 \cos \frac \theta 2\)
\(\ds \cos \theta\) \(=\) \(\ds \cos^2 \frac \theta 2 - \sin^2 \frac \theta 2\)
\(\ds 2 \sin \frac \theta 2 \cos \frac \theta 2\) \(\propto\) \(\ds \cos^2 \frac \theta 2 - \sin^2 \frac \theta 2 \propto 1\) substituting into the above proportion
\(\ds \leadsto \ \ \) \(\ds 2 \tan \frac \theta 2\) \(\propto\) \(\ds 1 - \tan^2 \frac \theta 2 \propto \sec^2 \frac \theta 2\) dividing throughout by $\cos^2 \dfrac \theta 2$
\(\ds \leadsto \ \ \) \(\ds 2 \tan \frac \theta 2\) \(\propto\) \(\ds 1 - \tan^2 \frac \theta 2 \propto 1 + \tan^2 \frac \theta 2\) Difference of Squares of Secant and Tangent
\(\ds \leadsto \ \ \) \(\ds 2 \frac p q\) \(\propto\) \(\ds 1 - \paren {\frac p q}^2 \propto 1 + \paren {\frac p q}^2\)
\(\ds \leadsto \ \ \) \(\ds 2 \frac p q\) \(\propto\) \(\ds 1 - \frac {p^2} {q^2} \propto 1 + \frac {p^2} {q^2}\)
\(\ds \leadsto \ \ \) \(\ds 2 p q\) \(\propto\) \(\ds q^2 - p^2 \propto q^2 + p^2\) multiplying throughout by $q^2$

Thus these proportions describe the sides of a right triangle:

By the Pythagorean theorem, $\tuple {2 p q, q^2 - p^2, q^2 + p^2}$ is a Pythagorean triple.

That $p, q \in \Z_{>0}$ follows from $\dfrac p q \in \Q_{>0}$.

That $p \perp q$ follows from the assumption that $\dfrac p q$ was written in canonical form.

That every triple is of this form follows from the bijectivity of the tangent function as restricted above.

Recall $q^2 - p^2$ describes the side of a triangle, and so is positive.

Then $q^2 - p^2 > 0$ and therefore $q > p$.

It remains to be proven that:

this triple is primitive
$p$ and $q$ are of opposite parity.

Historical Note

It is clear from the cuneiform tablet Plimpton $\mathit { 322 }$ that the ancient Babylonians of $2000$ BCE were familiar with this result.

The complete solution of the Pythagorean equation was known to Diophantus of Alexandria.

It forms problem $8$ of the second book of his Arithmetica.

It was in the margin of his copy of Bachet's translation of this where Pierre de Fermat made his famous marginal note that led to the hunt for the proof of Fermat's Last Theorem.