Skip to content
All apps

Zagier's Windmills: Primes as Sums of Two Squares

About this app

Why is every prime 4k + 1 a sum of two squares? Zagier’s one-sentence proof as windmills: flipping pairs them, only one stays alone, so their number is odd – and the remaining mirror windmill splits into p = x² + (2y)². With counterexamples 7, 11, 21 and 45.

With explain mode: an AI tutor walks you through the app, points out what matters in the scene and answers your questions.

Fermat’s two-square theorem proved in one sentence

Every prime that leaves remainder 1 when divided by 4 is a sum of two squares: 13 = 3² + 2², 41 = 5² + 4², 97 = 9² + 4². In 1990 Don Zagier published a proof consisting of a single sentence. He looks at all solutions of p = x² + 4yz in natural numbers and shows with two pairings that their number is odd. He never has to search for a solution.

What the app shows

Every solution becomes a windmill: a square with side x and four blades of size y × z, exactly p cells in total. On the right all windmills for p stand in a ring. Zagier’s flip rule reads the same outline with a different inner square and joins the pairs; only (1, 1, k) flips onto itself. Mirroring swaps y and z, the blades flip about their corner. The windmill left over has square blades that slide together into the square (2y)².

Try it yourself

Pick a prime from 5 to 97 and step through the proof in eight steps: windmill, all windmills, flip, fixed point, odd count, mirror, two squares. Tap a small windmill to see it large and flip it. Counterexamples show where the proof breaks: 7 and 11 have no windmill, 21 and 45 have several fixed points. An explain mode demonstrates the steps.

Frequently asked questions

Which primes are a sum of two squares?
The prime 2 (1² + 1²) and exactly the odd primes that leave remainder 1 when divided by 4, for example 5, 13, 17, 29, 37 and 41. Primes with remainder 3, such as 7, 11 or 19, are never a sum of two squares, because a sum of two squares never leaves remainder 3 when divided by 4.
How does Zagier’s one-sentence proof work?
Zagier looks at the finite set of all solutions of p = x² + 4yz. A pairing that leads back when applied twice has exactly one fixed point for a prime, (1, 1, k). So the number of solutions is odd. Then the second pairing, swapping y and z, also has a fixed point with y = z, and p = x² + (2y)².
What is an involution with a fixed point?
An involution is a map that returns to the start when applied twice. It splits a set into pairs and singles that are mapped onto themselves, the fixed points. If the number of fixed points is odd, the size of the set is odd as well, and vice versa.
What can I do in the app “Zagier’s Windmills”?
You pick a number, see all its windmills in a ring and transform the big windmill with “Flip” and “Mirror”. The proof leads in eight steps to the final picture p = a² + b². Under Counterexamples you check why the proof does not apply to 7, 11, 21 or 45.

Subject: From Erdős's BOOK

More from From Erdős's BOOK

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps