cs70-2 Notes3 PDF
cs70-2 Notes3 PDF
cs70-2 Notes3 PDF
Induction
Induction is an extremely powerful tool in mathematics. It is a way of proving propositions that hold for all
natural numbers:
k(k+1)
1) ∀k ∈ N, 0 + 1 + 2 + 3 + · · · + k = 2
Each of these propositions is of the form ∀k ∈ N P(k). For example, in the first proposition, P(k) is the
statement 0 + 1 + · · · + k = k(k+1)
2 , P(0) says 0 =
0(0+1)
2 , P(1) says 0 + 1 =
1(1+1)
2 , etc. The principle of
induction asserts that you can prove P(k) is true ∀k ∈ N, by following these three steps:
The principle of induction formally says that if P(0) and ∀n ∈ N (P(n) =⇒ P(n + 1)), then ∀n ∈ N P(n).
Intuitively, the base case says that P(0) holds, while the inductive step says that P(0) =⇒ P(1), and P(1) =⇒
P(2), and so on. The fact that this domino effect eventually shows that ∀n ∈ N P(n) is what the principle of
induction (or the induction axiom) states. In fact, dominoes are a wonderful analogy: we have a domino for
each proposition P(k). The dominoes are lined up so that if the k th domino is knocked over, then it in turn
knocks over the k + 1st . Knocking over the kth domino corresponds to proving P(k) is true. So the induction
step corresponds to the fact that the k th domino knocks over the k + 1st domino. Now, if we knock over the
first domino (the one numbered 0), then this sets off a chain reaction that knocks down all the dominoes.
k+1
(k + 1)(k + 2)
• Inductive Step: We must show P(k + 1). That is, ∑i= 2
:
i=0
k+1 k
∑ i = ( ∑ i) + (k + 1)
i=0 i=0
k(k + 1)
= + (k + 1) (by the inductive hypothesis)
2
k
= (k + 1)( + 1)
2
(k + 1)(k + 2)
= .
2
We will now look at another proof by induction, but first we will introduce some notation and a definition
for divisibility. We say that integer a divides b (or b is divisible by a), written as a|b, if and only if for some
integer q, b = aq.
Theorem: ∀n ∈ N, n3 − n is divisible by 3.
Proof (by induction over n):
• Base Case: P(0) asserts that 3|(03 − 0) or 3|0, which is clearly true (since 0 = 3 · 0).
• Inductive Step: We must show that P(n + 1) is true, which asserts that 3|((n + 1) 3 − (n + 1)). Let us
expand this out:
(n + 1)3 − (n + 1) = n3 + 3n2 + 3n + 1 − (n + 1)
= (n3 − n) + 3n2 + 3n
= 3q + 3(n2 + n), q ∈ Z (by the inductive hypothesis)
2
= 3(q + n + n)
The next example we will look at is an inequality between two functions of n. Such inequalities are useful
in computer science when showing that one algorithm is more efficient than another. Notice that for this
example, we have chosen as our base case n = 2, which is natural because the claim we are aiming to prove
holds for all natural numbers greater than or equal to 2. If you think about the underlying induction principle,
• Base Case: P(2) asserts that 2! < 22 , or 2 < 4, which is clearly true.
• Inductive Hypothesis: Assume P(n) is true (i.e., n! < n n ).
• Inductive Step: We must show P(n + 1), which states that (n + 1)! < (n + 1) n+1 . Let us begin with
the left side of the inequality:
(n + 1)! = (n + 1) · n!
< (n + 1) · nn (by the inductive hypothesis)
n
< (n + 1) · (n + 1)
= (n + 1)n+1
In the middle of the last century, a colloquial expression in common use was ”that is a horse of a different
color”, referring to something that is quite different from normal or common expectation. The famous
mathematician George Polya (who was also a great expositor of mathematics for the lay public) gave the
following proof to show that there is no horse of a different color!
Theorem: All horses are the same color.
Proof (by induction on the number of horses):
• Base Case: P(1) is certainly true, since with just one horse, all horses have the same color.
• Inductive Hypothesis: Assume P(n), which is the statement that n horses all have the same color.
• Inductive Step: Given a set of n + 1 horses {h 1 , h2 , . . . , hn+1 }, we can exclude the last horse in the set
and apply the inductive hypothesis just to the first n horses {h 1 , . . . , hn }, deducing that they all have
the same color. Similarly, we can conclude that the last n horses {h 2 , . . . , hn+1 } all have the same
color. But now the “middle” horses {h 2 , . . . , hn } (i.e., all but the first and the last) belong to both of
these sets, so they have the same color as horse h 1 and horse hn+1 . It follows, therefore, that all n + 1
horses have the same color. Thus, by the principle of induction, all horses have the same color. ♠
Clearly, it is not true that all horses are of the same color, so where did we go wrong in our induction
proof? It is tempting to blame the induction hypothesis. But even though the induction hypothesis is false
(for n ≥ 2), that is not the flaw in the reasoning! Before reading on, think about this and see if you can
understand why, and figure out the real flaw in the proof.
What makes the flaw in this proof a little tricky to pinpoint is that the induction step is valid for a “typical”
value of n, say, n = 3. The flaw, however, is in the induction step when n = 1. In this case, for n + 1 = 2
horses, there are no “middle” horses, and so the argument completely breaks down!
1 Alternatively,we could insist on making the base case n = 0 (which holds vacuously here because 0 > 1 is false). Then we
would assert that P(0) =⇒ P(1), since P(1) holds (vacuously again), and that P(1) =⇒ P(2) since P(2) holds (as we show in the
base case below). Then we would proceed as in the inductive step of the proof below. But this is all rather tedious.
Two Color Theorem: There is a famous theorem called the four color theorem. It states that any map can
be colored with four colors such that any two adjacent countries (which share a border, but not just a point)
must have different colors. The four color theorem is very difficult to prove, and several bogus proofs were
claimed since the problem was first posed in 1852. It was not until 1976 that the theorem was finally proved
(with the aid of a computer) by Appel and Haken. (For an interesting history of the problem, and a state-of-
the-art proof, which is nonetheless still very challenging, see www.math.gatech.edu/∼thomas/FC/fourcolor.html).
We consider a simpler scenario, where we divide the plane into regions by drawing straight lines. We want
to know if we can color this map using no more than two colors (say, red and blue) such that no two regions
that share a boundary have the same color. Here is an example of a two-colored map:
We will prove this “two color theorem” by induction on n, the number of lines:
• Base Case: Prove that P(0) is true, which is the proposition that a map with n = 0 lines can be can be
colored using no more than two colors. But this is easy, since we can just color the entire plane using
one color.
• Inductive Hypothesis: Assume P(n). That is, a map with n lines can be two-colored.
• Inductive Step: Prove P(n + 1). We are given a map with n + 1 lines and wish to show that it can be
two-colored. Let’s see what happens if we remove a line. With only n lines on the plane, we know
we can two-color the map (by the inductive hypothesis). Let us make the following observation: if
we swap red ↔ blue, we still have a two-coloring. With this in mind, let us place back the line we
removed, and leave colors on one side of the line unchanged. On the other side of the line, swap red
↔ blue. We claim that this is a valid two-coloring for the map with n + 1 lines.
• Inductive Hypothesis: Assume that the sum of the first n odd numbers is a perfect square, say k 2 .
• Inductive Step: The n + 1-th odd number is 2n + 1, so the sum of the first n + 1 odd numbers is
k2 + 2n + 1. But now we are stuck. Why should k 2 + 2n + 1 be a perfect square?
• Inductive Hypothesis: Assume that the sum of the first n odd numbers is n 2 .
• Inductive Step: The (n + 1)-th odd number is 2n + 1, so the sum of the first n + 1 odd numbers is
n2 + (2n + 1) = (n + 1)2 . Thus by the principle of induction the theorem holds. ♠
See if you can understand what happened here. We could not prove a proposition, so we proved a harder
proposition instead! Can you see why that can sometimes be easier when you are doing a proof by induction?
When you are trying to prove a stronger statement by induction, you have to show something harder in the
induction step, but you also get to assume something stronger in the induction hypothesis. Sometimes the
stronger assumption helps you reach just that much further...
Here is another example:
Imagine that we are given L-shaped tiles (i.e., a 2 × 2 square tile with a missing 1 × 1 square), and we want
to know if we can tile a 2n × 2n courtyard with a missing 1 × 1 square in the middle. Here is an example of
a successful tiling in the case that n = 2:
• Inductive Hypothesis: Assume P(n) is true. That is, we can tile a 2 n × 2n courtyard with a missing
1 × 1 square in the middle.
• Inductive Step: We want to show that we can tile a 2 n+1 ×2n+1 courtyard with a missing 1×1 square in
the middle. Let’s try to reduce this problem so we can apply our inductive hypothesis. A 2 n+1 × 2n+1
courtyard can be broken up into four smaller courtyards of size 2 n × 2n , each with a missing 1 × 1
square as follows:
But the holes are not in the middle of each 2 n × 2n courtyard, so the inductive hypothesis does not
help! How should we proceed? We should strengthen our inductive hypothesis!
What we are about to do is completely counter-intuitive. It’s like attempting to lift 100 pounds, failing, and
then saying “I couldn’t lift 100 pounds. Let me try to lift 200,” and then succeeding! Instead of proving that
we can tile a 2n × 2n courtyard with a hole in the middle, we will try to prove something stronger: that we
can tile the courtyard with the hole being anywhere we choose. It is a trade-off: we have to prove more, but
we also get to assume a stronger hypothesis. The base case is the same, so we will just work on the inductive
hypothesis and step.
• Inductive Hypothesis (second attempt): Assume P(n) is true, so that we can tile a 2 n × 2n courtyard
with a missing 1 × 1 square anywhere.
• Inductive Step (second attempt): As before, we can break up the 2 n+1 × 2n+1 courtyard as follows.
By placing the first tile as shown, we get four 2 n × 2n courtyards, each with a 1 × 1 hole; three of
these courtyards have the hole in one corner, while the fourth has the hole in a position determined by
the hole in the 2n+1 × 2n+1 courtyard. The stronger inductive hypothesis now applies to each of these
four courtyards, so that each of them can be successfully tiled. Thus, we have proven that we can tile
a 2n+1 × 2n+1 courtyard with a hole anywhere! Hence, by the induction principle, we have proved the
(stronger) theorem. ♠
• Inductive Hypothesis: Assume P(k) is true for 2 ≤ k ≤ n: i.e., every number k : 2 ≤ k ≤ n can be
written as a product of primes.
• Inductive Step: We must show that n + 1 can be written as a product of primes. We have two cases:
either n + 1 is a prime number, or it is not. For the first case, if n + 1 is a prime number, then we
are done. For the second case, if n + 1 is not a prime number, then by definition n + 1 = xy, where
x,y ∈ Z+ and 1 < x, y < n + 1. By the inductive hypothesis, x and y can each be written as a product
of primes (since x, y ≤ n). Therefore, n + 1 can also be written as a product of primes. ♠
Why does this proof fail if we were to use simple induction? If we only assume P(n) is true, then we cannot
apply our inductive hypothesis to x and y. For example, if we were trying to prove P(42), we might write
42 = 6 × 7, and then it is useful to know that P(6) and P(7) are true. However, with simple induction, we
could only assume P(41), i.e., that 41 can be written as a product of primes — a fact that is not useful in
establishing P(42).
Claim: If there exists a cycle in a tournament, then there exists a cycle of length 3.
Proof: Assume for a contradiction that the smallest cycle is:
with n > 3. Let us look at the game between p 1 and p3 . We have two cases: either p3 beats p1 , or p1 beats
p3 . In the first case (where p3 beats p1 ), then we are done because we have a 3-cycle. In the second case
(where p1 beats p3 ), we have a shorter cycle, and thus a contradiction. Therefore, if there exists a cycle,
then there must exist a 3-cycle as well. ♠
The well ordering principle is employed here to make our conclusion that there is a 3-cycle, since otherwise
there would be no minimal element among the natural numbers, as each step either produces a smaller cycle
or a 3-cycle.
We remark that the proof that square root of 2 is irrational also can be seen to employ the well ordering
principle. Why?
This admittedly simple model of population growth nevertheless illustrates a fundamental principle. Left
unchecked, populations grow exponentially over time. [Exercise: can you show, for example, that F(n) ≥
2(n−1)/2 for all n ≥ 3?] Understanding the significance of this unchecked exponential population growth was
a key step that led Darwin to formulate his theory of evolution. To quote Darwin: “There is no exception to
the rule that every organic being increases at so high a rate, that if not destroyed, the earth would soon be
covered by the progeny of a single pair.”
Be sure you understand that a recursive definition is not circular — even though in the above example F(n)
is defined in terms of the function F, there is a clear ordering which makes everything well-defined. Here is
a recursive program to evaluate F(n):
function F(n)
if n=0 then return 0
if n=1 then return 1
else return F(n-1) + F(n-2)
Can you figure out how long this program takes to compute F(n)? This is a very inefficient way to compute
the n-th Fibonacci number. A much faster way is to turn this into an iterative algorithm :
function F2 (n)
if n=0 then return 0
if n=1 then return 1
a = 1
b = 1
for k = 2 to n do
c = b
Can you show by induction that this new function F2 (n) = F(n)? How long does this program take to
compute F(n)?