Table of Contents
A proof is an argument that shows a statement is true in every case, not just the ones you happened to check. It is the heart of mathematics, the main skill tested in maths olympiads, and a big step for anyone moving from school maths to university maths. It also feels strange at first, because most school maths asks you to calculate an answer, not to explain why something must always be true.
This guide explains what a proof is, why checking examples is never enough, and the four methods that cover most beginner proofs: direct proof, proof by contradiction, proof by induction and counterexamples. Each comes with a worked example, and a few short Python programs show where checking stops and proving has to take over.
Why checking examples is not a proof
Here is a formula studied by Leonhard Euler in the 18th century: n² + n + 41. Try n = 0 and you get 41, a prime. n = 1 gives 43, also prime. n = 2 gives 47. It looks as if this formula always makes primes. Let a computer check:
def is_prime(n):
if n < 2:
return False
d = 2
while d * d <= n:
if n % d == 0:
return False
d += 1
return True
streak = 0
for n in range(100):
value = n * n + n + 41
if not is_prime(value):
print(f"n = {n}: {value} is NOT prime ({value} = 41 x {value // 41})")
break
streak += 1
print(f"prime for every n from 0 to {streak - 1}: {streak} cases in a row")
n = 40: 1681 is NOT prime (1681 = 41 x 41)
prime for every n from 0 to 39: 40 cases in a row
It gives a prime 40 times in a row, then fails at n = 40: 1681 is 41 × 41. And you can see why without a computer: when n = 40, n² + n + 41 = 40 × 41 + 41 = 41 × 41. Forty examples felt like overwhelming evidence, and they proved nothing. That is exactly why mathematicians insist on proof.
The four main methods
1. Direct proof
Start from what you know and reason, one justified step at a time, to what you want to show. The trick is usually to write the objects in a useful form. Every odd number can be written as 2m + 1 for some whole number m, so:
- Claim: the sum of two odd numbers is even.
- Proof: let the odd numbers be 2m + 1 and 2n + 1, where m and n are whole numbers. Their sum is 2m + 2n + 2 = 2(m + n + 1). That is 2 times a whole number, so it is even.
Notice that this covers every pair of odd numbers at once, because m and n can be anything. The same style shows that the square of an odd number is odd: (2k + 1)² = 4k² + 4k + 1 = 2(2k² + 2k) + 1, which is 2 times a whole number plus 1. We will need that fact in a moment.
2. Proof by contradiction
Assume the statement you want to prove is false, then show that this assumption leads to something impossible. If the assumption breaks mathematics, it must be wrong, so the statement is true. The classic example, known since ancient Greece, shows that the square root of 2 cannot be written as a fraction:
- Suppose √2 = a / b, where a and b are whole numbers and the fraction is in lowest terms, so a and b have no common factor.
- Squaring both sides gives 2 = a² / b², so a² = 2b². That means a² is even.
- If a were odd, a² would be odd, as we just proved. So a must be even. Write a = 2k.
- Then (2k)² = 2b², so 4k² = 2b², so b² = 2k². So b² is even, and by the same argument, b is even.
- Now a and b are both even, so they share the factor 2. But we said the fraction was in lowest terms. Contradiction. So √2 is not a fraction.
Another famous contradiction proof is Euclid's argument that the primes never run out, which our prime numbers guide walks through.
3. Proof by induction
Induction proves a statement for every whole number n. You prove two things: the base case, that it is true for n = 1, and the inductive step, that whenever it is true for some number k, it is also true for k + 1. Together, these knock over every case, like dominoes.
Claim: 1 + 2 + 3 + ... + n = n(n + 1) / 2 for every whole number n of at least 1. A computer can check lots of cases:
# Check the formula 1 + 2 + ... + n = n(n + 1) / 2 for the first 10,000 values of n
total = 0
for n in range(1, 10_001):
total += n
assert total == n * (n + 1) // 2, n
print("formula matches for n = 1 to 10,000")
print("but that is 10,000 cases, not all of them. Induction covers the rest.")
formula matches for n = 1 to 10,000
but that is 10,000 cases, not all of them. Induction covers the rest.
Ten thousand cases is encouraging, but after the Euler example we know that is not enough. Here is the proof:
- Base case: for n = 1, the left side is 1 and the right side is 1 × 2 / 2 = 1. True.
- Inductive step: assume 1 + 2 + ... + k = k(k + 1) / 2. Add k + 1 to both sides: 1 + 2 + ... + k + (k + 1) = k(k + 1) / 2 + (k + 1) = (k + 1)(k / 2 + 1) = (k + 1)(k + 2) / 2. That is exactly the formula with n = k + 1.
- Conclusion: the formula holds for n = 1, and each case gives the next, so it holds for every n.
4. Disproof by counterexample
To show that an "always" statement is false, you need only one case where it fails. Consider the claim: "if p is prime, then 2p − 1 is prime." Numbers of this form are named after Marin Mersenne, a 17th-century French scholar. It works for the first few primes:
# Claim to test: "if p is prime, then 2^p - 1 is prime"
def smallest_factor(m):
d = 2
while d * d <= m:
if m % d == 0:
return d
d += 1
return None # no factor found, so m is prime
for p in [2, 3, 5, 7, 11, 13]:
m = 2 ** p - 1
f = smallest_factor(m)
if f is None:
print(f"p = {p:>2}: 2^p - 1 = {m} is prime")
else:
print(f"p = {p:>2}: 2^p - 1 = {m} = {f} x {m // f}, NOT prime")
p = 2: 2^p - 1 = 3 is prime
p = 3: 2^p - 1 = 7 is prime
p = 5: 2^p - 1 = 31 is prime
p = 7: 2^p - 1 = 127 is prime
p = 11: 2^p - 1 = 2047 = 23 x 89, NOT prime
p = 13: 2^p - 1 = 8191 is prime
p = 11 gives 2047 = 23 × 89. That single counterexample disproves the claim for good, even though p = 13 works again. Computers are excellent at hunting for counterexamples, which is one reason coding and proof make good partners.
How to write a proof up
- State exactly what you are proving. Write the claim in full, including what kind of numbers it is about.
- Say what you assume. "Let n be an odd number", "Suppose, for contradiction, that...".
- Give a reason for every step. Each line should follow from earlier lines, known facts, or the assumptions. If you write "clearly", check that it really is clear.
- Use words, not just symbols. "So", "therefore", "because" and "which means" carry the logic. A proof is a piece of writing.
- End by saying what you have shown, and, for contradiction or induction, why the method finishes the job.
The most common beginner mistakes
Checking examples and calling it a proof. Assuming the thing you are trying to prove. Proving the converse by accident (showing "if B then A" when asked for "if A then B"). In induction, forgetting the base case, or proving the step only for one particular k.
| When the claim says... | Try first |
|---|---|
| for all odd or even numbers | Direct proof, writing numbers as 2k or 2k + 1 |
| something is impossible, or is not a fraction | Contradiction |
| for every whole number n, with a formula in n | Induction |
| is always true, and you suspect it is not | Search for a counterexample, by hand or with code |
| some box must contain two objects | The pigeonhole principle |
How to get better at proofs
Proof writing improves with practice and feedback, like any writing. Start with short claims about odd and even numbers, divisibility and sums, then move on. Try each proof yourself before reading one, and after reading a proof, close the book and rewrite it from memory. Our post on why you can understand solutions but not solve problems explains why that last step matters so much. Remainders turn up in many proofs, so modular arithmetic is a good next topic.
A calculation tells you what is true. A proof tells you why it could not be otherwise.
How we teach it
Proof is where two principles on our how we teach page matter most: students derive the rule themselves before they ever see it written down, and students explain their thinking. A proof is exactly that, a rule you have reasoned out and can explain. Our maths olympiad classes run one to one or in small groups of 5 to 10.
Frequently asked questions
A proof is a logical argument that shows a statement is true in every case it covers. Each step follows from definitions, known facts or earlier steps, so no example, however many you check, can replace it.
For beginners, the four main methods are direct proof, proof by contradiction, proof by induction and disproof by counterexample. Other methods, such as the pigeonhole principle and proof by cases, build on these.
Because a pattern can hold for many cases and then fail. The formula n squared plus n plus 41 gives a prime for every n from 0 to 39, then gives 1681, which is 41 times 41, at n = 40.
Write down exactly what you are proving and what you are allowed to assume. Then rewrite the objects in a useful form, for example an odd number as 2k + 1, and look for a chain of steps from the assumptions to the claim.
You show a statement is true for the first case, then show that whenever it is true for one case, it must also be true for the next. Like dominoes, the first falls and each knocks over the next, so all of them fall.
You assume the statement is false and show that this assumption leads to something impossible. Since the assumption cannot be right, the statement must be true. The proof that the square root of 2 is not a fraction is a classic example.
Simple proofs about odd and even numbers suit many students from around 11 or 12, especially those preparing for maths olympiads. Formal proof writing is usually developed further in later secondary school and at university.