32
Discrete Maths Objective to introduce mathematical induction through examples 242-213, Semester 2, 2014-2015 8. Mathematical Induction 1

Discrete Maths Objective to introduce mathematical induction through examples 242-213, Semester 2, 2014-2015 8. Mathematical Induction 1

Embed Size (px)

Citation preview

Discrete Maths

Discrete MathsObjectiveto introduce mathematical induction through examples 242-213, Semester 2, 2014-20158. Mathematical Induction1Overview1. Motivation2. Induction Defined3.Maths Notation Reminder4.Four Examples5.More General Induction Proofs6.Further Information21. MotivationInduction is used in mathematical proofs of recursive algorithmse.g. quicksort, binary search

Induction is used to mathematically define recursive data structurese.g. lists, trees, graphscontinued3Part 9Induction is often used to derive mathematical estimates of program running time timings based on the size of input datae.g. time increases linearly with the number of data items processed

timings based on the number of times a loop executes4Part 102. Induction DefinedInduction is used to solve problems such as:is S(n) correct/true for all n values?usually for all n >= 0 or all n >=1

Example:let S(n) be "n2 + 1 > 0"is S(n) true for all n >= 1?continuedS(n) can be muchmore complicated,such as a programthat reads in a nvalue.5How do we prove (disprove) S(n)?

One approach is to try every value of n:is S(1) true?is S(2) true?...is S(10,000) true?... forever!!!Not very practical6Induction to the RescueInduction is a technique for quickly proving S(n) true or false for all nwe only have to do two things

First show that S(1) is truedo that by calculation as beforecontinued7Second, assume that S(n) is true, and use it to show that S(n+1) is truemathematically, we show thatS(n) S(n+1)

Now we know S(n) is true for all n>=1.Why?continued" stands for "implies"8With S(1) and S(n) S(n+1)then S(2) is true S(1) S(2) when n == 1

With S(2) and S(n) S(n+1)then S(3) is true S(2) S(3) when n == 2

With S(3) and S(n) S(n+1)then S(4) is true S(3) S(4) when n == 3

and so on, for all n

9Lets do itProve S(n): "n2 + 1 > 0" for all n >= 1.

First task: show S(1) is trueS(1) == 12 + 1 == 2, which is > 0so S(1) is true

Second task: show S(n+1) is true by assuming S(n) is truecontinued10Assume S(n) is true, so n2+1 > 0Prove S(n+1)S(n+1) == (n+1)2 + 1== n2 + 2n + 1 +1== (n2 + 1) + 2n + 1since n2 + 1 > 0, then (n2 + 1) + 2n + 1 > 0so S(n+1) is true, by assuming S(n) is trueso S(n) S(n+1)continued11We have used induction to show two things:S(1) is trueS(n) S(n+1) is true

From these it follows that S(n) is true for all n >= 112Induction More FormallyThree pieces:1. A statement S(n) to be provedthe statement must be about an integer n

2. A basis for the proof. This is the statement S(b) for some integer. Often b = 0 or b = 1.continued133. An inductive step for the proof. We prove the statement S(n) S(n+1) for all n.

The statement S(n), used in this proof, is called the inductive hypothesis

We conclude that S(n) is true for all n >= bS(n) might not be true for some n < b143. Maths Notation ReminderSummation: means 1+2+3+4++n

e.g.means 4+9+16++m2

Product: means 1*2*3**n

154. Example 1Prove the statement S(n):for all n >= 1e.g. 1+2+3+4 = (4*5)/2 = 10

Basis. S(1), n = 1so 1 = (1*2)/2

continued(1)16Induction. Assume S(n) to be true.Prove S(n+1), which is:

Notice that:

(2)

(3)continued17Substitute the right hand side (rhs) of (1) for the first operand of (3), to give:

= (n2 + n + 2n + 2) /2= (n2+3n+2)/2

which is (2)

18Example 2Prove the statement S(n):for all n >= 0e.g. 1+2+4+8 = 16-1

Basis. S(0), n = 0so 20 = 21 -1

continued(1)19Induction. Assume S(n) to be true.Prove S(n+1), which is:

Notice that:

(2)

(3)continued20Substitute the right hand side (rhs) of (1) for the first operand of (3), to give:

= 2*(2n+1) - 1which is (2)

+121Example 3Prove the statement S(n): n! >= 2n-1for all n >= 1e.g. 5! >= 24, which is 120 >= 16

Basis. S(1), n = 1:1! >= 20so 1 >= 1

continued(1)22Induction. Assume S(n) to be true.Prove S(n+1), which is:(n+1)! >= 2(n+1)-1 >= 2n(2)

Notice that:(n+1)! = n! * (n+1)(3)continued23Substitute the right hand side (rhs) of (1) for the first operand of (3), to give:(n+1)! >= 2n-1 * (n+1)

>= 2n-1 * 2since (n+1) >= 2

(n+1)! >= 2nwhich is (2)why?24Example 4Prove the statement S(n):for all n >= 1This proof can be used to show that. the limit of the sum:is 1

Basis. S(1), n = 1so 1/2 = 1/2

continued(1)

25Induction. Assume S(n) to be true.Prove S(n+1), which is:

Notice that:

(2)

(3)continued26Substitute the right hand side (rhs) of (1) for the first operand of (3), to give:

=

which is (2)

275. More General Inductive ProofsThere can be more than one basis case.

We can do a complete induction (or strong induction) where the proof of S(n+1) may use any of S(b), S(b+1), , S(n)b is the lowest basis value28ExampleWe claim that every integer >= 24 can be written as 5a+7b for non-negative integers a and b.note that some integers < 24 cannot be expressed this way (e.g. 16, 23).

Let S(n) be the statement (for n >= 24)n = 5a + 7b, for a >= 0 and b >= 0continued29Basis. The 5 basis cases are 24 through 28.24 = (5*2) + (7*2)25 = (5*5) + (7*0)26 = (5*1) + (7*3)27 = (5*4) + (7*1)28 = (5*0) + (7*4)continued30Induction: Let n+1 >= 29. Then n-4 >= 24, the lowest basis case.Thus S(n-4) is true, and we can write n - 4 = 5a + 7b

Thus, n+1 = 5(a+1) + 7b, proving S(n+1)31Induction uses S(n-4) S(n+1)6. Further InformationDiscrete Mathematics and its ApplicationsKenneth H. RosenMcGraw Hill, 2007, 7th editionchapter 5, section 5.132