Download slides

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
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
Related documents