04 Proofs
04 Proofs
Lecture 4: Proofs
1. What is a Proof?
A proof plays the same role in mathematics, more or less, as source code does in
computer programming. A valid source code file is one that can be compiled or
interpreted and run by a computer, without syntax errors. Ideally it even does what it
is supposed to do, when you run it. But, source code exists to be written and read by
humans — computers themselves would be more than happy if programs were just
written in binary. Thus, among programs that compile and run correctly, the one that
is more human-readable is the better one. If we had to rank some student
submissions for a programming assignment:
1. One student submits a source code file that does not compile, due to syntax
errors. They would get a low mark, most likely a fail.
2. One student submits a program that compiles, but does not do the expected
thing when you run it. They might just about get a pass, possibly a 3rd class
mark.
3. One student submits a program that compiles, does the correct thing when you
run it, but the code is not elegant and hard to read. They might get a 2nd class
mark.
4. One student submits a program that not only compiles and does the correct
thing when you run it, but the code (and comments) are elegant and easy for the
marker to read. This student might get a first-class mark.
If two students both submit code that does not compile, but one submits more
elegant non-compiling code than the other, this does not matter quite as much: both
these students are at risk of failing. But once your code compiles and runs correctly,
the easier to read, the better. And so it is with mathematical proofs: you should aim
to make your proofs
1. Correct, because if your work is not correct, it does not count as a proof at all.
2. Without compromising on 1., as easy for a human to understand as possible.
To be pedantic, there is no such thing as a ‘correct proof’ and an ‘incorrect proof’: the
kind of thing that could or could not be a proof, depending on if it is correct or not, is
called an argument and a proof is simply an argument that is correct. So the following
two questions mean the same thing:
It does not make sense to ask ‘Is this a correct proof?’ because if an argument is not
correct, then it is not a proof.
So what is a proof?
Page 1 of 8
COMS10014 Lecture 4 2024–25
Unlike computer programs where it is usually clear what is or is not a syntax error
(either the compiler accepts your code, or not), the ‘compiler’ for a mathematical
argument is other mathematicians. One would hope that if you gave ten
mathematicians the same argument, they would all come up with the same answer as
to whether it is valid or not. But since mathematical arguments are not defined by a
formal grammar like programming languages, we say they are written in a
semi-formal language.
There are in fact fully formalised proof languages that can be checked by a computer,
such as Coq1 but these require more skill to use than ‘ordinary’ proofs and are
beyond the scope of this unit.
Since mathematical arguments are both written and read by humans, a certain
amount of common sense and imprecision often creeps in, and this is not a problem
as long as it does not get in the way of the correctness of an argument. Proofs written
by professional mathematicians will feature justifications like ‘it is obvious that’ or they
will prove one case and say ‘the other three follow similarly’, and this is not a problem
for the working mathematician as long as the other cases do actually follow! But
when you are learning to write proofs for the first time, you should avoid these terms
as far as possible, to avoid you claiming something is ‘obvious’ when it is in fact false.
Since proofs are written for humans to read, they will often contain text that is not
part of the formal argument itself, but still helps the reader: just like a report might
contain headings and subheadings, and a table of contents, a proof might contain a
line ‘We prove this claim by induction. The base case is . . . The induction step is . . . ’
You should always include structure like this in your own proofs.
• We know A is true, and we know that B would imply that A is false, therefore we
conclude that B is false too using ‘modus tollens’.
• A ∧ (B → ¬A) ⊨ ¬B ∵ (M.T.)
The difference between the two is a matter of style, and you can choose between
them and even vary between both in the same proof as long as the conclusions you
draw are correct (follow logically from previous steps) and justified. So please do not
think that to look good, a proof has to have lots of symbols and almost no English text.
We will look at a way one could model proofs as a data structure a bit later on in these
notes. These data structures could then be printed using English text or symbols,
depending on your preference, just like arithmetic terms can be printed using infix or
prefix or RPN.
Page 2 of 8
COMS10014 Lecture 4 2024–25
Before we can give examples of proofs, we need something to do proofs on. We will
look at arithmetic over the integers, and specifically the fact that all integers are either
odd or even. We define this a bit more formally.
Definition 1. An integer a is
Every integer matches exactly one of these two cases (we will prove this later on
based on more basic rules).
The wording ‘for some integer’ introduces a new variable. We can do this at any time in
a proof that we like, but every time we do this, we must pick a new variable that does
not exist in the proof yet (at least not in the current ‘scope’).
3. Rules of Arithmetic
To do proofs in arithmetic, we need a set of rules that we can use as steps in the
proof. Since there are infinitely many integers, we cannot check all possibilities with a
truth table, so we will have to do proofs with syntax rather than semantics. The rules
here are all sound, but not complete (there are true statements that we cannot prove
with these rules); this is not usually a problem in practice.
All the following rules apply for natural numbers, integers and real numbers unless
otherwise stated.
• Inverse elements: over the integers and reals but not the naturals, a + (−a) = 0
and, over the real numbers only, if a ̸= 0 then a × 1/a = 1. More precisely, for
any number a we can find another number b such that a + b = 0 (namely, set
b = (−a)) if we are working over the integers or reals, and if a ̸= 0 then we can
find a b such that ab = 1 if we are working over the reals.
From basic rules like these we can prove many others, such as that
(a + b) × (a + b) = a × a + 2 × a × b + b × b, which one obviously writes as
(a + b)2 = a2 + 2ab + b2 .
Page 3 of 8
COMS10014 Lecture 4 2024–25
In general, you can use any rule of arithmetic that you have learnt in school in a proof,
as long as it is correct for the numbers you are using. For example, if you are doing a
proof over the integers, then be careful of dividing: not only do you have to make
sure you do not divide by zero, but the result might not be an integer anymore, and
so might not be odd or even.
Suppose that we are trying to prove the claim ‘if a is an even integer and b is an odd
integer, then ab is even’.
At any time in a proof, you have a set of statements that you know are true. This
might be because they are part of what you are given at the start: in the example we
know that a is even. It might be because we have already proved them earlier. It
might also be because a statement is a generally known law of arithmetic or logic.
Many of the steps we take in a proof are applying rules to statements we know are
true, resulting in new statements that we now also know are true. If we manage to
add the statement we are trying to prove to the set of things we know are true, we are
done.
Other steps are ‘unpacking’ and ’packing’ defintions. For a mathematician, ‘even’ and
‘odd’ are definitions with precise formal meanings as we showed above. Our intuition
about how even and odd numbers work can guide us, but in a proof the only thing
you are allowed to do with the information ‘a is even’ is unpack the definition of ‘even’.
Generally a good proof strategy is to unpack the definitions you are given, calculate,
then pack the result back into the definition you need. For our example proof, this
means
5. Direct Proof
In a direct proof, you just go ahead and calculate. If you can do a direct proof of a
statement, it is normally the best option.
1. We know that a is even. Unpack this to get that there is an integer k such that
a = 2k.
2. We know that b is odd. Unpack this to get that there is an integer m such that
b = 2m + 1 (note, k is already taken, so we need a new variable).
3. Calculate: ab = (2k)(2m + 1) = 4km + 2k = 2(2km + k).
4. If we set c = 2km + k then we have ab = 2c where c is an integer.
5. Pack this to get: ab is even.
Page 4 of 8
COMS10014 Lecture 4 2024–25
It is fine to write out proofs as paragraphs rather than lists, so the following is just as
good a proof (or perhaps even better):
Since a is even, there is an integer k such that a = 2k, and since b is odd, there is an
integer m such that b = 2m + 1. Then ab = (2k)(2m + 1) = 2(2km + k). Therefore, ab is
even.
6. Indirect Proof
Both the above proofs were proofs of implications P → Q. In a direct proof, we start
by knowing P is true, we calculate, and we get to knowing Q is true.
Here we do not want to start with n2 as the main thing you can do with a squared
number is take the square root, but that might not be an integer. But if we start with n
and square it, that remains an integer.
Proof: Assume that n is even (not odd, we are proving the contrapositive so we have
to negate the statement we are after). Then n = 2k for some k. Then
n2 = (2k 2 ) = 2(2k 2 ) which is even again. So, if n is even then n2 is even, and by indirect
proof it follows that if n2 is not even then n is not even either — and ‘not even’ is the
same as ‘odd’.
7. Proof by Contradiction
If we know, for some statement S, that S → F is true, then S must itself be false, since
T → F would not be true but F → F is true.
So, if we want to prove that P is true, then we can try and prove that ¬P is false, which
is an equivalent statement. The way a proof by contradiction works is we assume ¬P ,
calculate, and if we reach a contradiction then ¬P must have been false all along.
√
Claim: 2 is irrational.
Proof: first, we unpack the claim. A rational number is a number q that can be written
as a fraction a/b where a, b are integers, and b ̸= 0. If these a, b have a common factor,
Page 5 of 8
COMS10014 Lecture 4 2024–25
then we can cancel it on both sides of the fraction, so every rational number can be
written as a fraction a/b where a, b have no factor (greater than 1) in common. An
irrational number is a number that is not a rational number.
√ √
Assume that 2 is a rational number, that is 2 = A/B with A, B integers and B ̸= 0.
Simplify this fraction by removing all common factors to get a/b.
Squaring both sides implies that 2 = a2 /b2 which we can rewrite as 2b2 = a2 since
b ̸= 0. Since 2b2 = a2 is an equation over the integers, this means that a2 must be even.
Plugging this back in, we get 2b2 = (2k)2 = 4k 2 and we can cancel a 2 on both sides to
get b2 = 2k 2 . This means that b2 must be even too, and therefore b must be even.
But this is impossible. We have shown that for any integers a, b with b ̸= 0 such that
(a/b)2 = 2, both a and b must be even. However, we know that every fraction a/b can
be simplified until a, b have no common factors, in particular they do not have a factor
2 in common. This is a contradiction. Therefore, the assumption that we can find
√
integers A, B with A/B = 2 in the first place must have been wrong.
Suppose that ab is odd, but a and b are both even. Then a = 2k and b = 2m for some
integers k, m. But then ab = 4km = 2(2km) is even too, which contradicts the
assumption that ab is odd. Therefore, if ab is odd, then a and b cannot both be even.
(In fact, if ab is odd, then neither a nor b can be even, but that is not what we were
trying to prove here.)
That was quite a mouthful! As a general rule, direct and indirect proofs are about
equally hard to read, but proofs by contradiction can take extra effort to understand.
So, it is good style not to do a proof by contradiction when you could equally well do a
√
direct or indirect proof. The first example ( 2 is irrational) would be much harder to
do without contradiction, so that is a good use of this technique, but the second
example could be done more simply as an indirect proof, with the same key
calculation that (2k)(2m) must be even again.
Page 6 of 8
COMS10014 Lecture 4 2024–25
8. Case Distinction
Often, in a proof, we want to say something about ‘all x’. If we can split all x into
several cases, such that every x fits in at least one (or exactly one) of the cases, then
we can do the proof in each case individually.
Therefore, whether n is odd or even (and there are no other cases), n(n + 1) is always
even.
In both cases (again every a fits at least one case — in fact exactly one), a and b are
both the same parity (both even, or both odd).
9. Euclid’s Theorem
Now, we prove that integers are either odd or even according to the earlier defintion,
from more basic principles.
Definition 2 (Euclid’s theorem). For two integers a, b with b > 0, there is exactly
one pair of integers q, r such that 0 ≤ r < b and
a=q×b+r
For example, if a = 17, b = 3 then a/b with remainder is ‘quotient 5 remainder 2’ since
17 = 5 × 3 + 2.
First, let us prove that integers are either odd or even as defined before. Assuming
this theorem holds (we will prove part of it today and the rest later), take b = 2. Then
for any integer a, there is an integer q and an integer r ∈ {0, 1} such that a = 2q + r,
that is either a = 2q or a = 2q + 1. The two cases are mutually exclusive, since if we
had both a = 2q and a = 2q ′ + 1 then (q, 0) and (q ′ , 1) would both be pairs satisfying
the theorem, but the theorem says there is exactly one such pair, which would be a
contradiction.
Page 7 of 8
COMS10014 Lecture 4 2024–25
The proof of Euclid’s theorem itself comes in two parts: first, for any integers a, b with
b > 0 we have at most one pair of numbers (q, r) satisfying the theorem, and secondly,
that we have at least one such pair. We will do the first part today and the second in a
later lecture, as we need a new technique for it.
A proof that at most one object X exists with some property is called a uniqueness
proof, and there are two main ways to do it: either start assuming that X, X ′ both
have the property and deduce that X = X ′ , or start assuming that X, X ′ are two
different objects with the property, and show that this leads to a contradiction. A
proof that at least one object exists with some property is called an existence proof,
and the best way to do such a proof (if you can) is to give some algorithm that creates
the object you need.
Claim. For any integers a, b with b > 0, there is at most one pair of integers (q, r) with
a = qb + r and r ≥ 0 and r < b.
Proof. Suppose we had two such pairs (q, r) and (q ′ , r′ ), which might or might not be
the same. Then we know all of
b(q − q ′ ) = r′ − r
If r′ − r < 0 then we do the same argument as above, but with the roles of r and r′ ,
and q and q ′ swapped.
To sum up, the equation b(q − q ′ ) = r′ − r as well as the other conditions from the
theorem always imply that q = q ′ and r = r′ . The proof technique is a case distinction
on whether r′ − r and q − q ′ are positive, negative or zero (which covers all possible
integers).
This proves the uniqueness part of the theorem, and so we know that no integer can
be both odd and even at the same time.
Page 8 of 8