recurrence relations: selected exercises. 2 10 (a) a person deposits $1,000 in an account that...
TRANSCRIPT
![Page 1: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/1.jpg)
Recurrence Relations: Selected Exercises
![Page 2: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/2.jpg)
2
10 (a)
A person deposits $1,000 in an account that yields
9% interest compounded annually.
a) Set up a recurrence relation for the amount in the
account at the end of n years.
![Page 3: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/3.jpg)
3
10 (a) Solution
Let an represent the amount after n years.
an = an-1 + 0.09an-1 = 1.09an-1
a0 = 1000.
![Page 4: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/4.jpg)
4
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.
![Page 5: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/5.jpg)
5
10 (b) Solution
After 1 year, a1 = 1.09a0 = 1.09x1000 = 1000x1.091
After 2 years, a2 = 1.09a1
= 1.09(1000x(1.09)1)
= 1000x(1.09)2
After n years, an = 1000x(1.09)n
Since an is recursively defined, we prove the formula, for n ≥ 0, by mathematical induction
(The problem does not ask for proof).
![Page 6: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/6.jpg)
6
10 (b) Solution
Basis n = 0: a0 = 1000 = 1000x(1.09)0 .
The 1st equality is the recurrence relation’s initial condition.
Show: an = 1000x1.09n an+1 = 1000x1.09n+1
.
1. Assume an = 1000x1.09n .
2. an+1 = 1.09an = 1.09 (1000x1.09n) = 1000x1.09n+1.
The 1st equality is from the definition of the recurrence relation.
The 2nd equality is from the induction hypothesis.
![Page 7: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/7.jpg)
7
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?
![Page 8: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/8.jpg)
8
10 (c) Solution
The account will contain a100 dollars after 100 years:
a100 = 1000x1.09100 = $5,529,041.
That is before taxes .
With 30% federal + 10% CA on interest earned, it becomes
1000x1.05100 = $131,500.
![Page 9: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/9.jpg)
9
20
A country uses as currency:
– coins with pesos values of 1, 2, 5, & 10 pesos
– bills with pesos values of 5, 10, 20, 50, & 100.
Find a recurrence relation, an, 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
![Page 10: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/10.jpg)
10
20 Solution
For n pesos, our 1st (order matters) currency object can be a coin or a bill.
Sequences that start w/ a 1 peso coin are different from other sequences:
Use the sum principle to decompose this problem into disjoint sub-problems,
based on which kind of currency object starts the sequence.
If the 1st currency object is a coin, it could be a:
• 1 peso coin, in which case we have an-1 ways to finish the bill
• 2 peso coin, in which case we have an-2 ways to finish the bill
• 5 peso coin, in which case we have an-5 ways to finish the bill
• 10 peso coin, in which case we have an-10 ways to finish the bill
If there were only coins, the recurrence relation would be
an = an-1 + an-2 + an-5 + an-10 with 10 initial conditions, a1 = 1, a2 = 2, a3 = 3, a4 =
5, a5 = 9, a6 = 15, a7 = 26, a8 = 44, a9 = 75, a10 = 125
![Page 11: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/11.jpg)
11
20 Solution continued
But, we also can use bills.
If the 1st currency object is a bill, it could be a1. 5 peso, in which case we have an-5 ways to finish the bill
2. 10 peso, in which case we have an-10 ways to finish the bill
3. 20 peso, in which case we have an-20 ways to finish the bill
4. 50 peso, in which case we have an-50 ways to finish the bill
5. 100 peso, in which case we have an-100 ways to finish the bill
So, using both coins & bills, we have
an = an-1 + an-2 + an-5 + an-10 + an-5 + an-10 + an-20 + an-50 + an-100
= an-1 + an-2 + 2an-5 + 2an-10 + an-20 + an-50 + an-100 ,
with 100 initial conditions, which I will not produce.
![Page 12: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/12.jpg)
12
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.
![Page 13: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/13.jpg)
13
30 (a) Solution
We subtract the # of “bad” strings, bn, , from the # of ternary strings, 3n.
We use the sum principle to decompose the problem into disjoint sub-
problems, depending on what digit starts the string:
Case the string starts with a 1: bn-1 ways to finish the string.
Case the string starts with a 2: bn-1 ways to finish the string.
Case the string starts with a 0:
Case the remaining string starts with a 0: 3n-2 ways to finish the string.
Case the remaining string starts with a 1: bn-2 ways to finish the string.
Case the remaining string starts with a 2: bn-2 ways to finish the string.
Summing, bn = 2bn-1 + 2bn-2 + 3n-2
![Page 14: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/14.jpg)
14
30 (b)
b) What are the initial conditions?
![Page 15: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/15.jpg)
15
30 (b) Solution
b0 = b1 = 0.
Why do we need 2 initial conditions?
![Page 16: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/16.jpg)
16
30 (c)
How many ternary strings of length 6 contain 2
consecutive 0s?
![Page 17: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/17.jpg)
17
30 (c) Solution
The number of such strings is b6.
Using bn = 2bn-1 + 2bn-2 + 3n-2, we compute:
b0 = b1 = 0. (Initial conditions)
b2 = 2b1 + 2b0 + 30 = 1
b3 = 2b2 + 2b1 + 31 = 2x1 + 2x0 + 31 = 5
b4 = 2b3 + 2b2 + 32 = 2x5 + 2x1 + 32 = 21
b5 = 2b4 + 2b3 + 33 = 2x21 + 2x5 + 33 = 79
b6 = 2b5 + 2b4 + 34 = 2x79 + 2x21 + 34 = 281.
![Page 18: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/18.jpg)
18
40
Find a recurrence relation, en, for the # of bit strings of
length n with an even # of 0s.
![Page 19: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/19.jpg)
19
40 Solution
Strings are sequences: Order matters:
There is a 1st bit.
Use the sum principle to decompose the problem into disjoint sub-
problems, based on their 1st bit:
The strings with an even # of 0s that begin with 1: en-1
The strings with an even # of 0s that begin with 0: 2n-1 - en-1
Summing, en = en-1 + 2n-1 - en-1 = 2n-1
Does this answer suggest an alternate explanation?
Remember this question when we study binomial coefficients.
![Page 20: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/20.jpg)
20
![Page 21: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/21.jpg)
21
49
The variation we consider begins with people
numbered 1, …, n, standing around a circle.
In each stage, every 2nd 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.
![Page 22: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/22.jpg)
22
49 Solution
Put 5 people, named 1, 2, 3, 4, & 5, in a circle.
Starting with 1, kill every 2nd person until only 1 person is left.
The sequence of killings is:1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
So, J(5) = 3.
Continuing, for each value of n, results in the following table.
![Page 23: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/23.jpg)
23
49 Solution
n J(n) n J(n)
1 1 9 3
2 1 10 5
3 3 11 7
4 1 12 9
5 3 13 11
6 5 14 13
7 7 15 15
8 1 16 1
![Page 24: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/24.jpg)
24
50
Use the values you found in Exercise 49 to conjecture
a formula for J(n).
Hint: Write n = 2m + k, where m, k N & k < 2m .
![Page 25: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/25.jpg)
25
50 Solution
n J(n) n J(n)
1 = 20 + 0 1 9 = 23 + 1 3
2 = 21 + 0 1 10 = 23 + 2 5
3 = 21 + 1 3 11 = 23 + 3 7
4 = 22 + 0 1 12 = 23 + 4 9
5 = 22 + 1 3 13 = 23 + 5 11
6 = 22 + 2 5 14 = 23 + 6 13
7 = 22 + 3 7 15 = 23 + 7 15
8 = 23 + 0 1 16 = 24 + 0 1
![Page 26: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/26.jpg)
26
50 Solution continued
n J(n) n J(n)
1 = 20 + 0 1 = 2*0 + 1 9 = 23 + 1 3 = 2*1 + 1
2 = 21 + 0 1 = 2*0 + 1 10 = 23 + 2 5 = 2*2 + 1
3 = 21 + 1 3 = 2*1 + 1 11 = 23 + 3 7 = 2*3 + 1
4 = 22 + 0 1 = 2*0 + 1 12 = 23 + 4 9 = 2*4 + 1
5 = 22 + 1 3 = 2*1 + 1 13 = 23 + 5 11 = 2*5 + 1
6 = 22 + 2 5 = 2*2 + 1 14 = 23 + 6 13 = 2*6 + 1
7 = 22 + 3 7 = 2*3 + 1 15 = 23 + 7 15 = 2*7 + 1
8 = 23 + 0 1 = 2*0 + 1 16 = 24 + 0 1 = 2*0 + 1
![Page 27: Recurrence Relations: Selected Exercises. 2 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence](https://reader035.vdocument.in/reader035/viewer/2022062217/56649eea5503460f94bfb3f2/html5/thumbnails/27.jpg)
27
50 Solution continued
So, if n = 2m + k, where m, k N & k < 2m ,
then J(n) = 2k + 1.
Check this for J(17).