slides

advertisement
CSE 20
DISCRETE MATH
Prof. Shachar Lovett
http://cseweb.ucsd.edu/classes/wi15/cse20-a/
Clicker
frequency:
CA
Todays topics
• Strong induction
• Section 3.6.1 in Jenkyns, Stephenson
Strong vs regular induction
• Goal is the same: prove ∀𝑛 ≥ 1, 𝑃(𝑛)
• Standard induction:
• Base case: n=1
• From one step to the next: ∀𝑛 ≥ 1, 𝑃 𝑛 → 𝑃(𝑛 + 1)
• Strong induction:
• Base case: n=1
• Assume more in each step: ∀𝑛 ≥ 1, 𝑃 1 ∧ ⋯ ∧ 𝑃 𝑛
→ 𝑃(𝑛 + 1)
Strong vs regular induction
• Goal is the same: prove ∀𝑛 ≥ 1, 𝑃(𝑛)
• Standard induction:
• Base case: n=1
• From one step to the next: ∀𝑛 ≥ 1, 𝑃 𝑛 → 𝑃(𝑛 + 1)
P(1)
P(2)
P(3)
…
P(n)
P(n+1)
…
• Strong induction:
• Base case: n=1
• Assume more in each step: ∀𝑛 ≥ 1, 𝑃 1 ∧ ⋯ ∧ 𝑃 𝑛
P(1)
P(2)
P(3)
…
P(n)
→ 𝑃(𝑛 + 1)
P(n+1)
…
5
Example for the power of strong induction
• Theorem: For all prices p >= 8 cents, the price p can
be paid using only 5-cent and 3-cent coins
• Proof:
• Base cases: 8=3+5, 9=3+3+3, 10=5+5
• Assume it holds for all prices 8...p-1, prove for price p when 𝑝 ≥ 11
• Proof: since 𝑝 − 3 ≥ 8 we can use the inductive hypothesis for p-3.
To get price p simply add another 3-cent coin.
• Much easier than standard induction!
Another example: divisibility
• Thm: For all integers n>1, n is divisible by a prime
number.
• Before proving it (using strong induction), lets first review
some of the basic definitions, but now make them precise
Definitions and properties for this proof
• Definitions:
• n is prime if ∀𝑎, 𝑏 ∈ 𝑁, 𝑛 = 𝑎𝑏 → (𝑎 = 1 ∨ 𝑏 = 1)
• n is composite if n=ab for some 1<a,b<n
• Prime or Composite exclusivity:
• All integers greater than 1 are either prime or composite (exclusive
or—can’t be both).
• Definition of divisible:
• n is divisible by d iff n = dk for some integer k.
• 2 is prime (you may assume this; it also follows from the
definition).
Definitions and properties for this proof
(cont.)
• Goes without saying at this point:
• The set of Integers is closed under addition and
multiplication
• Use algebra as needed
Thm: For all integers n>1, n is divisible by a prime number.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = ________.
Inductive step:
Assume [or “Suppose”] that
WTS that
So the inductive step holds, completing the proof.
Thm: For all integers n>1, n is divisible by a prime number.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = ________.
Inductive step:
Assume [or “Suppose”] that
WTS that
A.
B.
C.
D.
E.
So the inductive step holds, completing the proof.
0
1
2
3
Other/none/more
than one
Thm: For all integers n>1, n is divisible by a prime number.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = _2______.
Inductive step:
Assume [or “Suppose”] that
WTS that
A. For some integer n>1, n is
divisible by a prime number.
B. For some integer n>1, k is
divisible by a prime number, for
all integers k where 2kn.
C. Other/none/more than one
So the inductive step holds, completing the proof.
Thm: For all integers n>1, n is divisible by a prime number.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = _2______.
Inductive step:
Assume [or “Suppose”] that for some integer n>1, k is divisible by a prime number
for all integers k where 𝟐 ≤ 𝒌 ≤ 𝒏
WTS that
A. n+1 is divisible by a prime
number.
B. k+1 is divisible by a prime
number.
C. Other/none/more than one
So the inductive step holds, completing the proof.
13
Thm: For all integers n>1, n is divisible by a prime number.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n=2.
Inductive step:
Assume that for some n2, all integers 2kn are divisible by a prime.
WTS that n+1 is divisible by a prime.
Proof by cases:
• Case 1: n+1 is prime. n+1 divides itself so we are done.
• Case 2: n+1 is composite. Then n+1=ab with 1<a,b<n+1. By the
induction hypothesis, since an there exists a prime p which
divides a. So p|a and a|n+1. We’ve already seen that this
Implies that p|n+1 (in exam – give full details!)
So the inductive step holds, completing the proof.
Theorems about recursive definitions
• Consider the following sequence:
• d1=9/10
• d2=10/11
• dn=dn-1 * dn-2 ∀𝑛 ≥ 3
• Theorem: ∀𝑛 ≥ 1, 0 < 𝑑𝑛 < 1
• Facts the we will need for the proof:
• If 0<x,y<1 then 0<xy<1
• Algebra, etc
Definition of the sequence:
d1 = 9/10
d2 = 10/11
dk = (dk-1)(dk-2) for all integers k3
Thm: For all integers n>0, 0<dn<1.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = ________.
Inductive step:
Assume [or “Suppose”] that
WTS that
So the inductive step holds, completing the proof.
Definition of the sequence:
d1 = 9/10
d2 = 10/11
dk = (dk-1)(dk-2) for all integers k3
Thm: For all integers n>0, 0<dn<1.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = ________. A. 0
Inductive step:
Assume [or “Suppose”] that
WTS that
So the inductive step holds, completing the proof.
B.
C.
D.
E.
1
2
3
Other/none/more
than one
Definition of the sequence:
d1 = 9/10
d2 = 10/11
dk = (dk-1)(dk-2) for all integers k3
Thm: For all integers n>0, 0<dn<1.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = _1,2_____.
Inductive step:
Assume [or “Suppose”] that
WTS that
A. For some int n>0, 0<dn<1.
B. For some int n>1, 0<dk<1, for all
integers k where 1kn.
C. Other/none/more than one
So the inductive step holds, completing the proof.
Definition of the sequence:
d1 = 9/10
d2 = 10/11
dk = (dk-1)(dk-2) for all integers k3
Thm: For all integers n>0, 0<dn<1.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n = _1,2_____.
Inductive step:
Assume [or “Suppose”] that
WTS that
A. For some int n>0, 0<dn<1.
B. For some int n>1, 0<dk<1, for all
integers k where 1kn.
C. 0<dn+1<1
D. Other/none/more than one
So the inductive step holds, completing the proof.
Definition of the sequence:
d1 = 9/10
d2 = 10/11
dk = (dk-1)(dk-2) for all integers k3
Thm: For all integers n>0, 0<dn<1.
Proof (by strong mathematical induction):
Basis step: Show the theorem holds for n=1,2.
Inductive step:
Assume [or “Suppose”] that the theorem holds for n2.
WTS that 0<dn+1<1.
By definition, dn+1=dn dn-1.
By the inductive hypothesis, 0<dn-1<1 and 0<dn<1.
Hence, 0<dn+1<1.
So the inductive step holds, completing the proof.
Fibonacci numbers
• 1,1,2,3,5,8,13,21,…
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• Question: can we derive an expression for the n-th term?
Fibonacci numbers
• 1,1,2,3,5,8,13,21,…
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• Question: can we derive an expression for the n-th term?
• YES!
1
1+ 5
𝐹𝑛 =
2
5
𝑛
1
1− 5
−
2
5
𝑛
22
Fibonacci numbers
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• We will prove an upper bound:
𝐹𝑛 ≤
𝑟𝑛,
• Proof by strong induction.
1+ 5
𝑟=
2
23
Fibonacci numbers
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• We will prove an upper bound:
𝐹𝑛 ≤
1+ 5
𝑟=
2
𝑟𝑛,
• Proof by strong induction.
• Base case:
A.
B.
C.
D.
E.
n=1
n=2
n=1 and n=2
n=1 and n=2 and n=3
Other
24
Fibonacci numbers
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• We will prove an upper bound:
𝐹𝑛 ≤
1+ 5
𝑟=
2
𝑟𝑛,
• Proof by strong induction.
• Base case:
A.
B.
C.
D.
E.
n=1
n=2
n=1 and n=2
n=1 and n=2 and n=3
Other
25
Fibonacci numbers
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• We will prove an upper bound:
𝐹𝑛 ≤
𝑟𝑛,
1+ 5
𝑟=
2
• Proof by strong induction.
• Base case: n=1,2
• Verify by direct calculation: 𝐹1 = 1 ≤ 𝑟, 𝐹2 = 1 ≤ 𝑟 2
26
Fibonacci numbers
• Rule: F1=1, F2=1, Fn=Fn-2+Fn-1.
• We will prove an upper bound:
𝐹𝑛 ≤
𝑟𝑛,
1+ 5
𝑟=
2
• Proof by strong induction.
• Base case: n=1,2
• Inductive case: show…
A.
B.
C.
D.
E.
Fn=Fn-1+Fn-2
FnFn-1+Fn-2
Fn=rn
Fn rn
Other
Proof of inductive case
• WTS: 𝐹𝑛 ≤ 𝑟 𝑛
• What can we use?
• Definition: 𝐹𝑛 = 𝐹𝑛−1 + 𝐹𝑛−2
• Inductive assumption: 𝐹𝑘 ≤ 𝑟 𝑘 ∀𝑘 < 𝑛
• So, we know that 𝐹𝑛 ≤ 𝑟 𝑛−1 + 𝑟 𝑛−2
• Need to show that 𝑟 𝑛−1 + 𝑟 𝑛−2 ≤ 𝑟 𝑛
Proof of inductive case (contd)
• Need to show that 𝑟 𝑛−1 + 𝑟 𝑛−2 ≤ 𝑟 𝑛
• Equivalently: r + 1 ≤ 𝑟 2
• It turns out that this is satisfied by our choice of 𝑟 =
• In fact, it is a root of the quadratic 𝑥 2 − 𝑥 − 1 = 0
(so in fact r + 1 = 𝑟 2 )
• The other root is
1− 5
2
1
; recall the formula
1+ 5
𝐹𝑛 =
2
5
•
𝑛
1
1− 5
−
2
5
𝑛
1+ 5
2
29
Fibonacci numbers - recap
• Recursive definition of a sequence
• Base case: verify for n=1, n=2
• Inductive step:
• Formulated what needed to be shown as an algebraic inequality,
using the definition of Fn and the inductive hypothesis
• Simplified algebraic inequality
• Proved the simplified version
Next class
• Applying proof techniques to analyze algorithms
• Read section 3.7 in Jenkyns, Stephenson
Download