Post on 23-Jan-2016
description
1
Mathematical Induction.
• Induction is the most important proof method in computer science.
• Suppose you want to prove that the proposition P (n) is true for all n N, where N = {0, 1, 2, …} (an infinite set). ( i. e. every natural number n has some property P)
• You might be able to prove it for 0, 1, 2, … But you can’t checkone-by-one that all natural numbers have property P.
2
• The key idea of mathematical induction is start with 0 and repeatedly add 1.
• Suppose you can show that i) 0 has property P and ii) whenever you add 1 to a number that has property P the resulting number also has property P.
This guarantees that as you go through the list of all natural numbers, every number you encounter must have property P.
3
• The proof method of mathematical induction says that you just need to do two things: i) prove it for n = 0 (basis case) ii) prove “if it’s true for n=k, then it’s true for n =k+1”
Induction Hypothesis:• fix some k 0 • assume P (k)
Induction Step• Using assumption P (k) prove that P (k+1)
In this way we prove that for any n [P(n) P(n+1)]
4
Why does this prove it for all n N ?
Actually it relies upon the property of integers N={0, 1, 2, …}
The pattern is:
To prove n 0 (P (n)) it’s enough to show:1) (Base) P (0) 2) n 0 (P(n) P (n +1))
So, in the second step we say:“take some k 0 and assume that property P holds for n = k“(Induction Hypothesis).Then, (based upon this assumption) we need to show that the property P can be implied for n = k +1.
How can we prove n 0 (P(n) P (n +1)) ?
Pick arbitrary k 0 and prove it for n = k.
5
Suppose we want to prove the formula for the sum of ‘geometric progression’
q
qqqqq
nn
1
1...1
132
where 10 q , and n is any integer, n0
How can we prove that the formula is correct for any n0 ?
• Show it for arbitrary fixed n0• Use induction on n0
Notation:
n
i
inn qqqqS
0
2 ...1
q
qS
n
n
1
1 1
6
• Show it for some n01212 1)...1(... nnn
n qqqqqqqSq
nS
11 nnn qSSq
11)1( nn qqS
q
qS
n
n
1
1 1
7
• Proof by induction on n0
1) Base: n=0
;100
00
qqSi
i 11
1
1
1 10
q
q
q
q
2) Induction Hypothesis: Assume the formula is correct for n=k, where k is some integer, k0
q
qS
k
k
1
1 1
Induction Step: prove the formula for n=k+1, i. e. q
qS
k
k
1
1 1)1(
1
1121 ...1
kk
kkk qSqqqqS
q
q
q
qqq
q
k
kkk
kk
1
1
1
1
1
1
1)1(
1)1(11
11
8
There is a variant if you want to prove it for n n0 :
To prove n n0 (P (n)) it’s enough to show:1) (Base) P ( n0) 2) n n0 (P(n) P (n +1))
1) In the base case we explicitly check n = n0
2) Pick arbitrary k n0 and assume that the property P holds for n = k . (Induction Hypothesis) Based upon this assumption prove that the property P can be implied for n = k +1. (Induction Step)
9
Example. Prove that for all n1 n! 2n1.
Proof by induction on n1. 1). Basis: n =1. 1!=1=211=20. So, for the case n=1, we checked that n!2n1.2). Assume that for n=k, k is some integer k1, inequality holds, i. e. k! 2k1 (IH).We want to prove that n! 2n1 for n = k +1, i. e. we want to show that
(k+1)! 2(k+1)1 Using the definition of factorial we have (k+1)!= (k+1)k! (k+1)2k1 ……by IH
(1+1)2k1 ……because k1 = 2 2k1 = 2k……QED, because 2(k+1)1= 2k
By Induction Principle we conclude that n! 2n1 for all n1
10
Induction proof for the summation formula
Let’s prove the formula for the sum of integers from 1 to n:
n 0
2
)1(...3210
nnn
P (n)
Alternative notation for the LHS: ni
n
i
ii00
or
Thus we want to prove: n 0 2
)1(
0
nni
n
i
11
Let’s stop for a moment and check that the formula we are to prove makes sense:
n 0 2
)1(
0
nni
n
i
Consider a few particular cases:• n =1
• n = 0
2
)11(110...210
0
nin
i
2
)10(00...210
0
nin
i
12
In accordance with induction pattern: 1) (Base) P (0) 2) n 0 (P(n) P (n +1))
P (n) here is the predicate:
n
i
nni
0 2
)1(
Prove: n 0
• (Base)
• (Inductive step) n 0
n
i
nni
0 2
)1(
0
0 2
)10(0
i
i
n
i
n
i
nni
nni
0
1
0 2
)2)(1(
2
)1(
P (n) P (n+1)
13
1) Basis: check that the formula is correct for the case of no terms
2) fix some k 0 and assume that proposition holds for n = k
k
i
kki
0 2
)1( P(n=k) (induction hypothesis, IH)
1
0 2
)2)(1(k
i
kkiShow that the P(n=k+1): can be implied (IS)
2
)2)(1(1
2)1(
)1(2
)1(
)1(
)1(...210
0
1
0
kkkk
kkk
ki
kki
k
i
k
i
……..by IH
….algebra
14
Why induction proofs work? Intuitively, because we can reach any number n if we start withthe smallest one and add 1 step-by-step. So, induction principle express this obvious fact.
Induction Principle . If A is a subset of N that satisfies twoproperties:
1) 0A 2) n 0 [n A(n+1)A],
then A =N
More formally, induction principle is formulated in terms of a set A = {n N | P (n)}
15
Although it sounds very obvious, the induction principle hinges on the property of integers, so called Well-Ordering principle (accept it as an axiom).
Well-Ordering Principle. Any nonempty subset of N contains a smallest element.
Neither rational, no real numbers has this property!
Induction principle is equivalent to the Well-ordering principle.
16
Theorem. Well-ordering principle(WOP) implies Induction Principle(IP)
Proof. Suppose WOP is true, i.e. any nonempty subset of N contains a smallest element. We want to prove that IP is true, i. e. if any set A satisfies properties
i) 0Aii) n 0 [nA(n+1)A],
then A =N.We are going to prove it by contradiction. 1) Assume that A satisfies both properties, but A N . 2) Then N A = B , i. e. B is nonempty subset of N .3) By WOP B contains the smallest element. Let denote it s, s B, so sA. 4) Since s is the smallest element of B, s1B. 5) Since 0A by i), 0B, so s >0 and s1 0, i. e. s1N.6) s1N and s1B imply s1A .7) By ii) s1A sA , contradiction with sA.
17
n
012
.
.
.
i) 0A
A = {n N | P(n)}
ii) n 0 [nA(n+1)A]
B = N A
Proof by contradiction:Assume that A N.
s 1 A, since s is the smallest
B
s A by ii)
sB, since B = N A
sB (by WOP)
in contradiction with sB
18
Example. Prove that the number of different binary strings of length n is 2n.
Proof by induction on n1.We want to prove: n1 [P (n)], where P (n): the number of binary strings of length n is 2n.
1) Basis. n=1. We have two strings of the length one: 0 and 1.
2) Assume P (n) for n=k, where k is some integer, k 1 (IH).
So, we assume that for some k 1 there are 2k binary strings.
In the IS we need to prove P (n) for n=k+1
I. e. we need to show that there are 2(k+1) binary stringsof the length (k +1).
19
Here is the proof that there are 2(k+1) binary strings of length (k+1).
Any binary string of length (k+1) can be represented as a binarystring of length k with one extra bit (let it be the last one). There are two choices for the last bit: 0 or 1.
By IH there are 2k strings of length k. Then, we have 2k strings of length (k+1) that end with 0 and 2k strings of length (k+1) that end with 1, so the total number is 2k + 2k =2 2k =2(k+1)
QED.
By IP we conclude, that for any n 1 the number of binary strings is 2n.
20
Let’s use the induction to prove the following known fact.
Example. Prove that for any set A cardinality of a power set is |Power(A)|=2|A|.To apply induction we need to chose the integer variable.Here we can prove by induction on n = |A|. So, we want to prove that the propositionP= |Power(A)|=2|A| is true for any n=|A| 0.
1) Basis: n=|A|=0, A= , There is only one subset of the empty set, so |Power()|=1=2
2) IH: Assume that for n=k, k is any integer k 0, we have that any set A with |A|=k has 2k subsets. IS: we need to imply that any set B with cardinality |B|=k+1 has the property P, i. e. has 2(k+1) subsets.
21
Here we need to do the job…Take any set B of k+1 elements. Pick any element x. Then all subsets of B can be divided into two parts:
i) subsets that do not contain x. How many such subsetsexist? We can argue, that subsets of B that do not contain x constitute subsets of the set B {x}, that has cardinality k. |B{x}|=k and by IH there exist 2k subsets.
ii) subsets that include x. How many such subsets exist?Again, the number of such subsets equals the number of Subsets of the set B {x}, this number is 2k. Now, the total number of subsets is the sum of two groups, 2k + 2k =2 2k= 2k+1. So, from assumption that the proposition is true for n=k ( k is any integer k 0) we can imply that the proposition is true for n =k+1.By Induction principle we conclude that the proposition is true for all integer n 0, i. e. for sets of any size |A|=n.