Download Explicit solutions for recurrences

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Ambiguity wikipedia , lookup

Functional decomposition wikipedia , lookup

Sequence wikipedia , lookup

Numerical continuation wikipedia , lookup

Series (mathematics) wikipedia , lookup

Hyperreal number wikipedia , lookup

Collatz conjecture wikipedia , lookup

Large numbers wikipedia , lookup

Elementary algebra wikipedia , lookup

Elementary mathematics wikipedia , lookup

Recurrence relation wikipedia , lookup

Transcript
Recurrence Relations
A recurrence relation is a formula that defines each number in a sequence of numbers in terms
of previous numbers in the sequence. Such relations often describe (dynamical) systems that evolve
over time, as well as determining the number of steps in algorithmic computations.
EXAMPLE Consider the recurrence relation an = 3an-1 , for n $ 1; if a0 is given as 2, then the sequence
is 2, 6, 18, 54, 162, . . .. Or a starting point of a0 = 5 would produce 5, 15, 45, 135, 405, . . ..
The examples cited above are iterative calculations to determine all the elements in the
sequence up to a certain point.
If the recurrence relation is used recursively to calculate (only the necessary) preceding values
until the stopping condition [subscript 0] is reached. a5 = 3a4 = 3(3a3) = 9a3 = 9(3a2) = 27a2 = 27(3a1)
= 81(a1) = 81(3a0) =243a0 =243(2) = 486. Note than none of the intermediate values are computed.
Either approach easily yields an explicit formula an = a03n for n $1. This is a simple geometric
sequence.
EXAMPLE Compound interest describes an investment in which the interest rate is applied each
period to the previous base and added to that base to produce the new principal.
That is, Pn = P(n–1) + rP(n–1) = (1+r)P(n–1). The resulting recurrence generates a geometric sequence.
Pn = P0(1+r)n for n periods at r% applied to initial principal P0.
EXAMPLE Consider the sequence {an} that satisfies the recurrence an = 2a(n–1) – a(n–2) for n$2 and
suppose a0 = 1, a1 = 3. We calculate additional values:
a2 = 2a(2–1) – a(2–2) = 2a1 – a0 = 2(3) – 1 = 5
a3 = 2a(3–1) – a(3–2) = 2a2 – a1 = 2(5) – 3 = 7.
From this brief iteration, it appears that an = 1 + 2n is the sequence that is determined by the recurrence
and the initial values.
A sequence is called a solution of a recurrence if its terms satisfy the recurrence relation.
Many sequences may satisfy a recurrence, but only one sequence will also satisfy the initial conditions.
EXAMPLE We show that an = 5 satisfies the recurrence an = 2a(n–1) – a(n–2) for n$2
Start with 2a(n–1) – a(n–2) = 2(5) – 5 = 5 = an.
EXAMPLE We show that an = 3n satisfies the recurrence an = 2a(n–1) – a(n–2) for n$2
Start with 2a(n–1) – a(n–2) = 2[3(n–1)] – [3(n–2)] = 6n – 6 – 3n + 6 = 3n = an.
EXAMPLE We show that an = 2n does not satisfy the recurrence an = 2a(n–1) – a(n–2) for n$2
Start with 2a(n–1) – a(n–2) = 2(2(n–1)) – 2(n–2) = 2n – 2n(2(–2)) = 2n(1 – 1/4) = 2n(3/4) … an.
EXAMPLE We now show that an = hn + k [where h and k are any constants] is a general solution of
the recurrence an = 2a(n–1) – a(n–2) for n$2
Start with 2a(n–1) – a(n–2) = 2[h(n–1) + k] – [h(n–2) +k] = 2hn – 2h + 2k – hn + 2h – k = hn + k = an.
EXAMPLE If a valid numerical code word must have an even number of the digit 0, we derive a
recurrence to represent the valid numerical code words with n characters.
Suppose the number of valid code words of length (n–1) is a(n–1), then the valid code words of length n
can be created by appending {1 or 2 or . . . 9} to each of the a(n–1) valid words or by appending 0 to the
other (10(n–1) – a(n–1)) invalid words. Hence an = 9a(n–1) + 1(10(n–1) – a(n–1)) = 8a(n–1) + 10(n–1)
EXAMPLE The “Towers of Hanoi” puzzle requires moving n tapered disks from one of three pegs to
another peg in such a way that a disk may not be placed on top of a smaller disk.
In order to move n disks, it is necessary to have moved (n–1) disks to another peg, then move the next
disk to the remaining peg and then move the (n–1) disks onto the disk just moved.
A recurrence describing the number of moves may be written as Hn = H(n–1) + 1 + H(n–1) for n $2.
The explicit solution to the recurrence Hn = 2H(n–1) + 1 may be developed recursively:
Hn = 2H(n–1) + 1
= 2[2H(n–2) + 1] +1 = 22H(n–2) + 2 + 1
= 22[2H(n–3) + 1] + 2 + 1 = 23H(n–3) + 22 + 2 + 1
= . . . = 2kH(n-k) + 2(k–1) + . . . + 2 + 1
= . . . = 2(n–1)H1 + 2(n–2) + . . . + 2 + 1
= 2(n–1)(1) + 2(n–2) + . . . + 2 + 1 = 2n – 1
Solving recurrence relations
When the recurrence involves terms up to two positions previous to an then the basis requires two
values, and the derivation of an explicit formula involves solving a quadratic equation.
EXAMPLE Consider the sequence given by s n = 6sn-2 ! sn-1 for n $ 2, with s0 = 1 and s1 = 2.
If we suppose the explicit formula is of the form sn = crn, then we can see that crn = 6crn-2 !crn-1 .
Now dividing by crn-2 and rearranging the terms yields the quadratic equation r2 + r ! 6 = 0, which
corresponds to the so-called characteristic equation for the recurrence relation.
Solving for the two distinct real roots, we get r = 2 or r = -3.
These produce the particular representations sn = 2n or sn = (-3)n.
The general representation for the explicit formula is sn = c12n + c2(-3)n.
Solving the system of two equations that result from setting n = 0 and n = 1 and using the initial values
s0 = 1 and s1 = 2, we get the explicit formula sn = (1)2n + (0)(-3)n which is simply 2n.
Of course, different initial values would produce different explicit formulas.
EXAMPLE Consider bn = 3bn-2, for n $ 2, with b0 = 2 and b1 = 5.
This sequence produces the characteristic equation x2 = 3 which has real solutions /3 and -/3.
Solving bn = c1(/3)n + c2(-/3)n with the initial conditions produces the formula:
.
EXAMPLE Sometimes the characteristic equation has equal roots.
sn = 4sn-1 ! 4sn-2 for n $ 2, with s0 = 1 and s1 = 8, has characteristic equation x2 – 4x + 4 = 0.
This has the double real root x = 2. In this case, we must solve the formula sn = c12n + c2n(2n), n $ 0.
Using the initial conditions, we get sn = 2n + 3n(2n) for n $ 0.
The Fibonacci sequence given by Fn = Fn-1 + Fn-2 , for n $ 3, with F1 = F2 = 1, produces the
characteristic equation x2 = x + 1, which has the distinct real solutions (1+/5)/2 and (1!/5)/2.
Solving for the coefficients c1 and c2 gives the surprising formula: