Why can primes of the form 4k − 1 not be written as sums of two squares?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

In number theory, the property regarding the sum of two squares is specifically associated with primes of the form 4k+1. Pierre de Fermat famously observed that every prime of the form 4k+1 can be uniquely expressed as the sum of two squares, a result later proven by Leonhard Euler.31

Primes of the form 4k−1 (which are equivalent to 4k+3) cannot be written as the sum of two squares because of the constraints of modular arithmetic. Specifically, any square of an integer is congruent to either 0 or 1 modulo 4. Consequently, the sum of two squares can only be congruent to 0, 1, or 2 modulo 4. A prime of the form 4k+3 is congruent to 3 modulo 4, which is impossible to achieve by adding two squares under these conditions.2

While these primes cannot be expressed as the sum of two squares, Lagrange’s four-square theorem establishes that every positive integer, including these primes, can be expressed as the sum of four or fewer squares.31