## You are here

Hometheorem on sums of two squares by Fermat

## Primary tabs

Suppose that an odd prime number $p$ can be written as the sum

$p\;=\;a^{2}\!+\!b^{2}$ |

where $a$ and $b$ are integers. Then they have to be coprime. We will show that $p$ is of the form $4n\!+\!1$.

Since $p\nmid b$, the congruence

$bb_{1}\;\equiv\;1\;\;(\mathop{{\rm mod}}p)$ |

has a solution $b_{1}$, whence

$0\;\equiv\;pb_{1}^{2}\;=\;(ab_{1})^{2}\!+\!(bb_{1})^{2}\;\equiv\;(ab_{1})^{2}% \!+\!1\;\;(\mathop{{\rm mod}}p),$ |

and thus

$(ab_{1})^{2}\;\equiv\;-1\;\;(\mathop{{\rm mod}}p).$ |

Consequently, the Legendre symbol $\left(\frac{-1}{p}\right)$ is $+1$, i.e.

$(-1)^{{\frac{p-1}{2}}}\;=\;1.$ |

Therefore, we must have

$\displaystyle p\;=\;4n\!+\!1$ | (1) |

where $n$ is a positive integer.

Euler has first proved the following theorem presented by Fermat and containing also the converse of the above claim.

Theorem
(Thue’s lemma). An odd prime $p$ is
uniquely expressible as sum of two squares of integers if and
only if it satisfies (1) with an integer value of $n$.

The theorem implies easily the

Corollary. If all odd prime factors of a positive integer are congruent to 1 modulo 4 then the integer is a sum of two squares. (Cf. the proof of the parent article and the article “prime factors of Pythagorean hypotenuses”.)

## Mathematics Subject Classification

11A05*no label found*11A41

*no label found*11A67

*no label found*11E25

*no label found*

- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)

- Other useful stuff
- Corrections