Professional Documents
Culture Documents
CS 104
Rosen section 3.3
Rabbia Mahum
1
What is induction?
A method of proof
Three parts:
Base case(s): show it is true
for one element
Inductive hypothesis: assume
it is true for any given element
Must be clearly labeled!!!
Show that if it true for the next
highest element
2
Induction example
Show that the sum of the first n odd
integers is n2
Example: If n = 5, 1+3+5+7+9 = 25 = 52
n
Formally, Show n P(n) where P(n)
2i 1 n 2
i 1
1 1
3
Induction example, continued
Inductive hypothesis: assume true for k
Thus, we assume that P(k) is true, or that
k
2i
i 1
1 k 2
2i
i 1
1 ( k 1) 2
4
Induction example, continued
k
Recall the inductive hypothesis: 2i 1 k 2
i 1
2i
i 1
1 ( k 1) 2
k
2(k 1) 1 2i 1 k 2 2k 1
i 1
2(k 1) 1 k 2 k 2 2k 1
k 2 2k 1 k 2 2k 1
5
What did we show
Base case: P(1)
If P(k) was true, then P(k+1) is true
i.e., P(k) → P(k+1)
7
Second induction example
Rosen, section 3.3, question 2:
Show the sum of the first n positive even
integers is n2 + n
Rephrased: n
n P( n) where P( n) 2i n n
2
i 1
8
Second induction example,
continued
Base case: Show P(1): 1
P(1) 2(i ) 12 1
i 1
2 2
9
Second induction example,
continued
Recall our inductive
k
P(k ) 2i k 2 k
i 1
hypothesis:
k 1
2i
i 1
( k 1) 2
k 1
k
2(k 1) 2i (k 1) 2 k 1
i 1
2(k 1) k 2 k (k 1) 2 k 1
k 2 3k 2 k 2 3k 2
10
Notes on proofs by induction
We manipulate the k+1 case to make part
of it look like the k case
We then replace that part with the other
side of the k case k
k 1 P(k ) 2i k 2 k
2i
i 1
( k 1) 2
k 1 i 1
k
2(k 1) 2i (k 1) 2 k 1
i 1
2(k 1) k 2 k (k 1) 2 k 1
k 2 3k 2 k 2 3k 2 11
Third induction example
Rosen, question 7: Show n
n(n 1)(2n 1)
i 1
2
i
6
Base case: n = 1 1
1(1 1)(2 1)
i 1
2
i
6
2 6
1
6
11
Inductive hypothesis: assume
k
k (k 1)(2k 1)
i 1
2
i
6
12
Third induction example
Inductive step: show k 1
(k 1)((k 1) 1)(2(k 1) 1)
i 1
i 2
6
k 1
(k 1)((k 1) 1)(2(k 1) 1)
i 1
2
i
6
k
(k 1)(k 2)(2k 3)
(k 1) i
2 2
i 1 6
2 k (k 1)(2k 1) (k 1)(k 2)(2k 3)
(k 1)
6 6
6(k 1) 2 k (k 1)(2k 1) (k 1)(k 2)(2k 3)
k
k (k 1)(2k 1)
2k 9k 13k 6 2k 9k 13k 6 i 2
3 2 3 2
i 1 6 13
Third induction again: what if your
inductive hypothesis was wrong?
Show: i 2 n(n 1)(2n 2)
n
i 1 6 1
1(1 1)(2 2)
Base case: n = 1:
i 2
i 1 6
2 7
1
6
7
1
6
But let’s continue anyway…
Inductive hypothesis: assume
k
k (k 1)(2k 2)
i 1
2
i
6 14
Third induction again: what if your
inductive hypothesis was wrong?
Inductive step: show k 1
(k 1)((k 1) 1)(2(k 1) 2)
i 1
2
i
6
k 1
(k 1)((k 1) 1)(2(k 1) 2)
i 1
2
i
6
k
( k 1)(k 2)(2k 4)
(k 1) i
2 2
i 1 6
2 k (k 1)(2k 2) (k 1)(k 2)(2k 4)
(k 1)
6 6
6(k 1) 2 k (k 1)(2k 2) (k 1)(k 2)(2k 4)
k
k (k 1)(2k 2)
2k 10k 14k 6 2k 10k 16k 8 i 2
3 2 3 2
i 1 6 15
Fourth induction example
Rosen, question 14: show that n! < nn for
all n > 1
Base case: n = 2
2! < 22
2<4
Inductive hypothesis: assume k! < kk
Inductive step: show that (k+1)! < (k+1)k+1
k k k 1
(k 1)! (k 1)k! (k 1)k (k 1)(k 1) (k 1)
16
Strong induction
Weak mathematical induction assumes
P(k) is true, and uses that (and only that!)
to show P(k+1) is true
17
Activity
18
Home Task
19