Module 7: Proof Techniques
(part 1)
1
Admin
• Midterm 1 has been graded. It is available
through ”handback” on the course website. Read
Piazza post on this.
• Assignment #3 will be released by the end of
Monday and will be due the Thursday after
reading week.
2
Learning goals: pre-class
• By the start of class, you should be able to, for
each proof strategy below:
• Identify the form of statement the strategy can
prove.
• Sketch the structure of a proof that uses the
strategy.
• Strategies:
• constructive/non-constructive proofs of existence
• generalizing from the generic particular
• antecedent assumption
• indirect proofs by contrapositive and contradiction
3
Learning goals: in-class
• By the end of this module, you should be able to:
• Devise and attempt multiple different, appropriate
proof strategies for a given theorem, including
• all those listed in the "pre-class" learning goals
• logical equivalences,
• rules of inference,
• universal modus ponens/tollens,
• For theorems requiring only simple insights beyond
strategic choices or for which the insight is
given/hinted, additionally prove the theorem.
4
CPSC 121: the BIG questions:
• How can we convince ourselves that an algorithm
does what it's supposed to do?
• We need to prove its correctness.
• How do we determine whether or not one
algorithm is better than another one?
• Sometimes, we need a proof to convince someone
that the number of steps of our algorithm is what
we claim it is.
5
Module 7 outline
• Direct proofs.
• Witness proofs.
• Generalizing from the generic particular.
• Antecedent assumption.
• Dealing with multiple quantifiers.
• Indirect proofs:
• Proof by contrapositive.
• Proof by contradiction.
6
Direct proofs
• Try to prove theorem statement as given.
• Do not transform the theorem in any way (using
logical equivalences).
• If there are multiple operators (quantifiers), then
we work from the outermost operator inward.
• Use different techniques for existential and
universal quantifiers.
7
Witness proofs
• To prove
∃𝑥 ∈ 𝐷, 𝑃 𝑥
• We need to find an 𝑥 in 𝐷, which makes 𝑃(𝑥) true.
• The 𝑥 we use is called the witness to the
existential. It testifies that your existential is true.
• Tip: choose one that makes your job the easiest.
Proof:
Choose x = <some element of D>
Show that P(x) is true.
QED
8
A witness proof example
Theorem: There is an integer 𝑥 such that 𝑥 > 1 and
𝑥 2 + 10𝑥 > 𝑥 3 .
• It’s often helpful to translate the theorem
statement into predicate logic.
• The theorem becomes
∃𝑥 ∈ 𝑍, 𝑥 > 1 ∧ 𝑥 2 + 10𝑥 > 𝑥 3 .
• The existential quantifier tells us that we need to
use a witness proof.
9
A witness proof example
Theorem: There is an integer 𝑥 such that 𝑥 > 1 and
𝑥 2 + 10𝑥 > 𝑥 3 .
∃𝑥 ∈ 𝑍, 𝑥 > 1 ∧ 𝑥 2 + 10𝑥 > 𝑥 3 .
Proof:
Choose 𝑥 = 2. Note that 𝑥 > 1.
𝑥 2 + 10𝑥 = 22 + 10 ∗ 2 = 24.
𝑥 3 = 23 = 8.
24 > 8.
QED
10
Witness proof exercises
Theorem 1: There are integers 𝑚 and 𝑛 such that
1
1
𝑚 > 1, 𝑛 > 1, and + is an integer.
𝑚
𝑛
Theorem 2: There are integers 𝑚 and 𝑛 such that
1
1
𝑚 ≠ 𝑛 and + is an integer.
𝑚
𝑛
Prove these!
11
Witness proof exercises
Theorem 1: There are integers 𝑚 and 𝑛 such that
1
1
𝑚 > 1, 𝑛 > 1, and + is an integer.
𝑚
𝑛
1 1
∃𝑚 ∈ 𝑍, ∃𝑛 ∈ 𝑍, 𝑚 > 1 ∧ 𝑛 > 1 ∧ Integer( + ).
𝑚 𝑛
Proof:
Choose 𝑚 = 2 and 𝑛 = 2.
𝑚 > 1 and 𝑛 > 1.
1
𝑚
+
1
𝑛
=
1
2
+
1
2
= 1, which is an integer.
QED
12
Witness proof exercises
Theorem 2: There are integers 𝑚 and 𝑛 such that
1
1
𝑚 ≠ 𝑛 and + is an integer.
𝑚
𝑛
1 1
∃𝑚 ∈ 𝑍, ∃𝑛 ∈ 𝑍, 𝑚 ≠ 𝑛 ∧ Integer( + ).
𝑚 𝑛
Proof:
Choose 𝑚 = 2 and 𝑛 = −2.
𝑚 ≠ 𝑛.
1
𝑚
+
1
𝑛
=
1
2
1
+
−2
= 0, which is an integer.
QED
13
Module 7 outline
• Direct proofs.
• Witness proofs.
• Generalizing from the generic particular.
• Antecedent assumption.
• Proving a statement with mixed quantifiers.
• Indirect proofs:
• Proof by contrapositive.
• Proof by contradiction.
14
Generalizing from the generic particular
(or WLOG)
• To prove
∀𝑥 ∈ 𝐷, 𝑃(𝑥)
• Pick some arbitrary 𝑥 in 𝐷.
• Assume nothing about x except that it is in D.
• x is a generic element of D.
Proof:
Consider an unspecified element x of D.
Show that P(x) is true.
QED
15
Generalizing from the generic particular
(or WLOG)
• Some terminologies that mean the same thing:
• Consider an unspecified element x of D.
• Without loss of generality let x be an arbitrary
element of D.
• Suppose x is a particular but arbitrarily chosen
element of D.
16
Generalizing from the generic particular
(or WLOG) example
• Theorem: For any integer n, 𝑛(𝑛 − 1) + 3 is odd.
• In predicate logic:
∀𝑛 ∈ 𝑍, 𝑂𝑑𝑑 𝑛 𝑛 − 1 + 3
Proof:
Consider an unspecified integer n.
If n is even, then n-1 is odd. So n(n-1) is even.
If n-1 is even, then n is odd. So n(n-1) is even.
Since n(n-1) is even, n(n-1) + 3 must be odd.
QED
17
Generalizing from the generic particular
(or WLOG) exercises
• Theorem 1: The product of any three consecutive
integers is divisible by 6.
• Theorem 2: For any integer n, 4 𝑛2 + 𝑛 + 1 − 3𝑛2 is
a perfect square.
Prove these!
18
Generalizing from the generic particular
(or WLOG) exercises
Theorem 2: The product of three consecutive integers
is divisible by 6.
Proof:
Consider an unspecified integer n. Let the three
consecutive integers be n, n+1, and n+2.
One of the three integers must be even. Thus,
their product is divisible by 2.
One of these three integers must be divisible by 3.
Thus, their product is divisible by 3.
Therefore, their product is divisible by 6.
QED
19
Disproving a universal statement
•How do I prove that ∀𝑥 ∈ 𝐷, 𝑃(𝑥) is false?
a. Use a witness proof.
b. Use “generalizing from the generic
particular”.
c. Another proof technique is needed.
20
Disproving an existential statement
•How do I prove that ∃𝑥 ∈ 𝐷, 𝑃 𝑥 is false?
a. Use a witness proof.
b. Use “generalizing from the generic
particular”.
c. Another proof technique is needed.
21
Module 7 outline
• Direct proofs.
• Witness proofs.
• Generalizing from the generic particular.
• Antecedent assumption.
• Proving a statement with mixed quantifiers.
• Indirect proofs:
• Proof by contrapositive.
• Proof by contradiction.
22
Antecedent assumption
• To prove:
The antecedent
∀𝑥 ∈ 𝐷, 𝑃(𝑥) → 𝑄(𝑥)
Proof:
Consider an unspecified element x of D.
Assume that P(x) is true.
Show that Q(x) is true.
QED
23
Antecedent assumption example
• Theorem: For any integer n, if 𝑛 ≥ 20, then
10𝑛 ≤ 𝑛2 .
• In predicate logic:
∀𝑛 ∈ 𝑁, 𝑛 ≥ 20 → 10𝑛 ≤ 𝑛2
Proof:
Consider an unspecified natural number 𝑛.
Assume that 𝑛 ≥ 20.
10𝑛 ≤ 20𝑛 ≤ 𝑛2 because 𝑛 ≥ 20.
QED
24
Antecedent assumption exercises
• Theorem 1: For any integer n, if 𝑛 ≥ 1, then
6𝑛2 + 2𝑛 + 8 ≤ 16𝑛2 .
• Theorem 2: For any integer n, if 𝑛 ≥ 2, then
6𝑛2 + 2𝑛 + 8 ≤ 9𝑛2 .
• Prove these!
25
Proof by lack of space
• Fermat’s last theorem:
𝑥𝑛 + 𝑦𝑛 = 𝑧𝑛
has no positive integer solutions if 𝑛 > 2.
“I have discovered a truly remarkable proof which
this margin is too small to contain.”
-- Fermat 1637
26
Module 7 outline
• Direct proofs.
• Witness proofs.
• Generalizing from the generic particular.
• Antecedent assumption.
• Proving a statement with mixed quantifiers.
• Indirect proofs:
• Proof by contrapositive.
• Proof by contradiction.
27
Proving a statement with mixed quantifiers
• Most interesting statements that we want to
prove involve multiple quantifiers.
• Examples:
• For any integer, there is a larger integer.
• There is a positive integer c such that x+y≤cmax{x,y}
for every pair of positive integers x and y.
• We learned the proof technique for each
quantifier.
28
Searching for a name in a phone book
• We have a phone book with names in sorted
order.
• Given a name, we want to find that person’s
phone number.
29
Comparing algorithms L and B
• Algorithm L: check the first name. If it's not N,
then check the second name. Then the third
name, etc.
• Algorithm B: check the name in the middle of the
list. If N comes earlier alphabetically then search
the first half of the list using B. If it comes later
search the second half of the list instead. Repeat
until you have found N or you're looking at an
empty sublist.
30
Average time to read a name
• Assumptions:
• Reading the name after the current one takes 1s on
average.
• Reading the name in a given position takes 10s on
average.
• It is faster to read names in order than to read a
name at a given position.
31
Running time of the two algorithms
• How many names do we have to read in the worst
case?
• For a list with 15 names:
• Algorithm L
15 * 1s = 15s.
• Algorithm B
4 * 10s = 40s.
• For a list with 63 names:
• Algorithm L
63 * 1s = 1m 3s.
• Algorithm B
6 * 10s = 1m.
• For a list with 1048575 names:
• Algorithm L
1048575 * 1s = 12d 3h 16m 15s
• Algorithm B
20 * 10s = 3m 20s
32
Lessons learned
• The running time of an algorithm depends on the
size of the input.
• We care about the running time of algorithms
when the input is large.
• Algorithm F is generally faster than algorithm G if
algorithm F runs in less time than algorithm G
when the input is large enough.
33
When is an algorithm generally faster
than another algorithm?
• Consider an input of size n.
• Algorithm F runs in f(n) seconds.
• Algorithm G runs in g(n) seconds.
• Algorithm F is generally faster than algorithm G if
the following predicate is true:
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 𝒇(𝒏) ≤ 𝒄𝒈(𝒏)
• Also called f(n) is in O(g)
34
Parsing the predicate
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 𝒇(𝒏) ≤ 𝒄𝒈(𝒏)
• There exists a positive real number c.
• We are allowed to multiply g(n) by a given positive
constant. For example, consider 𝑔(𝑛) = 16𝑛2 .
• There exists a natural number n0.
• This is the threshold for the input size.
• An input is large enough if it is no smaller than n0.
• For any natural number n that is larger than n0.
• We consider any input that is large enough.
35
Proving that f(n) is in O(g)
• Let 𝑓 𝑛 = 6𝑛2 + 2𝑛 + 8, and 𝑔(𝑛) = 16𝑛2 .
• Theorem:
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 𝒇(𝒏) ≤ 𝒄𝒈(𝒏).
36
Proving that f(n) is in O(g)
Theorem:
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 6𝑛2 + 2𝑛 + 8 ≤ 𝒄16𝑛2
• Let’s write out the template for the proof first.
• Proof:
<What should we do for c?>
<What should we do for n0?>
<What should we do for n?>
<How should we prove the implication?>
37
Proving that f(n) is in O(g)
Theorem:
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 6𝑛2 + 2𝑛 + 8 ≤ 𝒄16𝑛2
• Proof:
Choose c = ?
Choose n0 = ?
Consider an unspecified natural number n.
Assume that 𝑛 ≥ 𝑛0.
Prove that 6𝑛2 + 2𝑛 + 8 ≤ 𝑐16𝑛2 .
38
Proving that f(n) is in O(g)
Theorem:
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 6𝑛2 + 2𝑛 + 8 ≤ 𝒄16𝑛2
Choose c = 1.
We need to prove
𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 6𝑛2 + 2𝑛 + 8 ≤ 16𝑛2
39
Proving that f(n) is in O(g)
Choose c = 1.
We need to prove
𝑛0 𝑁, 𝑛𝑁, 𝑛 ≥ 𝑛0 6𝑛2 + 2𝑛 + 8 ≤ 16𝑛2
Some scratch work:
6𝑛2 + 2𝑛 + 8 ≤ 16𝑛2
2𝑛 + 8 ≤ 10𝑛2
If n = 0, LHS = 8, RHS = 0. LHS > RHS
If n = 1, LHS = 10, RHS = 10. LHS = RHS
If n = 2, LHS = 12, RHS = 40. LHS < RHS
If n = 3, LHS = 14, RHS = 90. LHS < RHS
The inequality is satisfied for any 𝑛 ≥ 1. Let’s choose n0 = 1.
40
Proving that f(n) is in O(g)
Choose 𝑐 = 1.
Choose 𝑛0 = 1.
We need to prove
𝑛𝑁, 𝑛 ≥ 16𝑛2 + 2𝑛 + 8 ≤ 16𝑛2
Consider an unspecified integer n.
Assume 𝑛 ≥ 1.
We need to prove that 6𝑛2 + 2𝑛 + 8 ≤ 16𝑛2
41
Proving that f(n) is in O(g)
Choose 𝑐 = 1.
Choose 𝑛0 = 1.
Consider an unspecified integer n.
Assume 𝑛 ≥ 1.
We need to prove that 6𝑛2 + 2𝑛 + 8 ≤ 16𝑛2
6𝑛2 + 2𝑛 + 8
≤ 6𝑛2 + 2𝑛2 + 8
because 𝑛 ≥ 1
≤ 6𝑛2 + 2𝑛2 + 8𝑛 because 𝑛 ≥ 1
≤ 6𝑛2 + 2𝑛2 + 8𝑛2 because 𝑛 ≥ 1
= 16𝑛2
42
Proving that f(n) is in O(g)
Theorem:
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 6𝑛2 + 2𝑛 + 8
≤ 𝒄16𝑛2
Proof: Choose c = 1. Choose n0 = 1.
Consider an unspecified natural number n.
Assume 𝑛 ≥ 1. We need to prove that 6𝑛2 + 2𝑛 + 8 ≤
16𝑛2 .
6𝑛2 + 2𝑛 + 8
≤ 6𝑛2 + 2𝑛2 + 8
because 𝑛 ≥ 1
≤ 6𝑛2 + 2𝑛2 + 8𝑛 because 𝑛 ≥ 1
≤ 6𝑛2 + 2𝑛2 + 8𝑛2 because 𝑛 ≥ 1
= 16𝑛2
QED
43
Additional questions and exercises
𝒄 𝑹+ , 𝒏𝟎 𝑵, 𝒏𝑵, 𝒏 ≥ 𝒏𝟎 𝒇(𝒏) ≤ 𝒄𝒈(𝒏)
• When 𝑓 𝑛 = 6𝑛2 + 2𝑛 + 8 and 𝑔(𝑛) = 16𝑛2 ,
• Would our proof still work if I chose c = 10?
• Would our proof still work if I chose c = 1/4?
• Could you prove that the predicate is true when
𝑓 𝑛 = 10𝑛2 and 𝑔 𝑛 = 𝑛!?
• Could you prove that the predicate is false when
𝑓 𝑛 = 𝑛! and 𝑔 𝑛 = 10𝑛2 ?
• Pick f(n) and g(n) yourself and try to prove or
disprove the predicate.
44
Upcoming due dates
• Pre-class quiz 8 is due tomorrow (Tuesday
February 28) at 7pm.
• Assignment #3 is due on Thursday March 2nd at
4pm.
45
Mid-term feedback
• “Clicker questions take too long!” “Lectures are too slow!”
• Noted! I am constantly revising examples and lecture
slides, so the lecture content is never as polished as I
would like it to be.
• “Please spend more time explaining concepts instead of
letting us work on problems on our own.”
• I’d like to use lecture time to clarify complex concepts and
applying concepts to problems.
• “Thanks for the snacks! But seems like we’re on a
chocolate famine lately?”
• This was not intentional! It was a bit easier to come up
with short, fact based reviews questions for the earlier
materials, but I still have chocolates and I will bring it every
class from now on.
46
Proving a statement with mixed quantifiers
• Theorem: every even square can be written as the
sum of two consecutive odd integers.
• In predicate logic:
∀𝑥 ∈ 𝑍 + , 𝐸𝑣𝑒𝑛(𝑥) ∧ 𝑆𝑞𝑢𝑎𝑟𝑒(𝑥) → 𝑆𝑢𝑚𝑂𝑓𝑇𝑤𝑜𝐶𝑜𝑛𝑠𝑂𝑑𝑑(𝑥)
How do we define:
• Even(x):
• Square(x):
• SumOfTwoConsOdd(x):
47
Proving a statement with mixed quantifiers
∀𝑥 ∈ 𝑍 + , 𝐸𝑣𝑒𝑛(𝑥) ∧ 𝑆𝑞𝑢𝑎𝑟𝑒(𝑥) → 𝑆𝑢𝑚𝑂𝑓𝑇𝑤𝑜𝐶𝑜𝑛𝑠𝑂𝑑𝑑(𝑥)
Proof:
Consider an unspecified integer x.
Assume that x is an even square.
(Hint: for every positive integer n, if n2 is even, then
n is even.)
<Fill this part in>
Therefore x can be written as the sum of two
consecutive odd integers. QED
48
Proving a statement with mixed quantifiers
Theorem:
∀𝑥 ∈ 𝐴, ∃𝑦 ∈ 𝐵, ∀𝑧 ∈ 𝐶, 𝑃(𝑥, 𝑦, 𝑧) → 𝑄(𝑥, 𝑦, 𝑧).
Write as much of the proof as possible without
knowing the sets A, B, and C, and the predicates P and
Q.
Proof:
49
Module 7 outline
• Direct proofs.
• Witness proofs.
• Generalizing from the generic particular.
• Dealing with multiple quantifiers.
• Indirect proofs:
• Proof by contrapositive
• Proof by contradiction.
50
Proof by contrapositive
• Theorem: If the square of a positive integer n is
even, then n is even.
• In predicate logic, ∀𝑛 ∈ 𝑍 + , 𝐸𝑣𝑒𝑛 𝑛2 → 𝐸𝑣𝑒𝑛 𝑛 .
• How do we prove this?
• Let's try a direct proof.
• Consider an unspecified integer n.
• Assume that 𝑛2 is even.
• So 𝑛2 = 2𝑘 for some (positive) integer k.
• Hence 𝑛 = 2𝑘. Then what?
51
Proof by contrapositive
• Theorem: ∀𝑛 ∈ 𝑍 + , 𝐸𝑣𝑒𝑛 𝑛2 → 𝐸𝑣𝑒𝑛 𝑛 .
• Let’s try an “indirect” approach.
• Remember the contrapositive law?
• 𝑝 → 𝑞 ≡ ~𝑞 → ~𝑝
• What is the contrapositive of the theorem
statement?
• Theorem: ∀𝑛 ∈ 𝑍 + , 𝑂𝑑𝑑 𝑛 → 𝑂𝑑𝑑 𝑛2 .
52
Proof by contrapositive
Theorem: ∀𝑛 ∈ 𝑍 + , 𝑂𝑑𝑑 𝑛 → 𝑂𝑑𝑑 𝑛2 .
Proof:
Consider an unspecified positive integer n.
Assume that n is odd. Hence 𝑛 = 2𝑘 + 1 for some integer k.
We need to show that n2 is odd, i.e. we need to choose some
integer t such that n2 = 2t + 1.
Choose 𝑡 = 2𝑘 2 + 2𝑘.
Then 𝑛2 = (2𝑘 + 1)2 = 4𝑘 2 + 4𝑘 + 1 = 2 2𝑘 2 + 2𝑘 +
1 = 2𝑡 + 1.
Therefore 𝑛2 is odd.
QED
53
Proof by contrapositive
Theorem: If the square of a positive integer n is even, then n is even.
Proof:
We will prove the contrapositive of the theorem, that is, if a positive
integer n is odd, then n2 is odd.
Consider an unspecified positive integer n.
Assume that n is odd. Hence 𝑛 = 2𝑘 + 1 for some integer k.
We need to show that n2 is odd, i.e. we need to choose some integer
t such that n2 = 2t + 1.
Choose 𝑡 = 2𝑘 2 + 2𝑘.
Then 𝑛2 = (2𝑘 + 1)2 = 4𝑘 2 + 4𝑘 + 1 = 2 2𝑘 2 + 2𝑘 + 1 = 2𝑡 +
1. Therefore 𝑛2 is odd.
QED
54
Proof by contrapositive
• Additional exercises:
• Theorem: If the product of two positive real
numbers is greater than 100, then at least one of
the numbers is greater than 10.
55
Module 7 outline
• Direct proofs.
• Witness proofs.
• Generalizing from the generic particular.
• Dealing with multiple quantifiers.
• Indirect proofs:
• Proof by contrapositive
• Proof by contradiction.
56
Proof by contradiction
• To prove a theorem, we start by assuming that the
theorem is false.
• Then we try to derive a contradiction.
• Usually we derive several facts that cannot be
true at the same time. For example,
• X is odd and even.
• x < 5 an x > 10.
• Y is rational and irrational.
• Finally we conclude that the theorem is true.
57
Proof by contradiction
Theorem: For any integer n, 𝑛2 − 2 is not divisible by 4.
In predicate logic: ∀𝑛 ∈ 𝑍, ~∃𝑘 ∈ 𝑍, 𝑛2 − 2 = 4𝑘.
How can we prove this?
• Let’s assume that 𝑛2 − 2 is divisible by 4 for some integer
n. Then we will derive a contradiction.
• Specifically we will show that n2 is divisible by 4 and not
divisible by 4 at the same time.
The negation of the theorem is:
~∀𝑛 ∈ 𝑍, ~∃𝑘 ∈ 𝑍, 𝑛2 − 2 = 4𝑘
≡ ∃𝑛 ∈ 𝑍, ~~∃𝑘 ∈ 𝑍, 𝑛2 − 2 = 4𝑘
≡ ∃𝑛 ∈ 𝑍, ∃𝑘 ∈ 𝑍, 𝑛2 − 2 = 4𝑘
58
Proof by contradiction
Theorem: For any integer n, 𝑛2 − 2 is not divisible by 4.
Its negation: ∃𝑛 ∈ 𝑍, ∃𝑘 ∈ 𝑍, 𝑛2 − 2 = 4𝑘
Proof:
We prove this by contradiction. Assume that the theorem is
false. That means, there exists an integer n and an integer k
such that 𝑛2 − 2 = 4𝑘, or 𝑛2 = 4𝑘 + 2. Thus, n2 is not
divisible by 4.
Since 4k+2 is even, n2 is also even. Then n is also even. (Write a
short proof for this part.)
Since n is even, n2 is divisible by 4, which contradicts with the
fact that n2 is not divisible by 4.
QED
59
Proof by contradiction
Theorem: 2 is irrational.
• Definition: x is rational if x can be written as a fraction of two
integers with no common factors.
• Definition: x is irrational if x is not rational.
In predicate logic:
𝑎
~∃𝑎 ∈ 𝑍, ∃𝑏 ∈ 𝑍, 2 = ∧ ~∃𝑘 ∈ 𝑍, 𝑘 > 1 ∧ 𝑘|𝑎 ∧ 𝑘|𝑏.
𝑏
How can we prove this?
• Let’s assume that 2 is rational. Then it can be written as a
fraction of two integers 2 = 𝑎/𝑏.
Where do we find a contradiction?
• We could try to show that a and b must have a common
factor.
60
Proof by contradiction
• Additional exercises:
• Theorem: For all real numbers x and y, if x is a rational
number and y is an irrational number, then x+y is
irrational.
• Theorem: Not every CPSC 121 student got an above
average grade on midterm 1.
• Theorem: A group of CPSC 121 students show up in a
room for a tutorial. The TA is late, and so the students
start talking to each other. If every student has talked
to at least one other student, then two of the
students talked to exactly the same number of
people.
61
How should you tackle a proof?
• Try the simpler methods first:
• Witness proofs.
• Generalizing from the generic particular.
• Antecedent assumption.
• Proof by contrapositive.
• Proof by contradiction.
• If you don't know if the theorem is true:
• Alternate between trying to prove and disprove it.
• Use a failed attempt at one to help with the other.
62
How should you tackle a proof
(continued)?
• If you get stuck, try looking backwards from the
conclusion you want.
• But don't forget the argument must eventually be
written from the premises to the conclusion (not
the other way around).
• Try to derive all new facts you can derive from the
premises without worrying about whether or not
they will help.
• If you are really stuck, ask for help!
63
Additional examples
1. Prove that for every positive integer x, either 𝑥
is an integer, or it is irrational.
2. Prove that any circuit consisting of NOT, OR,
AND and XOR gates can be implemented using
only NOR gates.
64
Additional examples
1. Prove that if a, b and c are integers, and 𝑎2 +
𝑏 2 = 𝑐 2 , then at least one of a and b is even.
Hint: use a proof by contradiction, and show
that 4 divides both 𝑐 2 and 𝑐 2 − 2.
2. Prove that there is a positive integer c such that
𝑥 + 𝑦 ≤ 𝑐 ∙ max{𝑥, 𝑦} for every pair of positive
integers x and y.
65
© Copyright 2026 Paperzz