Sums of Two Squares

Summary: Numbers expressible as with integer . Closed under multiplication via the brahmagupta-fibonacci-identity. Fermat’s two-square theorem (asserted by Euler in §172, footnote 83): an odd prime is a sum of two squares iff . No number is a sum of two squares.

Sources: chapter-2.0.11, chapter-2.0.12, chapter-2.0.14

Last updated: 2026-05-09


The Set

Numbers of the form up to 50 (with unrestricted, so is allowed):

Euler’s classification (ch2.0.11-quadratic-form-factorization §172) splits these by structure:

  • Compound: products of multiple smaller representable numbers (built via the identity below).
  • Simple: irreducibly representable:

The simple list contains:

  • the prime , and
  • odd primes : , and
  • squares of primes : , .

Mod-4 Obstruction (§172)

Squares modulo 4 take values (even square) or (odd square). So a sum of two squares is one of . No number is a sum of two squares.

In particular, (or equivalently ) primes like cannot be sums of two squares.

This is a special case of the residue-class technique systematized in ch2.0.5-impossibility-quadratic-squares and quadratic-residues.


Multiplicative Closure

The brahmagupta-fibonacci-identity gives:

So if and are each sums of two squares, then so is . A product of sum-of-two-squares numbers gives up to representations of the product.

Example (§171): has four representations:


Fermat’s Two-Square Theorem

Euler asserts in §172 (footnote 83):

Every prime number of form is a sum of two squares.

Combined with the obstruction above and the multiplicative closure:

Theorem (Fermat, proved by Euler 1747). A positive integer is a sum of two squares in the prime factorization of , every prime appears to an even power.

Euler comments in §172: “this is undoubtedly true, but it is not easy to demonstrate it” — referencing his own published proof, which uses descent and the multiplicativity above.


As Higher Powers (Cubes, Biquadrates, Fifth Powers)

ch2.0.12-quadratic-form-as-power derives explicit parametrizations for when is an -th power, by raising to power and reading parts:

PowerExample

Variants: and

Euler studies analogous representability:

These are special cases of the binary quadratic form theory developed by Lagrange and Gauss.


Application: When can both be squares?

ch2.0.14-questions-squares §217-218 derives a clean equivalence: and are simultaneously squares for some rational iff is a sum of two squares. Reason: if and , then , so is a sum of two squares — and the multiplicative theory shows must be too.

Thus all numbers for which the question is impossible are precisely

and the remaining all admit infinite parametric solutions via brahmagupta-fibonacci-identity.

Theorem: and Never Both Squares (§229-230)

ch2.0.14-questions-squares §229-230 proves the impossibility of simultaneously making and squares for coprime . The proof:

  1. Residue classes mod 4, 3, 5 force odd, not divisible by 3 or 5, divisible by .
  2. Setting , the constraint reduces to factoring into coprime of opposite parity with a sum of two squares.
  3. For all candidates fail; descent extends to all .

This is one of Euler’s earliest “genus” results — distinguishing forms (genus I) from (genus II) in the binary-quadratic-form sense later systematized by Lagrange and Gauss.

Counter-class: Sums of Two Biquadrates

By stark contrast, ch2.0.13-impossibility-biquadrate-sums proves:

has no nontrivial solutions — even though has the infinite Pythagorean family. The jump from second to fourth powers introduces an obstruction defeated only by descent.