Chapter 5: Sequences, Mathematic Induction, and Recursion

Similar documents
Chapter 8: Recursion. March 10, 2008

Definition: A sequence is a function from a subset of the integers (usually either the set

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

Discrete Structures Lecture Sequences and Summations

Recurrence Relations

Sequences and Series. College Algebra

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Sec$on Summary. Sequences. Recurrence Relations. Summations. Ex: Geometric Progression, Arithmetic Progression. Ex: Fibonacci Sequence

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional)

Discrete Mathematics. Spring 2017

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

CSCE 222 Discrete Structures for Computing. Dr. Hyunyoung Lee

Every subset of {1, 2,...,n 1} can be extended to a subset of {1, 2, 3,...,n} by either adding or not adding the element n.

Page references correspond to locations of Extra Examples icons in the textbook.

Problem Set 5 Solutions

Math Circle: Recursion and Induction

Ex. Here's another one. We want to prove that the sum of the cubes of the first n natural numbers is. n = n 2 (n+1) 2 /4.

MATH10040: Numbers and Functions Homework 1: Solutions

With Question/Answer Animations

EECS 1028 M: Discrete Mathematics for Engineers

12 Sequences and Recurrences

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

3.3 Accumulation Sequences

Mathematics 228(Q1), Assignment 2 Solutions

1 Sequences and Summation

Outline. We will cover (over the next few weeks) Induction Strong Induction Constructive Induction Structural Induction

8. Sequences, Series, and Probability 8.1. SEQUENCES AND SERIES

CSC 344 Algorithms and Complexity. Proof by Mathematical Induction

Chapter12. Relations, Functions, and Induction

Climbing an Infinite Ladder

Sequences A sequence is a function, where the domain is a set of consecutive positive integers beginning with 1.

5. Sequences & Recursion

Announcements. CS243: Discrete Structures. Sequences, Summations, and Cardinality of Infinite Sets. More on Midterm. Midterm.

Infinite Series. Copyright Cengage Learning. All rights reserved.

Fall 2017 Test II review problems

Basic Proof Examples

Induction and Recursion

Climbing an Infinite Ladder

{ 0! = 1 n! = n(n 1)!, n 1. n! =

Lecture Notes: Mathematical/Discrete Structures

Sequences and Series. Copyright Cengage Learning. All rights reserved.

16. . Proceeding similarly, we get a 2 = 52 1 = , a 3 = 53 1 = and a 4 = 54 1 = 125

Solutions to Assignment 1

Discrete Structures - CM0246 Mathematical Induction

Sequences and the Binomial Theorem

Induction and recursion. Chapter 5

Recurrence Relations and Recursion: MATH 180

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

Mathematical Induction

Introduction to Induction (LAMC, 10/14/07)

Propositional Logic, Predicates, and Equivalence

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

MAT115A-21 COMPLETE LECTURE NOTES

n f(k) k=1 means to evaluate the function f(k) at k = 1, 2,..., n and add up the results. In other words: n f(k) = f(1) + f(2) f(n). 1 = 2n 2.

We want to show P (n) is true for all integers

Conjectures and proof. Book page 24-30

Section Summary. Definition of a Function.

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

MEETING 9 - INDUCTION AND RECURSION

C241 Homework Assignment 7

Advanced Counting Techniques. Chapter 8

2017 Year 10 General Mathematics Topic 4: Number Patterns and Recursion

9.1 SEQUENCES AND SERIES

Sequences. 1. Number sequences. 2. Arithmetic sequences. Consider the illustrated pattern of circles:

MATH10040: Chapter 0 Mathematics, Logic and Reasoning

General Mathematics Topic 4: Number Patterns and Recursion

Introduction to Series and Sequences Math 121 Calculus II Spring 2015

INFINITE SEQUENCES AND SERIES

1 Recursive Algorithms

Examples of Finite Sequences (finite terms) Examples of Infinite Sequences (infinite terms)

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

Name Advanced Math Functions & Statistics. Non- Graphing Calculator Section A. B. C.

Chapter 8. Sequences, Series, and Probability. Selected Applications

Chapter 11 - Sequences and Series

Discrete Mathematics. Spring 2017

The given pattern continues. Write down the nth term of the sequence {an} suggested by the pattern. 3) 4, 10, 16, 22, 28,... 3)

COM S 330 Lecture Notes Week of Feb 9 13

Induction. Induction. Induction. Induction. Induction. Induction 2/22/2018

Discrete Mathematics

Chapter 4 ARITHMETIC AND GEOMETRIC PROGRESSIONS 2, 5, 8, 11, 14,..., 101

Lecture 3 - Tuesday July 5th

Sequences and Summations. CS/APMA 202 Rosen section 3.2 Aaron Bloomfield

INDUCTION AND RECURSION. Lecture 7 - Ch. 4

Sequences and Summations ICS 6D. Prof. Sandy Irani

The following techniques for methods of proofs are discussed in our text: - Vacuous proof - Trivial proof

Chapter 8 Sequences, Series, and Probability

JUST THE MATHS SLIDES NUMBER 2.1. SERIES 1 (Elementary progressions and series) A.J.Hobson

Mathematical Induction. Section 5.1

Complete Induction and the Well- Ordering Principle

Discrete Math, Spring Solutions to Problems V

Hence, the sequence of triangular numbers is given by., the. n th square number, is the sum of the first. S n

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

Exercises for Discrete Maths

ARITHMETIC PROGRESSIONS

What can you prove by induction?

Divisibility of Natural Numbers

PRINCIPLE OF MATHEMATICAL INDUCTION

Algorithms: Background

Ready To Go On? Skills Intervention 12-1 Introduction to Sequences

Transcription:

Chapter 5: Sequences, Mathematic Induction, and Recursion Hao Zheng Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu Phone: (813)974-4757 Fax: (813)974-5456 October 21, 2014 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 1 / 52

5.1 Sequences Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 2 / 52

Definitions A sequence is a function whose domain is either all integers between two given integers or all the integers greater than or equal 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... ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 3 / 52

Definitions A sequence is a function whose domain is either all integers between two given integers or all the integers greater than or equal 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: A k = 2 k. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 3 / 52

Definitions (cont d) A sequence is a set of elements written in a row a m, a m+1,..., a n where each element a k is called a term, and k is called a index of a k. a m is the initial term, and a n is the final term. The final term exists only for a finite sequence. a m, a m+1,... is an infinite sequence.... is called an ellipsis, shorthand for and so forth. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 4 / 52

Definitions (cont d) An explicit formula or general formula for a sequence is a rule that shows how the values of a k depends on k. Examples Show the sequences for the following formulas. a k = k k + 1 for all integers k 1 b i = i 1 i for all integers i 2 ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 5 / 52

Definitions (cont d) An explicit formula or general formula for a sequence is a rule that shows how the values of a k depends on k. Examples Find the formula for the following sequence. 1, 1 4, 1 9, 1 16, 1 25, 1 36,... ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 5 / 52

Summation Notation Question How many total ancestors does a person have for the most recent five generations? Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 6 / 52

Recursive Summation Notation If m is any integer, then n a k = k=m ( n 1 k=m a k ) + a n When solving problems, it is often useful to rewrite a summation using the recursive form of the definition, either by separating off the final term of a summation or by adding a final term to a summation. Examples n+1 i=1 1 i 2 = n i=1 1 i + 1 2 (n + 1) 2 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 7 / 52

Summation: Exercise Compute the following: 3 5 n=1 k=1 k 3 4 i(i + 1) i=2 ( 1 n 1 ) n + 1 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 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 Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 3362021, Email: 2014zheng@cse.usf. 9 / 52

Product Notation Recursive definition n a k = k=m ( n 1 k=m a k ) a n Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 10 / 52

Exercise: Compute the following products 3 k=1 k 2 4 1 1 k k=2 4 i=2 i i + 1 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 11 / 52

Properties of Summations and Products Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 12 / 52

Exercise: Simplify the following expressions n k=m ( 1 1 ) + 2 k n k=m 1 k Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 13 / 52

Exercise: Simplify the following expressions n n (k + 1) (k 1) k=m k=m Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 13 / 52

Exercise: Simplify the following expressions n 1 i=1 1 i + 1 n Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 13 / 52

Change of Variable Observe that 3 k 2 = k=1 The symbol used to represent the index of a summation or product can be replaced by any other symbol as long as the replacement is made in each location where the symbol occurs. Example transform the following summation by making the specified change of variable. 6 k=0 3 j=1 1, change of variable : j = k + 1 k + 1 j 2 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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 Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 15 / 52

Change of Variable: Exercise Simplify the following summation. n 1 n (2k 1) + (4 5k) k=0 k=1 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 15 / 52

Factorial Recursive definition n! = { 1 if n = 0 n (n 1)! if n 1 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 16 / 52

Exercise: Compute the following Factorials 8! 7! ((n + 1)!) 2 (n!) 2 n! (n 3)! Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 17 / 52

n Choose r ( ) n r Definition Let 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 r that can be chosen from a set of n elements. Formula for computing ( ) n r For all integers n and r with 0 r n, ( ) n n! = r r!(n r)! ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 18 / 52

n Choose r ( n r) : Examples ( ) 3 2 ( ) 4 4 ( ) n + 1 n Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 19 / 52

Sequences in Computer Programming Recall the following algorithms for computing quotients and reminders based on quotient-remainder theorem. Input: a 0 and d > 0 Algorithm r := a, q := 0 while(r d) r := r d q := q + 1 end Output: q and r ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 20 / 52

Sequences in Computer Programming Recall the following algorithms for computing quotients and reminders based on quotient-remainder theorem. Output: Input: a 0 and d > 0 Algorithm r := a, q := 0 while(r d) r := r d q := q + 1 end Output: q and r Index 1 2... Quotient q 1 q 2... Remainder r 1 r 2... ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 20 / 52

5.2 & 5.3 Mathematical Induction Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 21 / 52

Observe the Following A certain store sells envelopes in packages of five and packages of twelve. 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 Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 22 / 52

How to Solve it? A certain store sells envelopes in packages of five and packages of twelve. Prove that for every n 44 this store can sell you exactly n envelopes (assuming an unlimited supply of each type of 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 this store, where k 44, can you show that the store can also fill an order for k + 1 envelopes? Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 23 / 52

Principle of Mathematical Induction In general, mathematical induction is a method for proving that a property defined for integers n is true for all values of n that are greater than or equal to some initial integer. Mathematical Induction is taken as an axiom. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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 a property defined for integers n is true for all values of n that are greater than or equal to some initial integer. Mathematical Induction is taken as an axiom. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 24 / 52

Proof by Mathematical Induction To prove For all integers n a, a property P (n) is true, do the following two steps: Step 1 (Basis step) show that the P (a) is true. Step 2 (Inductive step) show that for all integers k a, if P (k) is true then P (k + 1) is also true. To perform this step, 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. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 25 / 52

Theorem 5.2.2 Sum of the First n Integers For all integers n 1, 1 + 2 +... + n = n(n + 1). 2 ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 27 / 52

Sum of a Geometric Sequence In a geometric sequence, each term is obtained from the preceding one by multiplying by a constant factor. If the first term is 1 and the constant factor is r, then the sequence is 1, r, r 2, r 3,..., r n,... Example: evaluate the following sequences 1 + 3 + 3 2 +... + 3 m 2 3 2 + 3 3 +... + 3 m Theorem 5.2.3 For any real number r 1, and any integer n 0, n i=0 r i = rn+1 1 r 1. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 28 / 52

Theorem 5.2.3 For any real number r 1, and any integer n 0, Proof: n i=0 r i = rn+1 1 r 1. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 29 / 52

Proving Equality Consider the following proof for the basis step. Is it correct? 0 i=0 r i = r0+1 1 r 1 r 0 = r 1 r 1 1 = 1 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 30 / 52

Deducing the Sum of a Geometric Sequence Let Then Therefore, S n = 1 + r + r 2 +... + r n. rs n = r + r 2 + r 3 +... + r n+1. rs n S n = (r + r 2 + r 3 +... + r n+1 ) (1 + r + r 2 +... + r n ) = r n+1 1. But the above equation can be transformed to Finally, rs n S n = r n+1 1 S n (r 1) = r n+1 1. S n = rn+1 1 r 1. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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 specific instances 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 Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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 mathematical induction to become a certainty. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 33 / 52

n 2, n (1 1 k ) = 1 n k=2 Proof: See slide 52 for detailed proof. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 34 / 52

Proposition 5.3.1 For all integers n 0, 2 2n 1 is divisible by 3. Proof: ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 35 / 52

For any integer x = d 0 d 1... d n where d i {0, 1, 2,..., 9}, if n d k = 3p for some integer p, 3 x. k=0 Proof: ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 36 / 52

Proposition 5.3.2 For all integers n 3, 2n + 1 < 2 n. Proof: ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 37 / 52

5.6 Defining Sequences Recursively Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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 the expectation that the general pattern will be obvious. Consider 3, 5, 7,.... Unfortunately, misunderstandings can occur when this approach is used. The next term of the sequence could be 9 if we mean a sequence of odd integers, or it could be 11 if we mean the sequence of prime numbers. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 39 / 52

Defining Sequences The second way to define a sequence is to give an explicit formula for its nth term. For example, a sequence a 0, a 1, a 2,... can be specified by writing a n = ( 1)n for all integers n 0. n + 1 The advantage of defining a sequence by such an explicit formula is that each term of the sequence is uniquely determined and can be computed in a fixed, finite number of steps, by substitution. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 40 / 52

The Fibonacci Numbers In 1202 European Mathematician Fibonacci posed the following problem: A single pair of rabbits (male and female) is born at the beginning of a year. 1 Rabbit pairs are not fertile during their first month of life but thereafter give birth to one new male/female pair at the end of every month. 2 No rabbits die. How many rabbit pairs will there be at the end of the year? Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 41 / 52

Definition A recurrence relation for a sequence a 0, a 1, a 2,... is a formula that relates every a k to certain of its predecessors a k 1, a k 2,..., a k i where i is an integer with k i 0. The initial conditions for such a recurrence relation specify the values of a 0,..., a i 1, if i is a fixed integer, or a 0, a 1,..., a m, where m is an integer with m 0, if i depends on k. Consider the following sequence. Find the recurrence relation/initial condition. 1, 3, 9, 27, 81,... ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 42 / 52

Definition A recurrence relation for a sequence a 0, a 1, a 2,... is a formula that relates every a k to certain of its predecessors a k 1, a k 2,..., a k i where i is an integer with k i 0. The initial conditions for such a recurrence relation specify the values of a 0,..., a i 1, if i is a fixed integer, or a 0, a 1,..., a m, where m is an integer with m 0, if i depends on k. The same recurrence relation with different initial conditions represents different sequences. a k+1 = 3a k for all k 0 and a 0 = 2 ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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 compounded annually. Sally left her money on deposit at 4% annual interest rate but compounded quarterly. What are the amounts in the accounts at the end of the 5th year? Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 43 / 52

Example 5.6.6 The Fibonacci Numbers In 1202 European Mathematician Fibonacci posed the following problem: A single pair of rabbits (male and female) is born at the beginning of a year. 1 Rabbit pairs are not fertile during their first month of life but thereafter give birth to one new male/female pair at the end of every month. 2 No rabbits die. How many rabbit pairs will there be at the end of the year? Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 44 / 52

Recurrence Definitions of Sum and Product Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 45 / 52

5.7 Solving Recurrence Relations by Iteration Find an explicit formula which is called a solution. Method of Iteration Given a sequence a 0, a 1, a 2,... defined by a recurrence relation and initial conditions, you start from the initial conditions and calculate successive terms of the sequence until you see a pattern developing. At that point you guess an explicit formula. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 46 / 52

Example 5.3.3 Define a sequence a 1, a 2,... as follows. a 1 = 2 a k = 5a k 1 for all integers k 2. Find the explicit formula for this sequence. Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 47 / 52

Definition A sequence a 0, a 1, a 2,... is called an arithmetic sequence if, and only if, there is an constant d such that or, equivalently a k = a k 1 + d for all integer k 1 a n = a 0 + dn for all integer n 0 A sequence a 0, a 1, a 2,... is called an geometric sequence if, and only if, there is an constant r such that or, equivalently a k = a k 1 r for all integer k 1 a n = a 0 r n for all integer n 0 Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 48 / 52

Exercise Find the explicit formula for the recursively defined sequence: p k = p k 1 + 3 k 1, for k 2 and p 1 = 1 How do you check the correctness of the derived formula? Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 49 / 52

Appendix Hao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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) denote n = 5p + 12q for n 44. Basis step it is easy to show that P (44) holds for p = 4 q = 2. continued... ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 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, the proof is divided into two cases. Case 1 Consider p 7. Suppose k = 5p + 12q for some integers 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, and not shown. ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 51 / 52

Proof: Let P (n) be n 2, n k=2 n (1 1 k ) = 1 n k=2 (1 1 k ) = 1 n. n Basis step When n = 2, (1 1 k=2 k ) = 1 1 2 = 1 2. 1 n = 1 2. Therefore, P (n) holds true when n = 2. continued... ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 52 / 52

n 2, n (1 1 k ) = 1 n k=2 Proof: n Inductive step Suppose that P (n) : (1 1 k=2 k ) = 1 holds for n some n 2. We need to show that P (n + 1) also holds. (1 1 k ) = ( n (1 1 k ))(1 1 n + 1 ) n+1 k=2 k=2 = 1 n (1 1 n + 1 ) = 1 n n n + 1 1 = n + 1 ao Zheng ( Department of Computer Science Chapter and Engineering 5: Sequences, University Mathematic of South Induction, Floridand Tampa, Recursion October FL 33620 21, Email: 2014 zheng@cse.usf. 52 / 52