Back to the on-screen lesson ·
A quadratic equation solved completely by a parametrisation, and another settled by a criterion whose two halves are nothing like each other in difficulty.
Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.
By the end of this lesson you will be able to generate Pythagorean triples from Euclid's parameters and recover the parameters from a primitive triple, say why the parametrisation is complete and what the parity condition is for, decide whether a prime is a sum of two squares from its residue modulo four, prove the negative half by a congruence, and extend the test to composite numbers through their factorisation.
Lesson 6 ended with an impossibility proof: $x^{2} \equiv 3 \pmod 4$ has no solution, because the squares modulo $4$ are only $0$ and $1$. Four cases, and infinitely many integers ruled out.
That argument is one half of this lesson. The other half needs something newer: lesson 18 showed that $-1$ is a square modulo $p$ exactly when $p \equiv 1 \pmod 4$, and that turns out to be exactly the condition for $p$ to be a sum of two squares. The congruence rules half the primes out; the square root of $-1$ puts the other half in.
A Pythagorean triple is a triple of positive integers with $a^{2} + b^{2} = c^{2}$. It is primitive when the three share no common factor — equivalently, when no two of them do.
A parametrisation writes every solution in terms of free parameters. Euclid's is complete: every primitive triple is $(m^{2}-n^{2},\, 2mn,\, m^{2}+n^{2})$ for exactly one admissible pair $m > n > 0$.
A representation of $n$ as a sum of two squares is a pair with $n = a^{2} + b^{2}$. Representations are usually counted up to order and sign, so $5 = 1 + 4$ counts once and not eight times.
Pythagorean triples. Every primitive triple with $b$ even is $$a = m^{2} - n^{2}, \qquad b = 2mn, \qquad c = m^{2} + n^{2}$$ for a unique pair $m > n > 0$ with $\gcd(m, n) = 1$ and $m \not\equiv n \pmod 2$.
That these are triples is an identity. That they are all of them takes an argument: in a primitive triple $a$ and $b$ have opposite parity, so with $b$ even, $c - a$ and $c + a$ are both even and coprime after halving; their product is $(b/2)^{2}$, so each is a square, and setting $c + a = 2m^{2}$, $c - a = 2n^{2}$ recovers the parametrisation.
So a quadratic Diophantine equation in three unknowns is solved completely, which is rare. The parametrisation is exhaustive, and every non-primitive triple is a whole multiple of a primitive one.
Sums of two squares. An odd prime $p$ is a sum of two squares if and only if $p \equiv 1 \pmod 4$.
The two halves are of quite different difficulty.
The easy half. Every square is $0$ or $1$ modulo $4$, so a sum of two squares is $0$, $1$ or $2$ modulo $4$ — never $3$. Four cases, and every prime congruent to $3$ is ruled out.
The hard half. For $p \equiv 1 \pmod 4$, lesson 18 gives an $x$ with $x^{2} \equiv -1 \pmod p$. Then a pigeonhole argument on the pairs $(u, v)$ with $u \equiv xv$ produces a representation. Nothing about this is a congruence; it is an existence argument.
Composites. $n$ is a sum of two squares exactly when every prime congruent to $3$ modulo $4$ occurs in $n$ to an even power. The reason is the identity $$(a^{2}+b^{2})(c^{2}+d^{2}) = (ac - bd)^{2} + (ad + bc)^{2},$$ which makes sums of two squares closed under multiplication — the same identity that multiplies complex numbers of the form $a + bi$.
Another way: steps
Another way: example
$m = 5$, $n = 2$: coprime, opposite parity, so $a = 21$, $b = 20$, $c = 29$, and $441 + 400 = 841 = 29^{2}$. And $29 \equiv 1 \pmod 4$, so it is a sum of two squares: $29 = 4 + 25$. That is not a coincidence — a primitive hypotenuse is $m^{2} + n^{2}$ by construction, so it is always a sum of two squares.
The two halves of the two-square theorem are worth comparing, because the asymmetry between them is typical of the subject and the easy half is a technique worth reaching for by reflex.
To rule out, find a modulus in which the equation is impossible. Every square is $0$ or $1$ modulo $4$, so $a^{2} + b^{2}$ is $0$, $1$ or $2$; a prime congruent to $3$ is none of them, and infinitely many numbers are excluded by a table with four rows. The work is finite, mechanical, and complete.
To put in, a representation has to be produced or proved to exist, and no finite check does that. Fermat's theorem needs the square root of $-1$ modulo $p$, which exists exactly when $p \equiv 1 \pmod 4$, and then a pigeonhole argument over about $\sqrt p$ candidates. The two halves meet at the first supplement: the same congruence that lets the congruence argument fail is the one that makes $-1$ a square.
This asymmetry appears everywhere in Diophantine questions. The Hasse principle is the general hope: an equation has an integer solution if and only if it has one modulo every prime power and over the reals. Congruence obstructions are the easy direction; the principle asserts they are the only obstructions.
For quadratic forms in several variables the principle is a theorem (Hasse–Minkowski), and it is why the two-square and four-square theorems have clean congruence-shaped answers. For higher degrees it is false — $3x^{3} + 4y^{3} + 5z^{3} = 0$ is solvable modulo everything and has no rational solution — and when it fails, no amount of checking congruences settles anything.
So: always try a congruence first, because it is cheap and it may end the question. Never conclude from its silence that a solution exists.
Thinking Euclid's formula misses triples. It produces every primitive triple exactly once. $(9, 12, 15)$ is not missing — it is $3$ times $(3, 4, 5)$, and non-primitive triples are multiples by definition.
Dropping the parity condition. $m$ and $n$ must have opposite parity. Both odd makes all three sides even, so the triple is not primitive and the same triple appears twice in the list.
Reading the congruence argument as settling both halves. It rules out the primes congruent to $3$ and says nothing whatever about the others. A failed obstruction is not a construction.
Applying the prime criterion to composites. $21 = 3 \cdot 7$ is $1$ modulo $4$ and is not a sum of two squares. For composites the test is on the factorisation: every prime congruent to $3$ must occur to an even power.
Forgetting $2$. $2 = 1 + 1$ is a sum of two squares and is neither $1$ nor $3$ modulo $4$. Every statement about odd primes is stated that way for a reason.
Is $(20, 21, 29)$ primitive? The three share no factor, so yes.
Primitivity first; otherwise divide out.
The even leg is $20 = 2mn$, so $mn = 10$. And $c + a = 29 + 21 = 50 = 2m^{2}$, so $m = 5$; then $n = 2$.
Solve for the parameters rather than searching.
Check: $\gcd(5, 2) = 1$ and they have opposite parity, and $m^{2} - n^{2} = 21$. The parameters are unique, so no other pair gives this triple.
Uniqueness is part of the theorem.
$45 = 3^{2} \cdot 5$. The prime $3$ is $3$ modulo $4$ and occurs to the even power $2$, and $5$ is $1$ modulo $4$. So $45$ should be a sum of two squares.
The test is on the factorisation, not on the number modulo four.
And it is: $45 = 36 + 9 = 6^{2} + 3^{2}$.
Found by subtracting squares in turn.
$21 = 3 \cdot 7$: both primes are $3$ modulo $4$ and both occur to the odd power $1$, so $21$ is not a sum of two squares — even though $21 \equiv 1 \pmod 4$, which shows the naive test failing.
The congruence test is necessary and not sufficient.
Both legs cannot be even: the triple would then not be primitive.
Rule out the easy case first.
Both legs cannot be odd: then $a^{2} + b^{2} \equiv 1 + 1 = 2 \pmod 4$, and no square is $2$ modulo $4$.
The same four-case table as the two-square proof.
So exactly one is even — which is why Euclid's formula puts $2mn$ on one leg and can always be arranged with $b$ even.
Each pair of parameters generates a right-angled triangle with whole-number sides. Match each pair to its hypotenuse.
| $113$ | $25$ | $53$ | |
|---|---|---|---|
| $m = 8$, $n = 7$ | |||
| $m = 4$, $n = 3$ | |||
| $m = 7$, $n = 2$ |
Euclid's formula with $m = 9$ and $n = 8$ gives a Pythagorean triple. What is its hypotenuse?
Answer:
Is the prime $103$ a sum of two positive squares?
With $m = 7$ and $n = 4$, give the three sides of the Pythagorean triple Euclid's formula produces.
| Value | |
|---|---|
| $m^{2} - n^{2}$ | |
| $2mn$ | |
| $m^{2} + n^{2}$ |
Write $65$ as a sum of two positive squares. Give the two numbers being squared, smaller first.
smaller number a, larger number c
Build the proof that a prime congruent to $3$ modulo $4$ is not a sum of two squares.
This task has no paper form; do it on a device.
Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.
Each pair of parameters generates a right-angled triangle with whole-number sides. Match each pair to its hypotenuse.
| $25$ | $17$ | $97$ | |
|---|---|---|---|
| $m = 4$, $n = 3$ | |||
| $m = 4$, $n = 1$ | |||
| $m = 9$, $n = 4$ |
You can generate and recognise Pythagorean triples, and decide whether a number is a sum of two squares. Say in your own words why ruling a number out is so much easier than finding a representation. Next: approximating a number by fractions, and the equation that comes out of it.
9. Your turn: show that in a primitive Pythagorean triple, exactly one leg is even, step 3