chapter 5: sequences, mathematic induction, and recursion · chapter 5: sequences, mathematic...

62
Chapter 5: Sequences, Mathematic Induction, and Recursion Hao Zheng Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 October 21, 2014 Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected]. Chapter 5: Sequences, Mathematic Induction, and Recursion October 21, 2014 1 / 52

Upload: vocong

Post on 19-Jul-2018

248 views

Category:

Documents


3 download

TRANSCRIPT

Chapter 5: Sequences, MathematicInduction, and Recursion

Hao Zheng

Department of Computer Science and EngineeringUniversity of South Florida

Tampa, FL 33620Email: [email protected]: (813)974-4757Fax: (813)974-5456

October 21, 2014

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 1 / 52

5.1 Sequences

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 2 / 52

Definitions

A sequence is a function whose domain is either all integersbetween two given integers or all the integers greater than orequal to a given integer.

• Example: how many ancestors does a person have?

Position in the row 1 2 3 4 5 6 7 . . .Number of ancestors 2 4 8 16 32 64 128 . . .

• The pattern: Ak = 2k.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 3 / 52

Definitions

A sequence is a function whose domain is either all integersbetween two given integers or all the integers greater than orequal to a given integer.

• Example: how many ancestors does a person have?

Position in the row 1 2 3 4 5 6 7 . . .Number of ancestors 2 4 8 16 32 64 128 . . .

• The pattern: Ak = 2k.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 3 / 52

Definitions (cont’d)

• A sequence is a set of elements written in a row

am, am+1, . . . , an

where each element ak is called a term, and k is called a indexof ak.

• am is the initial term, and an is the final term.• The final term exists only for a finite sequence.

• am, am+1, . . . is an infinite sequence.• “. . .” is called an ellipsis, shorthand for “and so forth”.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 4 / 52

Definitions (cont’d)

An explicit formula or general formula for a sequence is a rulethat shows how the values of ak depends on k.

Examples

• Show the sequences for the following formulas.

ak =k

k + 1for all integers k ≥ 1

bi =i− 1

ifor all integers i ≥ 2

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 5 / 52

Definitions (cont’d)

An explicit formula or general formula for a sequence is a rulethat shows how the values of ak depends on k.

Examples

• Find the formula for the following sequence.

1, −1

4,1

9, − 1

16,1

25, − 1

36, . . .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 5 / 52

Summation Notation

Question How many total ancestors does a person have for the mostrecent five generations?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 6 / 52

Recursive Summation Notation

If m is any integer, then

n∑k=m

ak =

(n−1∑k=m

ak

)+ an

When solving problems, it is often useful to rewrite a sum-mation using the recursive form of the definition, either byseparating off the final term of a summation or by adding afinal term to a summation.

Examplesn+1∑i=1

1

i2=

n∑i=1

1

i2+

1

(n+ 1)2

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 7 / 52

Summation: Exercise

• Compute the following:3∑

k=1

k3

4∑i=2

i(i+ 1)

5∑n=1

(1

n− 1

n+ 1

)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 8 / 52

Summation: Exercise

Change the expanded form to summation notation.

1

n+

2

n+ 1+

3

n+ 2+ . . .+

n+ 1

2n

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 9 / 52

Product Notation

• Recursive definition

n∏k=m

ak =

(n−1∏k=m

ak

)· an

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 10 / 52

Exercise: Compute the following products3∏

k=1

k2

4∏k=2

1− 1

k

4∏i=2

i

i+ 1

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 11 / 52

Properties of Summations and Products

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 12 / 52

Exercise: Simplify the following expressions

n∑k=m

(1− 1

k

)+ 2 ·

n∑k=m

1

k

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 13 / 52

Exercise: Simplify the following expressions

n∏k=m

(k + 1) ·n∏

k=m

(k − 1)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 13 / 52

Exercise: Simplify the following expressions

n−1∑i=1

1

i+

1

n

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 13 / 52

Change of Variable

• Observe that3∑

k=1

k2 =3∑

j=1

j2

• The symbol used to represent the index of a summation orproduct can be replaced by any other symbol as long as thereplacement is made in each location where the symbol occurs.

Example transform the following summation by making thespecified change of variable.

6∑k=0

1

k + 1, change of variable : j = k + 1

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 14 / 52

Change of Variable: Exercise

Transform the summation by the change defined by j = k − 1.

n+1∑k=1

(k + 1)2

n− k + 2

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 15 / 52

Change of Variable: Exercise

Simplify the following summation.

n−1∑k=0

(2k − 1) +n∑

k=1

(4− 5k)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 15 / 52

Factorial

• Recursive definition

n! =

{1 if n = 0n · (n− 1)! if n ≥ 1

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 16 / 52

Exercise: Compute the following Factorials

8!

7!

((n+ 1)!)2

(n!)2

n!

(n− 3)!

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 17 / 52

n Choose r(nr

)DefinitionLet n and r be integers with 0 ≤ r ≤ n. The symbol(

n

r

)is read “n choose r” and represents the number of subsets of size rthat can be chosen from a set of n elements.

Formula for computing(nr

)For all integers n and r with 0 ≤ r ≤ n,(

n

r

)=

n!

r!(n− r)!

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 18 / 52

n Choose r(nr

): Examples(

3

2

)

(4

4

)

(n+ 1

n

)

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 19 / 52

Sequences in Computer Programming

Recall the following algorithms for computing quotients andreminders based on quotient-remainder theorem.

Input: a ≥ 0 and d > 0

Algorithmr := a, q := 0while(r ≥ d)

r := r − dq := q + 1

end

Output: q and r

Output:Index 1 2 . . .

Quotient q1 q2 . . .Remainder r1 r2 . . .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 20 / 52

Sequences in Computer Programming

Recall the following algorithms for computing quotients andreminders based on quotient-remainder theorem.

Input: a ≥ 0 and d > 0

Algorithmr := a, q := 0while(r ≥ d)

r := r − dq := q + 1

end

Output: q and r

Output:Index 1 2 . . .

Quotient q1 q2 . . .Remainder r1 r2 . . .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 20 / 52

5.2 & 5.3 Mathematical Induction

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 21 / 52

Observe the Following

A certain store sells envelopes in packages of five and packages oftwelve.

• Can this store sell you exactly 44 envelopes?

• Can this store sell you exactly 45 envelopes?

• Can this store sell you exactly 46 envelopes?

• Can this store sell you exactly 47 envelopes?

• Can this store sell you exactly 48 envelopes?

• Can this store sell you any number of envelops in a similar way?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 22 / 52

How to Solve it?

• A certain store sells envelopes in packages of five and packagesof twelve. Prove that for every n ≥ 44 this store can sell youexactly n envelopes (assuming an unlimited supply of each typeof envelope package), i.e.

n = 5p+ 12q for some positive integersp, q.

Note that p ≥ 7 or q ≥ 2 for the above equation.

• Hint: suppose it is possible to buy exactly k envelopes at thisstore, where k ≥ 44, can you show that the store can also fill anorder for k + 1 envelopes?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 23 / 52

Principle of Mathematical Induction

In general, mathematical induction is a method for proving that aproperty defined for integers n is true for all values of n that aregreater than or equal to some initial integer.

Mathematical Induction is taken as an axiom.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 24 / 52

Principle of Mathematical Induction

P (a)

P (k)→ P (k + 1)

∴ ∀k ≥ a, P (k)

In general, mathematical induction is a method for proving that aproperty defined for integers n is true for all values of n that aregreater than or equal to some initial integer.

Mathematical Induction is taken as an axiom.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 24 / 52

Proof by Mathematical Induction

To prove “For all integers n ≥ a, a property P (n) is true”, do thefollowing two steps:

Step 1 (Basis step) show that the P (a) is true.

Step 2 (Inductive step) show that for all integers k ≥ a, ifP (k) is true then P (k + 1) is also true. To perform thisstep,

Suppose that P (k) is true for p.b.a.c k ≥ a.[This supposition is called the inductive hypothesis.]

Then,

show that P (k + 1) is true.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 25 / 52

Theorem 5.2.2 Sum of the First n Integers

For all integers n ≥ 1,

1 + 2 + . . .+ n =n(n+ 1)

2.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 26 / 52

Proof by Mathematical Induction: Exercise

For all integer n ≥ 44, n = 5p+ 12q for some integers p and q.

Proof:

See slide 51 for detailed proof.Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 27 / 52

Sum of a Geometric Sequence

• In a geometric sequence, each term is obtained from thepreceding one by multiplying by a constant factor.

• If the first term is 1 and the constant factor is r, then thesequence is 1, r, r2, r3, . . . , rn, . . .

• Example: evaluate the following sequences

1 + 3 + 32 + . . .+ 3m−2

32 + 33 + . . .+ 3m

Theorem 5.2.3For any real number r 6= 1, and any integer n ≥ 0,

n∑i=0

ri =rn+1 − 1

r − 1.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 28 / 52

Theorem 5.2.3For any real number r 6= 1, and any integer n ≥ 0,

n∑i=0

ri =rn+1 − 1

r − 1.

Proof:

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 29 / 52

Proving Equality

Consider the following proof for the basis step.

0∑i=0

ri =r0+1 − 1

r − 1

r0 =r − 1

r − 1

1 = 1

Is it correct?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 30 / 52

Deducing the Sum of a Geometric Sequence

LetSn = 1 + r + r2 + . . .+ rn.

ThenrSn = r + r2 + r3 + . . .+ rn+1.

Therefore,

rSn − Sn = (r + r2 + r3 + . . .+ rn+1)− (1 + r + r2 + . . .+ rn)= rn+1 − 1.

But the above equation can be transformed to

rSn − Sn = rn+1 − 1Sn(r − 1) = rn+1 − 1.

Finally,

Sn =rn+1 − 1

r − 1.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 31 / 52

Deduction and Induction

• Deduction and induction are the same in some sense.• Deduction: infer conclusion from general principles and known

facts by logical reasoning.• Induction: prove a general principle after observing it to hold

for a large number of elements.

• Inductive reasoning is used when generating hypotheses,formulating theories and discovering relationships from specificinstances• The derived hypotheses and relations need to be proved by

induction to become mathematical certainty.• An essential tool in studying natural sciences and scientific

discovery.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 32 / 52

Inductive Reasoning: Example

Observe that

1− 1

2=

1

2

(1− 1

2)(1− 1

3) =

1

3

(1− 1

2)(1− 1

3)(1− 1

4) =

1

4

By inductive reasoning, a more general principle can be discovered.

(1− 1

2)(1− 1

3) · · · (1− 1

k) =

1

k

However, the above conjecture needs to be proved by mathematicalinduction to become a certainty.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 33 / 52

∀n ≥ 2,n∏

k=2

(1− 1

k) =

1

n

Proof:

See slide 52 for detailed proof.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 34 / 52

Proposition 5.3.1

For all integers n ≥ 0, 22n − 1 is divisible by 3.

Proof:

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 35 / 52

For any integer x = d0d1 . . . dn where di ∈ {0, 1, 2, . . . , 9}, ifn∑

k=0

dk = 3p for some integer p, 3|x.

Proof:

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 36 / 52

Proposition 5.3.2For all integers n ≥ 3, 2n+ 1 < 2n.

Proof:

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 37 / 52

5.6 Defining Sequences Recursively

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 38 / 52

Defining Sequences

• A sequence can be defined in a variety of different ways.

• One informal way is to write the first few terms with theexpectation that the general pattern will be obvious.

• Consider 3, 5, 7, . . .. Unfortunately, misunderstandings can occurwhen this approach is used.

• The next term of the sequence could be 9 if we mean a sequenceof odd integers, or it could be 11 if we mean the sequence ofprime numbers.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 39 / 52

Defining Sequences

The second way to define a sequence is to give an explicit formula forits nth term. For example, a sequence a0, a1, a2, . . . can be specifiedby writing

an =(−1)n

n+ 1for all integers n ≥ 0.

The advantage of defining a sequence by such an explicit formula isthat each term of the sequence is uniquely determined and can becomputed in a fixed, finite number of steps, by substitution.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 40 / 52

The Fibonacci Numbers

In 1202 European Mathematician Fibonacci posed the followingproblem:

• A single pair of rabbits (male and female) is born at thebeginning of a year.

1 Rabbit pairs are not fertile during their first month of life butthereafter give birth to one new male/female pair at the end ofevery month.

2 No rabbits die.

• How many rabbit pairs will there be at the end of the year?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 41 / 52

Definition

A recurrence relation for a sequence a0, a1, a2, . . . is a formula thatrelates every ak to certain of its predecessors ak−1, ak−2, . . . , ak−iwhere i is an integer with k − i ≥ 0. The initial conditions for sucha recurrence relation specify the values of a0, . . . , ai−1, if i is a fixedinteger, or a0, a1, . . . , am, where m is an integer with m ≥ 0, if idepends on k.

• Consider the following sequence. Find the recurrencerelation/initial condition.

1, 3, 9, 27, 81, . . .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 42 / 52

Definition

A recurrence relation for a sequence a0, a1, a2, . . . is a formula thatrelates every ak to certain of its predecessors ak−1, ak−2, . . . , ak−iwhere i is an integer with k − i ≥ 0. The initial conditions for sucha recurrence relation specify the values of a0, . . . , ai−1, if i is a fixedinteger, or a0, a1, . . . , am, where m is an integer with m ≥ 0, if idepends on k.

• The same recurrence relation with different initial conditionsrepresents different sequences.

ak+1 = 3ak for all k ≥ 0 and a0 = 2

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 42 / 52

Example 5.6.7: Compound Interests

You have three friends, Mike, Jennifer, and Sally. Each one has$10, 000 to invest for 5 years.

• Mike places his money on deposit 4% simple interest annually.

• Jennifer places her money on deposit 4% interest compoundedannually.

• Sally left her money on deposit at 4% annual interest rate butcompounded quarterly.

• What are the amounts in the accounts at the end of the 5thyear?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 43 / 52

Example 5.6.6 The Fibonacci Numbers

In 1202 European Mathematician Fibonacci posed the followingproblem:

• A single pair of rabbits (male and female) is born at thebeginning of a year.

1 Rabbit pairs are not fertile during their first month of life butthereafter give birth to one new male/female pair at the end ofevery month.

2 No rabbits die.

• How many rabbit pairs will there be at the end of the year?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 44 / 52

Recurrence Definitions of Sum and Product

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 45 / 52

5.7 Solving Recurrence Relations byIteration

• Find an explicit formula which is called a solution.

Method of IterationGiven a sequence a0, a1, a2, . . . defined by a recurrence relationand initial conditions, you start from the initial conditions andcalculate successive terms of the sequence until you see a patterndeveloping.

At that point you guess an explicit formula.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 46 / 52

Example 5.3.3

Define a sequence a1, a2, . . . as follows.

a1 = 2ak = 5ak−1 for all integers k ≥ 2.

Find the explicit formula for this sequence.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 47 / 52

Definition

• A sequence a0, a1, a2, . . . is called an arithmetic sequence if,and only if, there is an constant d such that

ak = ak−1 + d for all integer k ≥ 1

or, equivalently

an = a0 + dn for all integer n ≥ 0

• A sequence a0, a1, a2, . . . is called an geometric sequence if,and only if, there is an constant r such that

ak = ak−1 · r for all integer k ≥ 1

or, equivalently

an = a0 · rn for all integer n ≥ 0

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 48 / 52

Exercise

• Find the explicit formula for the recursively defined sequence:

pk = pk−1 + 3k−1, for k ≥ 2

andp1 = 1

• How do you check the correctness of the derived formula?

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 49 / 52

Appendix

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 50 / 52

For all integer n ≥ 44, n = 5p+ 12q for some integers p and q.

Proof: Notice that p ≥ 7 ∨ q ≥ 2. Also, let P (n) denoten = 5p+ 12q for n ≥ 44.

Basis step it is easy to show that P (44) holds for p = 4 ∧ q = 2.continued. . .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 51 / 52

For all integer n ≥ 44, n = 5p+ 12q for some integers p and q.

Proof:Inductive step Suppose that P (n) holds for some k ≥ 44. We

need to show that P (n+ 1) also holds. Since p ≥ 7 ∨ q ≥ 2, theproof is divided into two cases.

• Case 1 Consider p ≥ 7. Suppose k = 5p+ 12q for someintegers p ≥ 7 and q.

k + 1 = 5p+ 12q + 1= 5(p′ + 7) + 12q + 1= 5p′ + 12q + 35 + 1= 5p′ + 12q + 12 · 3= 5p′ + 12(q + 3)

Therefore, P (n+ 1) holds for p′ = p− 7 and q′ = q + 3.

• Case 2 Consider q ≥ 2. The proof can be done similarly, andnot shown.

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 51 / 52

∀n ≥ 2,n∏

k=2

(1− 1

k) =

1

n

Proof: Let P (n) ben∏

k=2

(1− 1

k) =

1

n.

Basis step When n = 2,n∏

k=2

(1− 1

k) = 1− 1

2=

1

2.1

n=

1

2.

Therefore, P (n) holds true when n = 2.continued. . .

Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 52 / 52

∀n ≥ 2,n∏

k=2

(1− 1

k) =

1

n

Proof:

Inductive step Suppose that P (n) :n∏

k=2

(1− 1

k) =

1

nholds for

some n ≥ 2. We need to show that P (n+ 1) also holds.

n+1∏k=2

(1− 1

k) = (

n∏k=2

(1− 1

k))(1− 1

n+ 1)

=1

n(1− 1

n+ 1)

=1

n

n

n+ 1

=1

n+ 1

�Hao Zheng ( Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: [email protected] Phone: (813)974-4757 Fax: (813)974-5456 )Chapter 5: Sequences, Mathematic Induction, and RecursionOctober 21, 2014 52 / 52