Induction: (Chapter 4.2-4.4 of The Book and Chapter 3.3-3.6 of The Notes)
Induction: (Chapter 4.2-4.4 of The Book and Chapter 3.3-3.6 of The Notes)
– mathematical induction.
• An interesting example
• A paradox
Odd Powers Are Odd
• Let n be an integer.
Idea of induction.
Idea of Induction
Objective: Prove
This is to prove
mN. P (m)
For any n>=0
• An interesting example
• A paradox
Proof by Induction
Let’s prove:
r 1.
r 1.
Proof by Induction
Induction Step: Assume P(n) for some n 0 and prove P(n + 1):
r ( n+1)1 1
r 1. 1 r r 2 r n+1
r 1
n 1
r 1
1 r r r
2 n
r 1
How do we proceed?
Proof by Induction
r n 1 1 n 1
1 r n r n+1 r
r 1
r n 1 1 r n 1 (r 1)
r 1
r ( n+1) 1 1
r 1
But since r 1 was arbitrary, we conclude (by UG), that
r ( n+1)1 1
r 1. 1 r r 2 r n+1
r 1
which is P (n+1). This completes the induction proof.
Proving an Equality
Let P(n) be the induction hypothesis that the statement is true for n.
by induction
Proving a Property
Induction Step: Assume P(i) for some i 1 and prove P(i + 1):
Induction Step: Assume P(i) for some i 2 and prove P(i + 1):
Assume is divisible by 6
Prove is divisible by 6.
Divisible by 6 Divisible by 2
by induction by case analysis
Proving an Inequality
Induction Step: Assume P(i) for some i 3 and prove P(i + 1):
Assume , prove
by induction
since i >= 3
Proving an Inequality
Induction Step: Assume P(i) for some i 2 and prove P(i + 1):
by induction
This Lecture
• An interesting example
• A paradox
Puzzle
Goal: tile the squares, except one in the middle for Bill.
n
2
n
2
Puzzle
For example, for 8 x 8 puzzle might tile for Bill this way:
Puzzle
Theorem: For any 2n x 2n puzzle, there is a tiling with Bill in the middle.
n
2 Now
2 n+1 what??
Puzzle
Theorem: For any 2n x 2n puzzle, there is a tiling with Bill in the middle.
Puzzle
Induction step:
Assume we can get Bill anywhere in 2n x 2n.
Prove we can get Bill anywhere in 2n+1 x 2n+1.
Puzzle
Induction step:
Assume we can get Bill anywhere in 2n x 2n.
Prove we can get Bill anywhere in 2n+1 x 2n+1.
n
2
n
2
Puzzle
Done!
Some Remarks
Can you find an ordering of all the n-bit strings in such a way that
two consecutive n-bit strings differed by only one bit?
2 bit 3 bit
4 bit
3 bit 3 bit (reversed)
0 000
000 100 0 001
001 101 0 011 differed by 1 bit
011 111 0 010 by induction
010 110 0 110
110 010 0 111
111 011 0 101
101 001 0 100 differed by 1 bit
100 000 1 100 by construction
1 101
1 111
1 110
Every 4-bit string appears exactly once. 1 010 differed by 1 bit
1 011 by induction
1 001
1 000
Gray Code
n+1 bit
n bit n bit (reversed)
0 000…0
000…0 100…0 0…
… … 0… differed by 1 bit
… … 0… by induction
… … 0…
… … 0…
… … 0…
… … 0 100…0 differed by 1 bit
100…0 000…0 1 100…0 by construction
1…
1…
Every (n+1)-bit string appears exactly once. 1…
1… differed by 1 bit
1… by induction
So, by induction, 1…
Gray code exists for any n. 1 000…0
Hadamard Matrix (Optional)
Can you construct an nxn matrix with all entries +-1 and
all the rows are orthogonal to each other?
1 1
1 -1
Hadamard Matrix (Optional)
Hn Hn
Check this!
Hn -Hn
- codes
- graphs
- matrices
- circuits
- algorithms
- designs
- proofs
- buildings
-…
This Lecture
• An interesting example
• A paradox
Paradox
…
Paradox
(Inductive case)
Assume any n horses have the same color.
Prove that any n+1 horses have the same color.
…
n+1
Paradox
(Inductive case)
Assume any n horses have the same color.
Prove that any n+1 horses have the same color.
(Inductive case)
Assume any n horses have the same color.
Prove that any n+1 horses have the same color.
What is wrong? n =1
• proving equality
• proving inequality
• proving property
In the next lecture we will see more applications and more techniques.
This Lecture
• Strong induction
• Invariant Method
Unstacking Game
• Scoring: ab points
a+b a b
Unstacking Game
n n-1 1
Unstacking Game
n (n - 1)
Claim: Starting with size n stack, final score will be
2
Proof: by Induction with Claim(n) as hypothesis
Base case n = 0:
0(0 1)
score = 0
2
Claim(0) is okay.
Unstacking Game
(n 1)n
(n+1)-stack score =
2
score = 0 1(1 1)
2
C(1) is okay.
Unstacking Game
by induction:
a-stack score =
a (a - 1)
2
b-stack score = b (b 1)
2
Unstacking Game
a (a 1) b (b 1)
ab
2 2
(a b )((a b ) 1) (n 1)n
2 2
Conclude n.P(n)
Ordinary induction
0 1, 1 2, 2 3, …, n-1 n.
The point is: assuming P(0), P(1), up to P(n), it is often easier to prove P(n+1).
Divisibility by a Prime
Theorem. Any integer n > 1 is divisible by a prime number.
• Let n be an integer.
Remember this slide?
• If n is a prime number, then we are done.
Now we can prove it
• Otherwise, n = ab, both are smaller than n.
by strong induction
• If a or b is a prime number, then we are done.
very easily. In fact
• Otherwise, a = cd, both are smaller than a.
we can prove a
• If c or d is a prime number, then we are done.
stronger theorem
• Otherwise, repeat this argument, since the numbers are
very easily. getting smaller and smaller, this will eventually stop and
we have found a prime factor of n.
Idea of induction.
Prime Products
…So
is a prime product.
Available stamps:
5¢ 3¢
(0 +8)¢:
cases:
n +1= 1, 9¢:
n +1= 2, 10¢:
Postage by Strong Induction
case n +1 3: let m =n 2.
+ = (n +1)+8
• Strong induction
• Invariant Method
Well Ordering Principle
Thm: 2 is irrational
m
Proof: suppose 2
n
…can always find such m, n without common factors…
why always?
m
By WOP, minimum |m| s.t. 2 .
n
m0
so 2 where |m0| is minimum.
n0
Well Ordering Principle
m0 / c
2
n0 / c
C ::= {n | ¬P(n)}
2. Assume C is not empty.
Fermat’s theorem
Non-Fermat’s theorem
On the other hand, we prove that every solution must have a,b,c even.