Copyright © University of Cambridge. All rights reserved.
This is the second of the two articles on rightangled triangles whose edge lengths are whole numbers. We suppose that the lengths of the two sides of a rightangled triangles are $a$ and $b$, and that the hypotenuse has length $c$ so that, by Pythagoras' Theorem,$$a^2 + b^2 = c^2$$.
In the first article we discussed the possibility of enlarging or shrinking a rightangled triangle to get another rightangled triangle whose sides also have lengths that are whole numbers, and we claimed there that apart from a possible scaling of the triangle, every such rightangled triangle has edge lengths of the form
$a=2pq \; \; \;$ 
$b=p^2q^2 \; \; \;$ 
$c=p^2+q^2$

For suitable whole numbers $p$ and $q$, where $p> q$. This article contains a proof of this fact.
First, we must understand a few ideas about factors and prime numbers. A factor of a whole number $n$ is a whole number $f$ that divides into $n$ exactly (without remainder). Of course, $1$ and $n$ are always factors of $n$, and we say that $n$ is a prime number if $1$ and $n$ are the only factors of $n$. We do not regard $1$ as a prime number (even though its only factor is 1), and you
should now check that the first few prime numbers are $2$, $3$,$5$, $7$, $11$, $13$, $17$.
What are the next three prime numbers?
If a number $n$ is not a prime number then we must be able to write it as a product of two numbers $u$ and $v$; that is $n = u \times v$, and we normally write this as $n = u v$. If $u$ (or $v$) is not a prime number, then we can write $u$ (or $v$) as a product and so write $n$ as a product of three numbers. We can continue in this way until every number that we are left with is a prime
number, and this shows that every number $n$ is a product of prime numbers.
For example, suppose that we start with $255$. Then $255 = 5 \times 51$. Now $5$ is a prime, but $51$ is not. Next, $51 = 3 \times 17$ and both $3$ and $17$ are primes; thus $255 = 3 \times 5 \times 17$ and we say that $3$, $5$ and $17$ are the prime factors of $255$. Of course, some prime factors may be repeated; for example, $75 = 3 \times 5 \times 5$, and $315 = 3 \times 105 = 3 \times 5
\times 21 = 3 \times 3 \times 5 \times 7$.
If we know that $f$ is a prime factor of a product $u v$, then (writing $u$ and $v$ as a product of prime numbers) we see that $f$ must occur as one of the prime factors of $u$ or of $v$ (or of both), so that $f$ must be a factor of $u$ or of $v$.
We repeat :
(I) if $f$ is a prime factor of $u v$ then $f$ must be either a prime factor of $u$ or a prime factor of $v$.
Note that this result is NOT true of every factor; our claim applies only to prime factors. For example, $6$ is a factor of $4 \times 9$, but it is not a factor of $4$ or of $9$; of course, each prime factor of $6$ is a factor of either $4$ or $9$.
A number $n$ is a square number if $n = m^2$ for some whole number $m$. It is easy to see (by writing $n$ as the product of its prime factors) that a whole number $n$ is a square number if every one of its prime factors occurs an even number of times. For example:
$5 \times 5 \times 7 \times 7$ is a square number but $3 \times 5 \times 7 \times 7$ is not.
Here are two useful facts about factors and square numbers.
Suppose that $f$ is a prime factor of the square number $n=m^2$. Then
(II) $f$ is a prime factor of $m$, and
(III) $f$ is a prime factor of $n$.
The statement (II) is just the statement (I) with $u = v = m$.
From (II) we see that $f$ is a prime factor of $m$, and this means that $f$ is a factor of $m^2 = n$ which is (III).
We now return to the problem of showing that every triple of whole numbers $a$, $b$, $c$ with $a^2+ b^2 = c^2$ can be expressed in the form (1).
To show this, we start with any Pythagorean triple and first reduce it as much as possible to end with a triple $a$, $b$, $c$ which cannot be reduced any more. This means that there is no whole number (except 1) which is a factor of each of $a$, $b$, $c$ (for otherwise, we could reduce the triangle still further). We shall show now that these $a$, $b$, $c$ can be written in the form (1) for
some suitable $p$ and $q$. There are, of course, three possibilities that can arise, namely:
(i) $ a$ and $b$ are both even;
(ii) $a$ and $b$ are both odd;
(iii) one of $a$ and $b$ is even and the other is odd.
In fact, neither (i) nor (ii) can happen so let us see why.
First, (i) cannot happen because if $a$ and $b$ are both even, then $c^2 (=a^2 + b^2)$ is even, so that $c$ is also even. But then $a$, $b$ and $c$ each have a factor 2 and we could have reduced the triple $a$, $b$, $c$ still further.
So $a$ and $b$ cannot both be even.
To see that (ii) cannot happen suppose that $a$ and $b$ are both odd. Then the remainder when dividing $a^2$ (and also $b^2$ ) by $4$ is $1$, so that the remainder when dividing $c^2 (= a^2 + b^2 )$ by 4 is 2.
However, if $c$ is even, $c^2$ is a mulitple of 4, so this remainder must be 0, while if $c$ is odd the remainder must be 1.
We now know that (iii) must hold and we shall take $a$ to be the even number and $b$ to be the odd number.
As $c^2 = a^2 + b^2$ , we see that $c$ must be odd.
As $b$ and $c$ are odd, their sum must be even and their difference must also be even. So we can find whole numbers $r$ and $s$ such that $2r = c + b$ and $2s = c  b$, and this means that
\begin{eqnarray} b = r  s,\\ c = r + s \\ \mbox{ and } \mbox{ } a^2 = c^2  b ^2 = (c + b)(c  b) = 4rs \mbox{. . . . . . . (2)} \end{eqnarray}
This is similar to (1) but not quite the same. Also, not every choice of $r$ and $s$ here gives us a triple of whole numbers. For example, if we take $r=2$ and $s=1$ we get $a^2 = 8$ so that in this case $a$ is not a whole number. We are going to show that $r$ and $s$ in (2) must be square numbers. Then we can write $r=p^2$ and $s=q^2$, say, and then (2) gives
\begin{eqnarray} a = 2p q \\ b = p  q \\ c = p + q \mbox{ which is (1).}\end{eqnarray} The hardest part of this article is to show that $r$ and $s$ are square numbers, and this depends on understanding the ideas about factors and prime numbers.
First, we must show that $r$ and $s$ cannot have any common factors.
To see this, suppose that $r$ and $s$ have a common prime factor $f$. Then $r  s (= b)$ and $r + s (= c)$ both have $f$ as a factor, so that $f$ is a factor of $c^2  b^2$, which is $a^2$ . As $f$ is a prime factor of $a^2$, then $f$ is a factor of $a$.
This would mean that $f$ is a factor of each of $a$, $b$, $c$ and this cannot be so else again we would have reduced the triple $a$, $b$, $c$ still further at the outset.
We have now shown that $r$ and $s$ have no common factors.
Now take any prime factor $f$ of $r$. First, as $r$ and $s$ have no common factors, we see that $f$ is not a factor of $s$. Next, as $f$ is a prime factor of $r$, it is also a prime factor of $r s$, and hence a prime factor of the whole number $\left( \frac{a}{2}\right)^2$ (because $\left(\frac{a}{2}\right)^2 = r s$).
As $f$ is a prime factor of $\left(\frac{a}{2}\right)^2$, it follows from (III) that $f^2$ is a factor of $\left(\frac{a}{2}\right)^2 = r s$, and because $f$ is not a factor of $s$, we now see that $f^2$ is a factor of $r$.
We have just seen that if $f$ is any prime factor of $r$, then $f^2$ is a factor of $r$, and this means that $r$ is a square number. The same argument is true for $s$ as well as $r$, so that as $r$ and $s$ are square numbers.
Because $r$ and $s$ are square numbers we can now write $r=p^2$ and $s=q^2$ for some $p$ and $q$ and, at last, we have shown that $a = 2p q$, $b = p^2  q^2$ and $c = p^2 + q^2$ which is (1).