Teoría de NúmerosDiophantine Equations and Continued Fractions

Sums of Two Squares

n is a sum of two squares exactly when every prime ≡ 3 (mod 4) appears in its factorization to an even power.

Sin empezar Ir a la práctica

Esta lección aún no está traducida. Por ahora se muestra en inglés; la versión en español está en camino.

$5 = 1^{2} + 2^{2}$ and $13 = 2^{2} + 3^{2}$, but no matter how you try, $7$ and $21$ are not sums of two squares. Fermat found the pattern, and the supplementary law for $-1$ is the key to it.

Theorem (Fermat; proved by Euler). An odd prime $p$ is a sum of two squares exactly when $p \equiv 1 \pmod{4}$. More generally, a positive integer $n$ is a sum of two squares of integers exactly when every prime $q \equiv 3 \pmod{4}$ appears in the prime factorization of $n$ to an even power.

Por qué funciona

Why $3 \bmod 4$ primes fail. Squares are $0$ or $1 \bmod 4$, so a sum of two squares is $0$, $1$ or $2 \bmod 4$, never $3$.
Products of sums are sums. $(a^{2} + b^{2})(c^{2} + d^{2}) = (ac - bd)^{2} + (ad + bc)^{2}$, an identity you can check by expanding.
Primes $\equiv 1 \bmod 4$ succeed. Here $-1$ is a square mod $p$: some $x$ has $p \mid x^{2} + 1$, a sum of two squares divisible by $p$. A short argument (Thue's lemma, or Fermat's "descent") shrinks this to $p$ itself.
Why even powers. If $q \equiv 3 \pmod{4}$ divides $a^{2} + b^{2}$, then $q$ divides both $a$ and $b$ (otherwise $-1 \equiv (a b^{-1})^{2}$ would be a square mod $q$). So $q^{2}$ divides the sum, and dividing it out leaves a smaller sum of two squares.

Ejemplo resuelto: Primes

Write $13$ and $29$ as sums of two squares, and explain why $23$ cannot be one.
  1. $13 \equiv 1$ and $29 \equiv 1 \pmod{4}$. Search: $13 - 2^{2} = 9 = 3^{2}$, and $29 - 2^{2} = 25 = 5^{2}$.
  2. $23 \equiv 3 \pmod{4}$, and a sum of two squares is never $3 \bmod 4$.

Respuesta: $13 = 3^{2} + 2^{2}$, $29 = 5^{2} + 2^{2}$; $23$ is impossible.

Ejemplo resuelto: A prime 3 mod 4, squared

Is $45$ a sum of two squares?
  1. $45 = 3^{2} \cdot 5$: the prime $3 \equiv 3 \pmod{4}$ appears to an even power, so yes.
  2. Take $5 = 2^{2} + 1^{2}$ and multiply by $9 = 3^{2}$: $45 = 6^{2} + 3^{2}$.

Respuesta: Yes: $45 = 36 + 9$.

Ejemplo resuelto: Multiplying representations

Write $65 = 5 \cdot 13$ as a sum of two squares in two ways.
  1. $5 = 2^{2} + 1^{2}$ and $13 = 3^{2} + 2^{2}$.
  2. $(ac - bd)^{2} + (ad + bc)^{2}$ with $(a, b, c, d) = (2, 1, 3, 2)$: $(6 - 2)^{2} + (4 + 3)^{2} = 16 + 49$.
  3. Swapping the roles of $c$ and $d$ gives $(4 - 3)^{2} + (6 + 2)^{2} = 1 + 64$.

Respuesta: $65 = 4^{2} + 7^{2} = 1^{2} + 8^{2}$.

Error común

Ruling out every number with a prime factor that is $3 \bmod 4$. $45 = 3^{2} \cdot 5$ has the factor 3, yet $45 = 6^{2} + 3^{2}$: the 3 appears squared. Only an odd power of such a prime is fatal, as in $21 = 3 \cdot 7$ or $63 = 3^{2} \cdot 7$. Also remember that $0$ counts: $49 = 7^{2} + 0^{2}$.

Idea clave

$n$ is a sum of two squares exactly when each prime $\equiv 3 \pmod{4}$ divides $n$ to an even power. Primes $\equiv 1 \pmod{4}$ are sums of two squares, and products of sums are sums.

Práctica

Apruebas con 3 respuestas correctas, las 2 últimas seguidas. Cada respuesta correcta da 3 XP.

Cargando la práctica…

Se apoya en

Lleva a

Este es uno de los peldaños más altos de Teoría de Números.

Fuentes y lecturas

  • William Stein, Elementary Number Theory: Primes, Congruences, and Secrets (Springer, 2009; free online edition), chapter 5, Continued Fractions (sums of two squares)
  • MIT OpenCourseWare 18.781 Theory of Numbers (Spring 2012), lecture notes on sums of two squares