Recurrence Relations: Selected Exercises. Copyright © Peter Cappello2 Exercise 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded.

Slides:



Advertisements
Similar presentations
Recurrence Relations: Selected Exercises
Advertisements

Applications of Inclusion-Exclusion: Selected Exercises.
Inclusion-Exclusion Selected Exercises
Fall 2002CMSC Discrete Structures1 Now it’s Time for… RecurrenceRelations.
Discrete Mathematics Math 6A Homework 9 Solution.
EXAMPLE 5 Model continuously compounded interest A = Pe rt SOLUTION Finance You deposit $4000 in an account that pays 6% annual interest compounded continuously.
Mixed Recursion: Sec. 8.4 Exercise 3. The closed-form formula for the Towers of Hanoi problem, M n = 2 n – 1, can be proved by mathematical induction.
CS 2210 (22C:19) Discrete Structures Advanced Counting
CSCE 2100: Computing Foundations 1 Combinatorics Tamara Schneider Summer 2013.
CSE115/ENGR160 Discrete Mathematics 04/19/12 Ming-Hsuan Yang UC Merced 1.
Recursion.
1 Section 6.1 Recurrence Relations. 2 Recursive definition of a sequence Specify one or more initial terms Specify rule for obtaining subsequent terms.
Equivalence Relations: Selected Exercises
The Basics of Counting: Selected Exercises. Copyright © Peter Cappello2 Sum Rule Example There are 3 sizes of pink shirts & 7 sizes of blue shirts. How.
Discrete Structures Chapter 5: Sequences, Mathematical Induction, and Recursion 5.2 Mathematical Induction I [Mathematical induction is] the standard proof.
6.Advanced Counting Techniques 1 Copyright M.R.K. Krishna Rao 2003 Ch 6. Recurrence Relations A recurrence relation for the sequence {a n } is an equation.
Applied Discrete Mathematics Week 9: Relations
Advanced Counting Techniques
Copyright © 2007 Pearson Education, Inc. Slide 8-1.
1 © 2010 Pearson Education, Inc. All rights reserved 10.1 DEFINITION OF A SEQUENCE An infinite sequence is a function whose domain is the set of positive.
Induction and recursion
Jessie Zhao Course page: 1.
Copyright © 2015, 2011, and 2007 Pearson Education, Inc. 1 Chapter 10 Compound Interest and Inflation Section 3 Present Value and Future Value.
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Copyright © Peter Cappello Mathematical Induction Goals Explain & illustrate construction of proofs of a variety of theorems using mathematical induction.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
CSE 2813 Discrete Structures Recurrence Relations Section 6.1.
Sequences and Summations
Chapter 7 Advance Counting Techniques. Content Recurrence relations Generating function The principle of inclusion-exclusion.
Recurrence Relations: Selected Exercises
Inclusion-Exclusion Selected Exercises Powerpoint Presentation taken from Peter Cappello’s webpage
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
Recurrence Relation Models
Sequences and Summations Section 2.4. Section Summary Sequences. – Examples: Geometric Progression, Arithmetic Progression Recurrence Relations – Example:
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Induction & Recursion Weiss: ch 7.1. Recursion –a programming strategy for solving large problems –Think “divide and conquer” –Solve large problem by.
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
Binomial Coefficients: Selected Exercises
Copyright © Peter Cappello 2011 Simple Arrangements & Selections.
Sequences and the Binomial Theorem Sequences Arithmetic Sequences Geometric Sequences & Series Binomial Theorem.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Permutations & Combinations: Selected Exercises. Copyright © Peter Cappello2 Preliminaries Denote the # of arrangements of some k elements of a set of.
Recursive Definitions & Structural Induction: Selected Exercises
1 10 Section 8.1 Recursive Thinking Page 409
(Proof By) Induction Recursion
CMSC Discrete Structures
Advanced Counting Techniques
Sequences and Series IB standard
Modeling with Recurrence Relations
Applied Discrete Mathematics Week 11: Relations
Generalized Permutations & Combinations: Selected Exercises
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Chapter 8: Further Topics in Algebra
Basic Counting.
CS 2210 Discrete Structures Advanced Counting
Basic Counting Lecture 9: Nov 5, 6.
CMSC Discrete Structures
Chapter 11: Further Topics in Algebra
Applied Discrete Mathematics Week 7: Computation
CMSC Discrete Structures
Recurrence Relations Discrete Structures.
Mathematical Induction
Chapter 7 Advanced Counting Techniques
Compound Interest.
Recurrence Relations.
ICS 253: Discrete Structures I
Copyright © Cengage Learning. All rights reserved.
Presentation transcript:

Recurrence Relations: Selected Exercises

Copyright © Peter Cappello2 Exercise 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. Set up a recurrence relation for the amount in the account at the end of n years.

Copyright © Peter Cappello3 Exercise 10 (a) Solution A person deposits $1,000 in an account that yields 9% interest compounded annually. Set up a recurrence relation for the amount in the account at the end of n years. Let a n represent the amount after n years. a n = a n a n-1 = 1.09a n-1 a 0 = 1000.

Copyright © Peter Cappello4 Exercise 10 (b) A person deposits $1,000 in an account that yields 9% interest compounded annually. Find an explicit formula for the amount in the account at the end of n years.

Copyright © Peter Cappello5 Exercise 10 (b) Solution After 1 year, a 1 = 1.09a 0 = 1.09x1000 = 1000x After 2 years, a 2 = 1.09a 1 = 1.09( 1000x(1.09) 1 ) = 1000x(1.09) 2 After n years, a n = 1000x(1.09) n Since a n is recursively defined, we prove the formula, for n ≥ 0, by mathematical induction (The problem does not ask for proof).

Copyright © Peter Cappello6 Exercise 10 (b) Solution Basis n = 0: a 0 = 1000 = 1000x(1.09) 0. The 1 st equality is the recurrence relation’s initial condition. Induction hypothesis: a n = 1000x1.09 n. Induction step: Show: a n+1 = 1000x1.09 n+1. a n+1 = 1.09a n = 1.09 ( 1000x1.09 n ) = 1000x1.09 n+1. The 1 st equality: the definition of the recurrence relation. The 2 nd equality: the induction hypothesis.

Copyright © Peter Cappello7 Exercise 10 (c) A person deposits $1,000 in an account that yields 9% interest compounded annually. How much money will the account contain after 100 years?

Copyright © Peter Cappello8 Exercise 10 (c) Solution The account contains a 100 dollars after 100 years: a 100 = 1000x = $5,529,041. That is before taxes. With 30% federal + 10% CA on interest earned, it becomes 1000x = $131,500 

Copyright © Peter Cappello9 Exercise 20 A country uses as currency coins with pesos values of 1, 2, 5, & 10 pesos Find a recurrence relation, a n, for the # of payment sequences for n pesos. E.g., a bill of 4 pesos could be paid with any of the following sequences: 1.1, 1, 1, 1 2.1,1, 2 3.1, 2, 1 4.2, 1, 1 5.2, 2

Copyright © Peter Cappello10 Exercise 20 Solution The sequences that start w/ a 1 peso coin differ from the sequences that don’t. Use the sum rule: Partition the set of sequences, based on which kind of coin starts the sequence. It could be a: 1 peso coin, in which case we have a n-1 ways to finish the bill 2 peso coin, in which case we have a n-2 ways to finish the bill 5 peso coin, in which case we have a n-5 ways to finish the bill 10 peso coin, in which case we have a n-10 ways to finish the bill The recurrence relation is a n = a n-1 + a n-2 + a n-5 + a n-10 with 10 initial conditions, a 1 = 1, a 2 = 2, a 3 = 3, a 4 = 5, a 5 = 9, a 6 = 15, a 7 = 26, a 8 = 44, a 9 = 75, a 10 = 125.

Copyright © Peter Cappello11 Exercise 30 (a) A string that contains only 0s, 1s, & 2s is called a ternary string. Find a recurrence relation for the # of ternary strings of length n that do not contain 2 consecutive 0s.

Copyright © Peter Cappello12 Exercise 30 (a) Solution Subtract the # of “bad” strings (contain 2 consecutive 0s), b n,, from the # of ternary strings, 3 n. To count b n,, use the sum rule: Partition the set of strings, depending on what digit starts the string: 1.The string starts with a 1: b n-1 ways to finish the string. 2.The string starts with a 2: b n-1 ways to finish the string. 3.The string starts with a 0: 1.The remaining string starts with a 0: 3 n-2 ways to finish the string. 2.The remaining string starts with a 1: b n-2 ways to finish the string. 3.The remaining string starts with a 2: b n-2 ways to finish the string. Summing, b n = 2b n-1 + 2b n n-2

Copyright © Peter Cappello13 Exercise 30 (b) What are the initial conditions?

Copyright © Peter Cappello14 Exercise 30 (b) Solution What are the initial conditions? b 0 = b 1 = 0. Why do we need 2 initial conditions?

Copyright © Peter Cappello15 Exercise 30 (c) How many ternary strings of length 6 contain 2 consecutive 0s?

Copyright © Peter Cappello16 Exercise 30 (c) Solution The number of such strings is the value of b 6. Using b n = 2b n-1 + 2b n n-2, we compute: b 0 = b 1 = 0. (Initial conditions) b 2 = 2b 1 + 2b = 2x0 + 2x = 1 b 3 = 2b 2 + 2b = 2x1 + 2x = 5 b 4 = 2b 3 + 2b = 2x5 + 2x = 21 b 5 = 2b 4 + 2b = 2x21 + 2x = 79 b 6 = 2b 5 + 2b = 2x79 + 2x = 281.

Copyright © Peter Cappello17 Exercise 40 Find a recurrence relation, e n, for the # of bit strings of length n with an even # of 0s.

Copyright © Peter Cappello18 Exercise 40 Solution Strings are sequences: Order matters: There is a 1 st bit. Use the sum rule: Partition the desired set of bit strings, based on the string’s 1 st bit: Strings with an even # of 0s that begin with 1: e n-1 Strings with an even # of 0s that begin with 0: 2 n-1 - e n-1 Summing, e n = e n n-1 - e n-1 = 2 n-1 Does this answer suggest an alternate explanation? Does this question relate to our study binomial coefficients?

Copyright © Peter Cappello19 Use the Binomial Theorem ( x + y ) n = Σ j=0 to n C( n, j )x n-j y j = C( n, 0 )x n y 0 + C( n,1 )x n-1 y 1 + … + C( n, j )x n-j y j + … + C( n, n )x 0 y n. Evaluate at x = 1, y = -1: (1 – 1) n = Σ j=0 to n C( n, j )1 n-j ( -1 ) j = C( n, 0 ) - C( n,1 ) + C( n,2 ) - C( n,3 ) (-1) n C( n, n ). C( n,1 ) + C( n,3 ) + C( n,5 )... = C( n, 0 ) + C( n,2 ) + C( n,4 )... = 2 n-1 Example: C(4,0) + C(4,2) + C(4,4) = C(4,1) + C(4,3) = 2 3 The # of bit strings of length 4 that have an even number of 0s is 2 3.

Copyright © Peter Cappello20 End

Exercise 40 Solution Strings are sequences: Order matters: There is a 1 st bit. Use the sum rule: Partition the desired set of bit strings, based on the string’s 1 st bit: Strings with an even # of 0s that begin with 1: e n-1 Strings with an even # of 0s that begin with 0: 2 n-1 - e n-1 Summing, e n = e n n-1 - e n-1 = 2 n-1 Copyright © Peter Cappello21

Copyright © Peter Cappello22 49 The variation we consider begins with people numbered 1, …, n, standing around a circle. In each stage, every 2 nd person still alive is killed until only 1 survives. We denote the number of the survivor by J(n). Determine the value of J(n) for 1  n  16.

Copyright © Peter Cappello23 49 Solution Put 5 people, named 1, 2, 3, 4, & 5, in a circle. Starting with 1, kill every 2 nd person until only 1 person is left. The sequence of killings is: So, J(5) = 3. Continuing, for each value of n, results in the following table.

Copyright © Peter Cappello24 49 Solution nJ(n)n

Copyright © Peter Cappello25 50 Use the values you found in Exercise 49 to conjecture a formula for J(n). Hint: Write n = 2 m + k, where m, k  N & k < 2 m.

Copyright © Peter Cappello Solution nJ(n)n 1 = = = = = = = = = = = = = = = =

Copyright © Peter Cappello Solution continued nJ(n)n 1 = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2* = = 2*0 + 1

Copyright © Peter Cappello28 50 Solution continued So, if n = 2 m + k, where m, k  N & k < 2 m, then J(n) = 2k + 1. Check this for J(17).

Copyright © Peter Cappello29 Exercise 20 Solution continued But, we also can use bills. If the 1 st currency object is a bill, it could be a 1.5 peso, in which case we have a n-5 ways to finish the bill 2.10 peso, in which case we have a n-10 ways to finish the bill 3.20 peso, in which case we have a n-20 ways to finish the bill 4.50 peso, in which case we have a n-50 ways to finish the bill peso, in which case we have a n-100 ways to finish the bill Using both coins & bills, we have a n = a n-1 + a n-2 + a n-5 + a n-10 + a n-5 + a n-10 + a n-20 + a n-50 + a n-100 = a n-1 + a n-2 + 2a n-5 + 2a n-10 + a n-20 + a n-50 + a n-100, with 100 initial conditions, which I will not produce.