0% found this document useful (0 votes)
3 views9 pages

Induction

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 9

COMP 1805 Discrete Structures

Proof Paradigms: Proofs by Mathematical Induction

What & When


Suppose you are asked to prove a claim ϕ such as
Claim. For all n ∈ N, P (n) is true.
Mathematical induction is a simple yet powerful technique that allows us to prove infinitely many
statements with a finite amount of work. The concept of an inductive proof doesn’t actually require
much mathematical background; one could realistically consider teaching induction in elementary
school. Induction proofs are highly structured, yet leave plenty of room for creativity.
In computer science and mathematics, it is quite important that you can convince yourself and
others that your program does what it is supposed to do. Induction is one tool to help you argue
about the correctness of your algorithms (and therefore your programs). You’ll want this tool
when you take algorithms, data structures, programming languages, or theory of computation
courses.
In this document, we use induction to determine how to best cut a pizza with a Samurai sword, how
to tile a chess board with tri-ominoes, how to make the most of your jelly bean eating experience,
and many other useful skillz!

A Ladder Metaphor
Suppose there is a very long ladder on the side of a very tall tower. The rungs on this ladder are
such that from any one rung you are able to reach the next rung. Given this information, can you
reach the top of the ladder?
Your answer ought to be “it depends”: it depends on whether the very first rung is reachable or
not! If you are able to reach the first rung, then because the rungs are close together, you are
able to reach the second, and then the third, and then the fourth, and so on. Conversely, if you
are not able to reach the first rung then you are stuck on the ground.
Humour me and think about this ladder situation in another way. Let’s label the rungs of the
ladder with numbers, such that the bottom rung is labelled 0 and the labels increase by 1 as we
go up the ladder. Let P (n) be the property that we are able to reach the nth rung. You can (and
should) think of P as a boolean function, that takes a single integer parameter n, and returns true
if you can reach the nth rung, and false otherwise.
With this notation, the statement “the rungs are such that from any one rung you are able to
reach the next rung” is the same as “for any k ≥ 0, if P (k) is true then P (k + 1) is also true.”
This doesn’t say anything about the reachability of the first rung; that is, we don’t know if P (0) is
true. If P (0) is true, though, then we can apply the “if P (k) is true then P (k + 1) is also true” for
k = 0 and get that P (1) is true, which then implies that P (2) is true, and so on, so that P (n) is
true for all n ≥ 0. Conversely, if P (0) is not true, then we cannot say anything about the validity
of P (n) for any n ≥ 1.

1
Induction Introduction
The principles of induction follows that of the ladder. If we are trying to prove that we can reach
the nth rung of a ladder, for all n, we first have to prove that our rungs are close enough so that
if we can reach the kth rung then we can reach the k + 1st. This isn’t sufficient to prove the
reachability of all rungs, though; we must also prove that we can reach the first rung.
Of course, we won’t be proving statements about ladders! Instead, we prove properties about
natural numbers, using the same ladder idea. You’ll have some boolean property P (n) that you
are trying to prove for some infinite set of natural numbers (for example, for all n ≥ 0 or for all
n ≥ 1). To prove P (n) for all requisite n, you’ll prove two things: (1) that if P (k) holds for
some fixed k, then P (k + 1) also holds, and (2) that P (0) also holds (or P (1), or some other small
number). This combination will prove that P (n) holds for the infinitely many n that you specified.
Why does this work? You’ve explicitly shown the property is true for n = 0. Moreover, you’ve
shown that if the property holds for k = 0 (which it does, because you just did that) then it also
holds for k = 1; therefore, the base case implies it is true for n = 1. You can use the step (1) again
to show that it is true for n = 2, then n = 3, and so on, infinitely, as long as you want.
Here is another argument. Suppose that you’ve shown (1) and (2), yet there is some number such
that the property is not true. Let k + 1 be the smallest number for which the property isn’t true.
How did the property become false? Well, if it’s false for k + 1, then it must also be false for k
(because of (1)). But k + 1 was the smallest number for which the property was false, which is a
contradiction. Therefore (1) and (2) imply there is no such k.
Enough abstract jibber jabber. It’s time for an example.

Example 1: Sum of Squares (Tutorial)


Suppose we are trying to come up with a formula for the sum of the first n squares, for n ≥ 0. We
may try a few numbers out to see if we can find a pattern:

02 = 0
02 + 12 = 1
02 + 1 2 + 2 2 = 5
02 + 12 + 22 + 32 = 14

Okay, I’m not sure if you’re seeing a pattern, but it looks like the sum of the first n squares may
be n(n + 1)(2n + 1)/6. It certainly works for the few examples above, but I’d like to prove that
the formula works for every single n ≥ 0, that is, I want to prove an infinite number of equalities.
Let’s see how to do this with induction:

2
Step 0. For all n ≥ 0, we want to show that the sum of the first n squares is equal to n(n +
1)(2n + 1)/6.

Step 1. For any n ≥ 0, let P (n) be the property that


n(n + 1)(2n + 1)
02 + 12 + 22 + 32 + · · · + (n − 1)2 + n2 = .
6
We want to show that P (n) is true for all n ≥ 0.

Step 2. As a base case, consider when n = 0. We will show that P (0) is true: that is, that
02 + · · · + 02 = 0(0 + 1)(2 · 0 + 1)/6. Fortunately,

left-hand side = 02 + · · · + 02 = 0 = 0(0 + 1)(0 + 1)/6 = right-hand side.

Step 3. For the induction hypothesis, suppose (hypothetically) that P (k) were true for some fixed
k ≥ 0. That is, suppose that
k(k + 1)(2k + 1)
02 + 12 + 22 + · · · + (k − 1)2 + k 2 = .
6

Step 4. Now we prove that P (k + 1) is true, using the (hypothetical) induction assumption that
P (k) is true. That is, we prove that
(k + 1)(k + 2)(2(k + 1) + 1)
02 + 12 + 22 + · · · + k 2 + (k + 1)2 = .
6

Step 5. The proof that P (k + 1) is true (given that P (k) is true) is as follows:

left-hand side = 02 + 12 + 22 + · · · + k 2 + (k + 1)2


= (02 + 12 + 22 + · · · + k 2 ) + (k + 1)2
k(k + 1)(2k + 1)
= + (k + 1)2 by the induction hypothesis P (k)
6
k(k + 1)(2k + 1) + 6(k + 1)2
= by algebra
6
(k + 1)(2k 2 + k) + (k + 1)(6k + 6)
= by algebra
6
(k + 1)(2k 2 + 7k + 6)
= by algebra
6
(k + 1)(k + 2)(2k + 3)
= by algebra
6
= right-hand side.

Therefore we have shown that if P (k) is true, then P (k + 1) is also true, for any k ≥ 0.

Step 6. The steps above have shown that for any k ≥ 0, if P (k) is true, then P (k + 1) is also
true. Combined with the base case, which shows that P (0) is true, we have shown that for
all n ≥ 0, P (n) is true, as desired.

3
7-Step Process
Proofs by mathematical induction have the form that you prove P (n) for your smallest value(s)
of n for which you want your property to hold, then you prove that for any k, if P (k) is true
then P (k + 1) would also be true. We recommend you use the following 7-step structure to do so.
While it may seem like overkill to do all 7 steps, even seasoned mathematicians tend to put all 7
parts into a proof by induction, because it gives the proof a common structure that makes it very
easy to follow. The creativity of the proof really comes into step 5, but putting all your ducks in
a row before you get to that point can make step 5 a lot easier.

Step 0: State (the infinite set of ) statements that you want to prove.

For all n ≥ hbase casei, we want to show that .

where the blank should contain some property of n.


Step 1: State your P (n). State what property of n you are trying to prove, which should be a
property as a function of n. Also state for which n you will prove your P (n) to be true (is
it for all n ≥ 0? n ≥ 1? n ≥ 100?).
For any n ≥ hbase casei, let P (n) be the property that .
where the blank should contain some property of n, possibly as it was written in Step 0.
Step 2: State your base case. State for which n your base case is true, and prove it. Typically,
this will be the smallest n for which you are trying to prove P (n) (i.e. what you used as
hbase casei), but occasionally you’ll need more than one base case.
As a base case, consider when n = hbase casei. We will show that P ( hbase casei)
is true, by: .
Step 3: State your induction hypothesis. State your induction hypothesis. Here you are
usually just hypothetically asserting the property P for some fixed k ≥ hbase casei.
For the induction hypothesis, suppose (hypothetically) that P (k) were true for
some fixed k ≥ hbase casei, that is, suppose that .
where the blank should contain the statement P (k).
Step 4: State your inductive assertion. State that you will prove P (k + 1) given the (hypo-
thetical) assumption that P (k) is true.
Now we prove that P (k + 1) is true, using the (hypothetical) induction assumption
that P (k) is true. That is, we prove that .
Step 5: Prove the inductive step. Here is where you actually do the proof that P (k + 1) is
true, and thus this is where the creativity comes in. This proof is going to be different for
each induction proof; sometimes it will use algebra, number theory, common sense, etc. It
will always need to use the induction hypothesis P (k), and you should clearly label when
and where you use this assumption. If you haven’t used your induction hypothesis, then you
aren’t doing a proof by induction (and you should be worried!)

4
The proof that P (k + 1) is true (given that P (k) is true) is as follows: .
Step 6: Conclusion.
We have shown that if P (k) is true, then P (k + 1) is true. Thus, because P (hbase
casei) is true, you have that P (n) is true for all n ≥ hbase casei.

Tips
• Check that you P (n) mentions n in it somewhere, and that it doesn’t mention other variables.
Remember, P is just like a method, that takes in one variable n. You should use that variable
in P , and you should use others.
• P (n) is a boolean property, not a number, so you cannot manipulate it mathematically, like
P (n) = 5, or P (n + 1) < P (n).
• Be careful with the base case... sometimes you will need more than one, as with some
recurrence relations.
• You must use your induction hypothesis somewhere in the proof of the inductive step, oth-
erwise you are not doing a proof by induction. Check to be sure.
• If you’re stuck in your inductive step, take a step back for a moment. What are you trying
to prove? Keep this in mind when you work on proving P (k + 1). Since you have to use
your induction hypothesis somewhere, you may want to think about how you can manipulate
what you’ve got into something that resembles your induction hypothesis. Also, you may
want to check any algebra you’ve done as that can often be the source of problems!
• When trying to prove some equation holds, that is, if you are trying to prove that
left-hand-side = right-hand-side
for some left-hand-side and right-hand-side, please do not start with assuming they are equal
and then modifying both sides of the equations until you get an equation that is actually
true. For example:
left-hand-side = right-hand-side
0 × left-hand-side = 0 × right-hand-side
0 = 0.
Therefore they are equal.

Obviously I can ‘prove’ that left-hand-side = right-hand-side using this method for any
left-hand-side and right-hand-side, regardless of whether or not they are actually equal!
What is better is to start with left-hand-side, make modifications to left-hand-side through
a string of equalities that somehow ends with right-hand-side. That is,
left-hand-side = · · ·
= ···
= right-hand-side.
This will guarantee that you don’t prove something that isn’t true.

5
Example 1: Powers of 2 (Lecture)
Suppose we want to prove the following claim.
Pn i n+1 − 1.
Claim. i=0 2 = 2
We will prove this by induction using the 7-step process.

Step 0. For all n ≥ 0, we want to show that the sum of the first n powers of 2 is equal to 2n+1 − 1.
Step 1. For any n ≥ 0, let P (n) be the property that
n
X
2i = 2n+1 − 1 .
i=0
We want to show that P (n) is true for all n ≥ 0.
Step P
2. As a base case, consider when n = 0. We will show that P (0) is true: that is, that
0 i 1
i=0 2 = 2 − 1. Fortunately,
0
X
left-hand side = 2i = 20 = 1 = 2 − 1 = 21 − 1 = right-hand side.
i=0

Step 3. For the induction hypothesis, suppose (hypothetically) that P (k) were true for some fixed
k ≥ 0. That is, suppose that
Xk
2i = 2k+1 − 1 .
i=0

Step 4. Now we prove that P (k + 1) is true, using the (hypothetical) induction assumption that
P (k) is true. That is, we prove that
k+1
X
2i = 2k+2 − 1 .
i=0

Step 5. The proof that P (k + 1) is true (given that P (k) is true) is as follows:
k+1
X
left-hand side = 2i
i=0
k
X
= 2k+1 + 2i by pulling out the first term out of the sum
i=0
= 2k+1 + (2 k+1
− 1) by the induction hypothesis P (k)
= 2 · 2k+1 − 1 by algebra
k+2
=2 −1 by algebra
= right-hand side.
Therefore we have shown that if P (k) is true, then P (k + 1) is also true, for any k ≥ 0.
Step 6. The steps above have shown that for any k ≥ 0, if P (k) is true, then P (k + 1) is also
true. Combined with the base case, which shows that P (0) is true, we have shown that for
all n ≥ 0, P (n) is true, as desired.

6
Example 2: Jelly Beans (Tutorial)
You have n ≥ 0 jelly beans, each of a different flavour. As you know, different subsets of jelly
bean flavours produce different taste bud sensations. How many different flavour combinations
are there? (We’ll count no flavour, as in, no jelly beans, as a distinct flavour combination.)

First imagine that we have only two jellybeans: apple, kiwi. Then there are four flavour combina-
tions: no flavour, apple, kiwi, and apple-kiwi. Note that 2 of these flavour combinations contain
kiwi, and two do not.
Now suppose we have three jellybeans: apple, berry, kiwi. Then there are 8 flavour combinations:
no flavour, apple, berry, kiwi, apple-berry, apple-kiwi, berry-kiwi, and apple-berry-kiwi. Note that
4 of these flavour combinations contain kiwi, and 4 do not.
Finally, suppose we have four jellybeans: apple, berry, cherry, kiwi. Then there are 16 flavour com-
binations: no flavour, apple, berry, cherry, kiwi, apple-berry, apple-cherry, apple-kiwi, berry-cherry,
berry-kiwi, cherry-kiwi, apple-berry-cherry, apple-berry-kiwi, apple-cherry-kiwi, berry-cherry-kiwi,
and apple-berry-cherry-kiwi. Note that 8 of these flavour combinations contain kiwi, and 8 do not.

Step 0. For all n ≥ 0, we want to show that there are 2n flavour combos drawn from n jelly
beans.

Step 1. For any n ≥ 0, let P (n) be the property that there are 2n flavour combos drawn from n
jelly beans.

Step 2. As a base case, consider when n = 0. We will show that P (0) is true: with 0 jelly beans,
there is only one flavour combination (the boring, no flavour one), and 1 = 20 .

Step 3. For the induction hypothesis, suppose (hypothetically) that P (k) is true for some fixed
k ≥ 0. That is, suppose that there are 2k flavour combinations drawn from k jelly beans.

Step 4. Now we prove that P (k + 1) is true, using our (hypothetical) induction assumption that
P (k) is true. That is, we prove that there are 2k+1 flavour combinations drawn from k + 1
jelly beans.

Step 5. Now we prove P (k + 1) is true, using the fact that P (k) is true:
Consider your k + 1 beans, and suppose kiwi is one of your flavours (since k + 1 ≥ 1 we
know at least one jelly bean exists and we can call it kiwi). Then since each flavour combo
either contains kiwi or it doesn’t, the total number of flavour combos is equal to the flavour
combos that include kiwi, and those that do not. That is, we have

LHS := # combos drawn from k + 1 beans


= # combos that contain kiwi drawn from k + 1 beans +
# combos that don’t contain kiwi drawn from k + 1 beans

Consider a flavour combo drawn from k + 1 beans that contains kiwi. It consists of a kiwi
bean, and a flavour combo drawn from the remaining k (non-kiwi) beans. In our example
above with n = 4, the apple-berry-kiwi combo is the apple-berry combo drawn from apple,
berry, cherry, plus kiwi.

7
Consider a flavour combo drawn from k + 1 beans that doesn’t contain kiwi. It consists of
some flavour combo drawn from the remaining k (non-kiwi) beans. In our example above
with n = 4, the apple-berry combo is the apple-berry combo drawn from apple, berry, cherry.
In both cases, we can create the flavour combo drawn from k + 1 beans out of a flavour
combos drawn from the k non-kiwi beans. In the latter case we add the kiwi bean back,
in the former case we do not. But every flavour combo drawn from k + 1 beans can be
constructed in this way out of flavour combos drawn from k (non-kiwi) beans. That is, we
have

LHS = # combos that contain kiwi drawn from k + 1 beans +


# combos that don’t contain kiwi drawn from k + 1 beans
= # combos drawn from k (non-kiwi) beans (to which we would add kiwi) +
# combos drawn from k (non-kiwi) beans (that we leave as-is)
= 2k + 2k by the IH
k+1
=2 , which is our “RHS”.

Therefore we have shown that if P (k) is true, then P (k + 1) is also true.

Step 6. The steps above have shown that for any k ≥ 0, if P (k) is true, then P (k + 1) is also
true. Combined with the base case, which shows that P (0) is true, we have shown that for
all n ≥ 0, P (n) is true, as desired.

8
Exercise: Tiling with Triominoes
For any n ≥ 0, consider a 2n × 2n checkerboard, with one corner removed. Can you always tile
the checkerboard with L-shaped “tri-ominoes”? If so, how?

Step 0. For all n ≥ , we want to show that

Step 1. For any n ≥ , let P (n) be the property that

Step 2. As a base case, consider when n = . We will show that P ( ) is true:

Step 3. For the induction hypothesis, suppose (hypothetically) that P (k) is true for some fixed
k ≥ . That is, suppose that

Step 4. Now we will prove that P (k + 1) is true, using our (hypothetical) induction assumption
that P (k) is true. That is, we must prove that

Step 5. The proof that P (k + 1) is true (given that P (k) is true) is as follows:

Therefore we have shown that if P (k) is true, then P (k + 1) is also true.


Step 6. The steps above have shown that for any k ≥ , if P (k) is true, then P (k + 1) is also
true. Combined with the base case, which shows that P ( ) is true, we have shown that
for all n ≥ , P (n) is true, as desired.

You might also like