Step 0 · Extra station
Six proofs worth knowing
Before you meet Lean, see what a proof feels like. These six are famous for a reason: each one is short, each one is convincing, and each one shows a different trick that mathematicians use again and again.
You only need school algebra. Read slowly, look at the pictures, and try the small question at the end of each proof.
What to look for in every proof
- A clear claim. Exactly what is being said, and about which things.
- Starting facts. Definitions, axioms or theorems we already accept.
- Small steps, each with a reason. No step is “obvious, trust me”.
- Every case is covered. Not just the examples we happened to try.
A triangle’s angles add to 180°
Claim. In every triangle, the three angles add up to 180°.
You could measure a thousand triangles with a protractor. You would get “about 180°” every time, but measuring is never exact, and you cannot measure every triangle. A proof settles it for all of them at once.
Starting facts. (a) Angles that sit side by side along a straight line add up to 180°. (b) When a line crosses two parallel lines, it makes equal angles on opposite sides, the “Z-angles”. Fact (b) comes from Euclid’s parallel postulate, one of his axioms.
▶ Watch it step by step
Swipe sideways to see the whole picture.
- A full turn is 360°. Why 360? The Babylonians counted in sixties, and a popular explanation is that a year has roughly 360 days. 360 is also handy: it divides evenly by 2, 3, 4, 5, 6, 8, 9, 10, 12 and many more.
- A straight line is half a turn: 180°. Stand on the line facing right and turn until you face left. You have turned exactly halfway round.
- Angles side by side on a straight line add to 180°. Split the half turn with a ray, and the two parts still make the whole half turn: here 50° + 130° = 180°.
- Two parallel lines. They point in exactly the same direction, so they never meet. The little arrows mark them as parallel.
- A third line crosses both. At the top crossing, call the angle above the line on the right a.
- Slide the top crossing down the third line. The two lines point the same way, so it lands exactly on the bottom crossing, and angle a fits perfectly. These “corresponding angles” are equal. This is the step that relies on Euclid’s parallel postulate.
- Spin a half a turn around the top crossing. It lands on the opposite angle. They are equal because a + b = 180° (along the top line) and b + the opposite angle = 180° (along the third line).
- So the two angles inside the Z are equal. Both are a. These are called alternate angles, or “Z-angles”. This is the one fact the triangle proof needs.
- Now take any triangle. Call its angles α at A, β at B and γ at C. We want to show α + β + γ = 180°.
- Draw a line through C, parallel to AB. Now we have two parallel lines again.
- Side CA crosses both parallel lines, making a Z. So the Z-angle at C equals α. Watch α turn and land at C.
- Side CB crosses them too, making a backwards Z. So the angle on the other side of C equals β.
- At C, the angles α, γ and β fill a straight line, so α + γ + β = 180°. We never used the triangle’s size or shape, so this is true for every triangle. ∎
Swipe sideways to see the whole picture.
- Take any triangle ABC. Call its angles α at A, β at B and γ at C.
- Draw a line through C, parallel to the side AB.
- The side CA crosses both parallel lines, so the angle between CA and the new line equals α (fact b).
- In the same way, side CB makes an angle equal to β on the other side.
- At C, the angles α, γ and β fill the straight line, so α + γ + β = 180° (fact a). ∎
Why it covers every case: we never used a particular size or shape. The same steps work for a tiny triangle, a huge one, a thin one or a wide one.
Try it: what is each angle of an equilateral triangle?
Its three angles are equal and add to 180°, so each one is 180° ÷ 3 = 60°. Notice that you just used the theorem as a fact in a new proof.
Pythagoras’ theorem
Claim. In a right triangle with short sides a and b and longest side c, we have a² + b² = c².
Babylonian scribes were already listing right triangles like this around 1800 BCE. Euclid’s Elements, written about 300 BCE, contains a proof, and hundreds of different proofs are known today. Here is one you can see.
▶ Watch it step by step
Swipe sideways to see the whole picture.
- A right triangle. Its two shorter sides are a and b, and the longest side (opposite the right angle) is c. The claim: a² + b² = c².
- Read a² as an area. a² is the area of a square with side a. So the claim says: the two small squares together have exactly the same area as the big square on c.
- Build one big square with side a + b. Put four copies of the triangle, numbered 1 to 4, in its corners. Along each edge, one triangle gives a and its neighbour gives b. The tilted hole in the middle has four sides of length c.
- Is the hole really a square? Look at its top corner. Call the triangle’s two small angles α and β. Here β, the hole’s angle and α sit side by side along the straight top edge, so together they make 180°.
- Yes, its corners are right angles. By Proof 1 the triangle’s angles add to 180°, and one of them is 90°, so α + β = 90°. That leaves 180° − 90° = 90° for the hole. The same happens at all four corners, so the hole is a square with area c².
- Count the area once. The big square is made of four triangles plus the hole: big square = 4 triangles + c².
- Now slide the triangles. No turning, only sliding: 1 moves down, 3 moves left, 4 moves up and right, 2 stays put. They pair up into two rectangles: 1 with 3, and 2 with 4.
- Count the area again. The holes are now a square of side a and a square of side b. So big square = 4 triangles + a² + b².
- Compare the two counts. Same big square, same four triangles, so what is left over must be equal: c² = a² + b². We never used particular lengths, so this holds for every right triangle. ∎
- Check it with algebra. The big square’s area is (a + b)² = a² + 2ab + b². Counted as pieces it is 4 × ½ab + c² = 2ab + c². Take 2ab from both sides and you get a² + b² = c² again.
Swipe sideways to see both squares.
- Make four copies of the right triangle.
- Put them in the corners of a big square with side a + b, as on the left. The hole in the middle has four sides of length c.
- The hole is really a square: at each of its corners, the hole’s angle and the triangle’s two small angles fill a straight line. Those two small angles add to 90° (by Proof 1, since the third angle is 90°), so the hole’s angle is 180° − 90° = 90°. Its area is c².
- Now slide the same four triangles into two rectangles, as on the right. The holes are a square of side a and a square of side b, with area a² + b².
- Both big squares are the same, and we took away the same four triangles. So what is left has the same area: c² = a² + b². ∎
The same thing with algebra: the big square’s area is (a + b)² = a² + 2ab + b². It is also four triangles plus the hole: 4 × ½ab + c² = 2ab + c². Set them equal and take 2ab from both sides: a² + b² = c². Expanding (a + b)² is exactly what Lean’s ring does in Step 26.
Try it: a right triangle has short sides 6 and 8. How long is the longest side?
6² + 8² = 36 + 64 = 100, and 100 = 10², so the longest side is 10.
The pigeonhole principle
Principle. If you put more things into boxes than there are boxes, some box gets at least two things.
It sounds too simple to be useful. The skill is in choosing the boxes.
▶ Watch it step by step
Swipe sideways to see the whole picture.
- Twelve boxes, one for each month. The claim: in any group of 13 people, two of them were born in the same month. Put each person in the box for their birth month.
- The best we can do is spread them out. Twelve people can all have different birth months, one per box. But now every box is taken.
- So the 13th person has to share a box (here, April). Obvious? Yes, on purpose. This warm-up shows the rule in a case you can check at a glance. The skill, as the puzzle coming up shows, is choosing what the boxes are.
- As a proof, it is one line. At most one person per box would mean at most 12 people. We have 13, so some box holds two. ∎ This is the pigeonhole principle: more things than boxes means some box gets at least two.
- Now a real puzzle. Here are the numbers 1 to 10. The claim: pick any 6 different ones, and two of them will add up to 11. Can you dodge it?
- The clever part is choosing the boxes. Pair up the numbers that add to 11: {1, 10}, {2, 9}, {3, 8}, {4, 7} and {5, 6}. Every number from 1 to 10 sits in exactly one box.
- Pick numbers one at a time. Try 1, 9, 3, 4 and 6. Each lands in a different box, so no two of them add to 11 yet. But now all five boxes hold a pick.
- The sixth pick has nowhere new to go. Six numbers, five boxes: some box gets two. Here 8 lands in the box that already holds 3, and 3 + 8 = 11. Whichever six you pick, the same thing happens. ∎
- Notice: we never said which two numbers. The proof shows the pair exists without finding it. And six really is needed: 1, 2, 3, 4, 5 sit in five different boxes and no two add to 11. That is a counterexample for five picks.
Swipe sideways to see all the boxes.
Warm-up: any 13 people include two with the same birth month
- Make 12 boxes, one for each month, and put each person in the box for their birth month.
- If every box held at most one person, there would be at most 12 people.
- There are 13, so some box holds at least two: two people share a month. ∎
The real trick: pick any 6 different numbers from 1 to 10. Two of them add up to 11.
- Make five boxes: {1, 10}, {2, 9}, {3, 8}, {4, 7} and {5, 6}. The two numbers in each box add to 11.
- Every number from 1 to 10 belongs to exactly one box.
- Six numbers, five boxes: some box receives two of your numbers.
- Those two numbers add to 11. ∎
Notice: the proof does not tell you which two numbers. It proves that they exist without finding them. Mathematicians call this an existence proof.
Try it: is it still true if you pick only 5 numbers?
No. Pick 1, 2, 3, 4, 5: no two of them add to 11. That is a counterexample. With five numbers, each one can sit in its own box, so the argument has nothing to push against.
The broken chessboard
Claim. Cut two opposite corner squares off a chessboard. The 62 squares left cannot be covered by 31 dominoes, where each domino covers two squares side by side.
Trying every way to place 31 dominoes would take far too long, and failing a million times proves nothing. One clever idea settles it in four lines.
▶ Watch it step by step
Swipe sideways to see the whole picture.
- A chessboard has 8 × 8 = 64 squares: 32 dark and 32 light. A domino is a tile that covers exactly two squares side by side.
- A full board is easy to cover. Four dominoes fill each row, so 32 dominoes cover all 64 squares with nothing left over.
- Now cut off two opposite corners. That leaves 62 squares. The claim: you can never cover them with 31 dominoes, however you arrange them.
- Try it. Lay dominoes down row by row. After 30 dominoes we are stuck: two squares are left, and they are not side by side, so no domino fits. Failing a few times proves nothing, though. Maybe a cleverer arrangement exists?
- Clear the board and count colors instead. Opposite corners always have the same color, so we removed two dark squares. That leaves 32 − 2 = 30 dark squares and 32 light ones.
- Key fact: a domino always covers one dark and one light square. Squares side by side always have different colors, because the colors alternate along every row and every column.
- Turn it upright and move it: still one dark and one light. Going down a column the colors alternate too.
- Wherever it goes, it is the same: 1 dark + 1 light. There is no place on the board where a domino covers two squares of the same color.
- So 31 dominoes would cover exactly 31 dark and 31 light squares, one of each color per domino.
- But only 30 dark squares are left, so it is impossible. ∎ No arrangement can ever work, and we never had to try them all. The idea is called an invariant: something that never changes, whatever you do.
Swipe sideways to see the count.
- Color the board in the usual chessboard pattern. Opposite corners always have the same color, so we removed two dark squares. That leaves 30 dark and 32 light.
- Two squares side by side always have different colors, so every domino covers one dark and one light square.
- So 31 dominoes would cover exactly 31 dark and 31 light squares.
- There are only 30 dark squares. No covering is possible. ∎
The trick: find something that never changes, whatever you do. Here, “each domino covers one of each color” is that unchanging fact, called an invariant.
Try it: what if you remove one dark and one light square instead?
Then 31 dark and 31 light squares are left, so the color argument no longer rules it out. In fact a covering always exists then, a result proved by Ralph Gomory. The same argument can prove “impossible” in one case and say nothing in another, so read every step.
√2 is not a fraction
Claim. There are no whole numbers p and q with √2 = p / q.
The diagonal of a 1 × 1 square has length √2. A calculator shows 1.41421356…, and the digits never settle into a repeating pattern, but a screen can only show finitely many digits. Legend says this discovery upset the followers of Pythagoras, who believed that every length was a ratio of whole numbers.
The idea of a proof by contradiction: suppose the opposite is true, then follow the steps until something impossible happens. If a supposition leads to nonsense, it must be false.
▶ Watch it step by step
Swipe sideways to see the whole picture.
- Draw a 1 × 1 square and its diagonal. How long is the diagonal? Call its length d.
- Pythagoras (Proof 2 on this page) answers it. The diagonal cuts the square into two right triangles with legs 1 and 1, so 1² + 1² = d². That gives d² = 2, so d = √2.
- A calculator says √2 = 1.41421356… The digits never settle into a repeating pattern, but no screen can show all of them, so looking can’t settle the question. Could √2 still be a fraction p / q of whole numbers?
- Suppose it is: √2 = p / q, in lowest terms. Here “lowest terms” means p and q are not both even. That costs nothing: any fraction can be halved top and bottom until they are not both even, like 12/8 = 6/4 = 3/2.
- Square both sides. That gives 2 = p² / q², and multiplying both sides by q² gives p² = 2q². So p² is 2 times a whole number: p² is even.
- Even squares come from even numbers. In the table, only the even values of n give an even n². The reason: odd × odd is odd, so if p were odd, p² would be odd too. So p is even, and we can write p = 2k for some whole number k.
- Put p = 2k into p² = 2q². We get (2k)² = 2q², so 4k² = 2q². Halve both sides: q² = 2k². So q² is even, and for the same reason as before, q is even too.
- Clash! We have shown that p and q are both even. But we supposed they are not both even. Both can’t be true.
- So the supposition was false: √2 is not a fraction. ∎ This method is called proof by contradiction: suppose the opposite, follow it until something impossible happens, and conclude that the opposite was wrong.
Swipe sideways to follow the chain.
- Suppose √2 = p / q. We may take the fraction in lowest terms, so p and q are not both even. (Any fraction can be simplified until that is true.)
- Square both sides: 2 = p² / q², so p² = 2q². That means p² is even.
- If p were odd, p² would be odd too. (An odd number times an odd number is odd. You prove a version of this in Lean in Step 37.) So p is even: p = 2k for some whole number k.
- Put that in: (2k)² = 2q², so 4k² = 2q², so q² = 2k². Now q² is even.
- By the same reason as step 3, q is even.
- So p and q are both even. That contradicts step 1. The supposition was false: √2 is not a fraction. ∎
In Lean: this style of proof gets its own step on the trail. See Step 17: Proof by contradiction.
Try it: where exactly did we use “lowest terms”?
Only at the very end. Reaching “p and q are both even” is only a clash because we promised in step 1 that they are not both even. Without that promise there would be no contradiction.
The primes never run out
Claim. There is no largest prime number. The primes go on forever.
A prime is a whole number bigger than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13… This proof is in Euclid’s Elements, more than 2,300 years old, and it is still the one taught today.
Starting fact. Every whole number bigger than 1 has at least one prime factor. (Keep dividing it by a smaller factor until you cannot any more.)
▶ Watch it step by step
Swipe sideways to see the whole picture.
- Primes are the building blocks of whole numbers. A prime is a whole number bigger than 1 whose only divisors are 1 and itself. Here are the primes up to 30. They get rarer as the numbers grow. Do they ever stop?
- Suppose they do stop. Then we could write down the complete list of primes. To keep the picture small, pretend the whole list is just 2, 3 and 5, and there are no others.
- Build a new number: multiply all the primes on the list, then add 1. N = 2 × 3 × 5 + 1 = 31. Picture it as 30 dots in 5 rows of 6, plus 1 extra dot set apart.
- Divide 31 by 2. The 30 dots pair up exactly: 15 pairs. The extra dot has no partner, so the remainder is 1.
- Divide 31 by 3. The 30 dots make 10 groups of 3. Again the extra dot is left over: remainder 1.
- Divide 31 by 5. The 30 dots make 6 groups of 5, and once more the extra dot is left over. This is no luck: 30 = 2 × 3 × 5 splits exactly into 2s, 3s or 5s, so the remainder is always that single extra dot.
- So none of 2, 3, 5 divides 31. But every whole number bigger than 1 has a prime factor. The prime factor of 31 is 31 itself, and it is not on the list. Clash! The “complete” list was not complete.
- Careful: N does not have to be prime. Try the list 2, 3, 5, 7, 11, 13. Then N = 30030 + 1 = 30031 = 59 × 509, which is not prime. But 59 and 509 are primes missing from the list, and that is all the proof needs.
- The same steps work for any finite list. Multiply the primes and add 1. Dividing N by any of them leaves remainder 1, so N has a prime factor that is not on the list. No list of primes is ever complete: the primes never run out. ∎
Swipe sideways to follow the steps.
- Suppose there are only finitely many primes, and write them all in a list: p₁, p₂, …, pₙ.
- Build a new number: N = p₁ × p₂ × … × pₙ + 1.
- Divide N by any prime on the list. The product part divides exactly, so the remainder is always 1. No prime on the list divides N.
- But N is bigger than 1, so it has a prime factor. That prime is not on the list.
- So the list did not contain every prime, which contradicts step 1. The primes never run out. ∎
A common slip: the proof does not say N is prime. Try the list 2, 3, 5, 7, 11, 13: N = 30031 = 59 × 509. N is not prime, but its prime factors 59 and 509 are new, which is all the proof needs. In Lean, you use this theorem from Mathlib in Step 39.
Try it: with the list 2, 3, find N and its prime factor.
N = 2 × 3 + 1 = 7. Dividing 7 by 2 or by 3 leaves remainder 1, and 7 itself is a prime that was not on the list.
Five tricks to keep
| Trick | When to reach for it | Seen in |
|---|---|---|
| Direct proof | Chain facts you know until you reach the claim. | Proof 1 |
| Count it two ways | Work out the same area or total in two ways, then set them equal. | Proof 2 |
| Pigeonhole | More things than boxes? Choose the boxes cleverly. | Proof 3 |
| Invariant | Find something that never changes, then show the goal would change it. | Proof 4 |
| Contradiction | Suppose the opposite and follow it until something impossible happens. | Proofs 5 and 6 |
Here is the catch: every one of these proofs is written for humans. A reader has to check each step, and in long proofs readers miss gaps. Lean checks every step for you. Next, see how in the Base Camp Gym.