Fermat’s Sum of Two Squares Theorem
Fermat’s Sum of Two Squares Theorem states that any odd prime number of the form \(p = 4n + 1\) (\(p\) is congruent to \(1\) mod \(4\)) can be expressed as a sum of two squares:
\[p = x^2 + y^2,\]
where \(x,y \in \mathbb{Z}\).
Although the proof is named after Pierre de Fermat it was first proposed by Albert Girard in 1625. Neither Mathematicians could provide a proof and for 100 years it was still not formally proven. Euler succeeded in providing an elementary proof in 1749 by method of Infinite Descent and bringing together other supplementary ideas from Number Theory such as Fermat’s Little Theorem, Finite Differences and the Diophantus’ Identity.
The proof is split into 5 propositions that each build up to proving the general statement for the theorem. Although more simple proofs do exist (such as Zagier’s one-line proof), Euler’s is completely elementary and more elegant in its approach.
Proposition 1
Claim: The product of two numbers, each of which is a sum of two squares, is itself a sum of two squares.
To prove this, ideas from Diophantus have to be borrowed:
The Brahmagupta-Fibonacci Identity (also known as The Diophantus Identity)
The Brahmagupta-Fibonacci identity expresses two sums of two squared numbers multiplied together. This is then expressed as a sum of two squares in two different ways.
\[ \begin{split} (a^2+b^2)(c^2+d^2) = &\ (ac-bd)^2+(ad+bc)^2\\ = &\ (ac+bd)^2+(ad-bc)^2. \end{split}\]
For example \((1^2+4^2)(2^2+7^2)=(-26)^2+15^2=30^2+(-1)^2.\)
It is clear that for any \(a,\ b,\ p,\ q\) the following is true:
\[(a^2+b^2)(p^2+q^2) = (ap+bq)^2+(aq-bp)^2.\]
Proposition 2
Claim: If a number, which is a sum of two squares, is divisible by a prime which is also a sum of two squares, then its quotient is also a sum of two squares.
The proposition can be expressed mathematically as:
Equation 1 \[\frac{a^2 + b^2}{p^2 + q^2} = N,\ N \in \mathbb{R},\]
assuming that \(a^2+b^2\) is divisible by \(p^2+q^2\) (prime). By using an intermediate step, we can write
Equation 2 \[\begin{equation} \begin{split} (pb-aq)(pb+aq) & = p^2b^2 + pbaq - aqpb - a^2q^2 \\ & = p^2(a^2+b^2) - a^2(p^2+q^2). \end{split} \end{equation}\]By rearranging equation 1, we get \(a^2+b^2= N (p^2+q^2)\). Then rewriting \(p^2(a^2+b^2)-a^2(p^2+q^2)\) we get:
\[\begin{equation*} p^2(N(p^2+q^2))-a^2(p^2+q^2). \end{equation*}\]As \(p^2+q^2\) is common, clearly this shows that \(p^2+q^2\) divides both terms. Therefore as the right hand side of equation 2 divides by \(p^2+q^2\), then it follows that the left hand side must also be divisible. \ Since \((p^2+q^2)\) is a prime number, by Euclid’s Lemma, it divides one of the two factors \((pb-aq)(pb+aq)\). We will consider the case of \((p^2+q^2)\) dividing the factor \((pb-aq)\). Using the Diophantus identity:
Equation 3 \[\begin{equation} (a^2+b^2)(p^2+q^2)=(ap+bq)^2+(aq-bp)^2, \end{equation}\]we know that \((p^2+q^2)\) is a divisor of the left hand side from our initial assumption. Now looking at the right hand side, we notice that \((aq-bp)^2\) can be rewritten as
\[\begin{equation*} (aq-bp)^2 = ((-1)(pb-aq))^2 = (pb-aq)^2. \end{equation*}\]As we know that \((pb-aq)\) is divisible by \((p^2+q^2)\), then the square must also be divisible. Therefore, in order to satisfy the equality of Diophantus’ identity, \((ap+bq)^2\) must also be divisible by \((p^2+q^2)\). Hence, we can divide equation 3 by \((p^2+q^2)^2\) to obtain:
\[\begin{equation*} \frac{a^2+b^2}{p^2+q^2} = \bigg(\frac{ap+bq}{p^2+q^2}\bigg)^2 + \bigg(\frac{aq-bp}{p^2+q^2}\bigg)^2. \end{equation*}\]As a result, we have proved that a number which is a sum of two squares that is divisible by a prime which is also a sum of two squares, is itself, a sum of two squares. Note that selecting the second factor \((pb+aq)\) and presenting a similar argument yields the same result. In this case, you would need to use Diophantus’ alternative identity \((a^2+b^2)(p^2+q^2) = (ap-bq)^2 + (aq+bp)^2\) and see that the term \((aq+bp)^2\) is divisible by the prime \((p^2+q^2)\).
Example
Let \(a\) = 2, \(b\) = 10, \(p\) = 2 and \(q\) = 3. Substituting our values into equation 1, we see that:
\[\begin{equation*} \frac{a^2+b^2}{p^2+q^2}= \frac{2^2+10^2}{2^2+3^2}= \frac{104}{13}=8=2^2+2^2. \end{equation*}\]Proposition 3
Claim: If a number can be written as a sum of two squares and is divisible by a number which is not a sum of two squares, then the quotient has a factor which is not a sum of two squares.
To show the above statement is true, we will be proving it by contradiction and show that if all the factors of \(a^{2} + b^{2}\) can be expressed as a sum of two squares, then some factor \(x\) is a sum of two squares.
Assume \(x\) divides \(a^{2} + b^{2}\), we have the following:
Equation 1 \[\begin{equation} \frac{a^{2} + b^{2}}{x} = p_1,p_2,p_3,\dots,p_n, \end{equation}\]for \(n\in \mathbb{N}\) and \(p\) prime. By rearranging equation 1 we get:
\[\begin{equation*} {a^{2} + b^{2}} = x \times({p_1,p_2,p_3,\dots,p_n}). \end{equation*}\]There are two cases that could occur:
Where all \(p_1,p_2,p_3,\dots,p_n\) can be written as a sum of two squares,
Where at least one of the numbers $p_1 p_n $ cannot be written as a sum of two squares.
If the second case is satisfied then we have proved the proposition.
- In case 1 we can use proposition 2 which states:
If a number, which is a sum of two squares, is divisible by a prime which is also a sum of two squares, then its quotient is also a sum of two squares, say \(z^{2} + r^{2}\).
Thus, we have assumed that the prime numbers \(p_1,p_2,p_3,\dots,p_n\) can be written as a sum of two squares, so by dividing a prime number \(p\) we get the following:
\[\begin{equation*} \frac{a^{2} + b^{2}}{p_1} = x \times({p_2,p_3,\dots,p_n} ) = {z^{2} + r^{2}}, \end{equation*}\]carrying this out for \(p_2\) as well will give us the following result:
\[\begin{equation*} \frac{a^{2} + b^{2}}{ p _1 \times p_2} = \frac{z^{2} + r^{2}}{p_2} = x \times({p_3,\dots,p_n} ) = t^{2} + h^{2}. \end{equation*}\]If this is carried on until we reach the prime \(p_n\) we will see the following:
\[\begin{equation*} \frac{a^{2} + b^{2}}{ p _1 \times p_2 \times p_3 \times \dots \times p_{n}} = {l^{2} + m^{2}} = x. \end{equation*}\]From the above result we can conclude that \(x\) has to be a sum of two squares, and there by contradiction we stated that \(x\) is not a sum of two squares and then there exists a \(p_n\) which is not a sum of two squares.
Example
Let \(a = b = 12\) and \(x = 24\), then
\[\begin{equation*} \frac{a^{2} + b^{2}}{x} \Rightarrow \frac{12^{2} + 12^{2}}{24} = \frac{288}{24} = 12. \end{equation*}\]Now, if we split 12 up into its factors we obtain the following:
We see that some factors of \(12\) are not the sum of squares, as stated by the proposition. For example; \(3,\ 4,\ 6\) and \(12\).
Click here for propositions 4 and 5.