Proof By Induction

Transcription

Proof By Induction
Proof By Induction
Proof by Induction is a very powerful tool when used correctly.
Visual: The Domino Argument
Think of a row of dominos.
If set up properly, when the ith
domino falls, so too will the i + 1st
domino for all values of i.
Therefore, when the first domino
is knocked over so too are all the
dominos.
We use it to prove a statement S(n) is true for all natural
numbers n larger than b where b is a natural number.
Note: The natural numbers, denoted N, are the “counting numbers” *:
0, 1, 2, 3, . . . , i, i + 1, i + 2, . . .
*In computer science we usually include 0 in N.
1
Inductive Proof Structure
There are three steps to an inductive proof that:
for all n ≥ b where n ∈ N, S (n ) is true.
1. Base Case: Prove that S(·) holds for a “smallest” value b.
2. Inductive Hypothesis: Assume that S(k) holds for an arbitrary value larger than b, i.e., k ≥ b, k ∈ N.
3. Inductive Step: Derive that S(k + 1) is true from the fact
that S(k) holds.
Conclusion. For all natural numbers n > b, S(n) holds.
Q. How does each step relate to our domino analogy?
A.
•
•
2
Example
Prove that ∀n ∈ N, n(n2 + 5) is divisible by 6.
Define P (n):
Let P (n) be
∃m ∈ N, n(n2 + 5) = 6m
Prove ∀n ∈ N, P (n) by simple induction.
Base Case. X n = 0. Let m = 0, then 0 = 0 · 6.
Inductive Hypothesis. Let k ∈ N. Suppose P (k).
Inductive Step. Prove that if P (k) is true then P (k + 1) is true.
=
=
=
=
=
(k + 1)((k + 1)2 + 5)
(k + 1)(k2 + 2k + 1 + 5)
(k2 + 2k + 6) + k(k2 + 2k + 1 + 5)
(k2 + 2k + 6 + 2k2 + k) + k(k2 + 5)
(3k2 + 3k + 6) + k(k2 + 5)
3k(k + 1) + 6 + k(k2 + 5)
Notice that the first term is divisble by 6 since it is a multiple
of 3 and further either k or (k + 1) is even, or divisible by
2. The second term is divisible by 6 and by the induction
hypothesis, so is the third term.
3
Let’s prove the commonly used summation formula. Let S(n)
refer to the statement:
0 + 1 + 2 + · · · + (n − 1) + n =
n(n + 1)
.
2
We will prove that for all n ∈ N, S(n) holds.
Proof by Induction.
Base Case. Let’s show that n = 0 holds:
Induction Hypothesis.
Induction Step. Prove that S(k + 1) holds.
4
Stamp Example – Simple Induction
Given an unlimited supply of 4-cent and
7-cent stamps, prove that there exists
a combination of stamps to make any
amount of postage that is 18-cents or
more.
Define P (n), what we are proving:
In English: If n ≥ 18, then postage of exactly n cents can be
made using only 4-cent and 7-cent stamp.
Formally: n ≥ 18 → ∃a ∈ N, ∃b ∈ N, n = 4a + 7b
RTP: ∀n ∈ N, P (n).
Steps
1. Base Case:
P (0): This is vacuously true as 0 ≥ 18 is false.
Use: 1x 4-cent stamp, 2x 7-cent stamp
Therefore, P (0) is true.
2. Inductive Hypothesis (IH)
Let k ∈ N, suppose P (k).
i.e., for each k, if k ≥ 18 then there exists i, j ∈ N such that
i represents the number of 4 cent stamps and j represents
the number of 7 cent stamps and k = 4i + 7j
5
4. Inductive Step (IS): RTP if P (k) holds then P (k + 1)
holds.
I.e., that there exist a ∈ N and b ∈ N such that:
4a + 7b = k + 1
Case I k + 1 = 18
We need to prove this directly (why?). 18 = 1 · 4 + 2 · 7
so pick a = 1 and b = 2.
Case II k + 1 > 18
Case a j > 0
Since k + 1 > 18, k ≥ 18 and P (k) holds by the
IH, ∃i, j ∈ N such that
k = 4i + 7j
k + 1 = 4i + 7j + 8 − 7
= 4i + 7j + 2 · 4 − 1 · 7
= 4(i + 2) + (j − 1) · 7
Therefore, take a = i + 2 and b = j − 1. This is
okay because j > 0.
Case b j = 0, Then take away some 4-cent stamps
and add some 7 cent stamps. Since k ≥ 18, i ≥ 5,
we can take away 5 4-cent stamps without having
”negative” stamps. Also, notice that 3 · 7 − 4 · 5 = 1.
By IH, k = 4i for i ≥ 5.
k + 1 = 4i + 1 = 4i + 21 − 20
= 4i + 3 · 7 − 4 · 5 = 4(i − 5) + 3 · 7
Therefore, take a = (i − 5) and b = 3.
6
Rigorous Proof of Why Induction Works
Contradiction Argument
Needs:
The Well Ordering Principle
Any non-empty subset C of N contains a smallest element.
We say that C is well ordered.
1 2 3 4 5 6 7 8 9 10 . . . i − 1 i i+1 i+2 . . . n − 1 n n+1 . . .
Suppose C = {3, 7, 9, 10, i, n, . . .} then 3 is the smallest element.
Assume that we have done the 3 steps of an inductive proof properly. For simplicity assume that we are proving that S(n) is true
for all natural numbers n.
1. Proved that S(x) is true for all values x ∈ B.
2. Suppose that S(k) is true, d < k < n, k ∈ N where d =
max(B).
3. Proved that S(n) is true.
7
Proof that Induction Proofs are valid
Construct a contradiction.
• Assume that ∃z ∈ N, S(z) is not true.
• Let C = {x | S(x) is false and x ∈ N} be the set of all
such values.
This is where the Well Ordering Principle comes into play.
• By the Well Ordering Principle there exists a smallest element of C.
• Let a be the smallest element in C.
• By the Base Case and our initial assumption, it must be
that a > d.
• Since a is the smallest value such that S(a) is false, it must
be that S(a − 1) is true.
• But by our Inductive Step, if S(a − 1) is true, then S(a) is
true.
• Therefore a ∈
/ C, contradiction.
Therefore, our assumption must be false, and S(n) holds for all
n ∈ N.
8
Mmmmm....CHOCOLATE!
Suppose we have a chocolate bar
consisting of a number of squares
arranged in a rectangular pattern.
The task is to split the bar into
small squares with a minimum
number of breaks.
Q: How many breaks will it take (assume we only break along
the lines)?
Make an educated guess, and prove it by induction.
Dimensions
1x1
1x2
2x2
3x2
4x3
Breaks
0
1
3
5
11
Formula:
l × w chocolate bar needs
9
Proof By Induction
Prove that an l × w chocolate bar needs
Define S(n): If n ≥ 1 then a chocolate bar with n squares
requires n − 1 breaks.
Prove that ∀n ∈ N where n ≥ 1, S(n) is true. The symbol ∀
means “for all”.
Steps:
Base Case:
S(1). 1 × 1 requires 0 = 1-1 breaks as we had shown on the
previous slide. Therefore the Base Case holds.
Inductive Hypothesis:
Suppose that we know that up to a specified size of chocolate
bar, our claim holds.
Let n ∈ N. Suppose that all chocolate bars with less than n
squares satisfy our claim.
Q: How can we express this mathematically?
Let n ∈ N. Suppose ∀k ∈ N such that 0 < k < n, that S(k)
holds.
10
Proof Continued
Inductive Step: Prove S(n)
Break the bar into two smaller pieces of a and b squares where
a, b < n and a + b =n.
Since a < n, b < n the IH applies and S(a) and S(b) hold. What
does it mean for S(a) to hold? takes a − 1 breaks to split this
part of the bar up.
We used one break to split the bar into the smaller pieces so the
total number of breaks is
(a − 1) + (b − 1) + 1 = (a + b) − 1 = n − 1
Done.
11
Strong or Complete Induction
Idea. Recall the domino argument. To show that P (a) is true,
we can show that:
P (0)∧(P (0) → P (1))∧(P (1) → P (2))∧. . .∧(P (a−1) → P (a))
What we’ve really done, is show that
(P (0) ∧ P (1) ∧ P (2) ∧ . . . P (a − 1)) → P (a)
So to show ∀n ∈ N, P (n), we can show:
((P (0) ∧ P (1) ∧ P (2) ∧ . . . P (a − 1)) → P (a)) → ∀nP (n)
12
Stamp Example – Strong
Induction
Given an unlimited supply of 4-cent and
7-cent stamps, prove that there exists
a combination of stamps to make any
amount of postage that is 18-cents or
more.
Proof by strong induction:
Define P(n):
Let P (n) be, if n ≥ 18 → ∃a ∈ N, ∃b ∈ N, n = 4a + 7b.
RTP: ∀n ∈ N, P (n).
Q: What is our proof strategy?
Want to be able to prove P (n) simply be looking back at the
value (n − 4).
Base Case: With strong induction we typically include the base
case in the induction step.
Inductive Hypthesis:
Let m ∈ N, suppose P (k) is true for all k < m, k ∈ N.
13
Inductive Step: Prove that P (n) is true.
Case 1 n < 18. Why is this true?
Case 2 n ≥ 18. What is our strategy?
Want P (n − 4) to be true, because then we can just add
on a 4-cent stamp. This only works if m ≥ 22 and we know
P (18), P (19), P (20) and P (21) hold.
Case 2a 18 ≤ n ≤ 21.
18
19
20
21
=
=
=
=
1·4+2·7
3·4+1·7
5·4
3·7
Case 2b n ≥ 22. Check, we need (n − 4) ≥ 18. n ≥ 22
and n − 4 ≥ 18 so P (n − 4) holds and by the inductive
hypothesis there exists a,b such that 4a + 7b = n − 4,
so m = 4(a + 1) + 7b.
14