200 likes | 443 Views
Section 5.7 Solving recurrence relations. One typical problem of this type is to find an explicit formula for the n -th term ( a n ) of the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21, … where the recurrence relation is a n = a n -1 + a n -2.
E N D
Section 5.7 Solving recurrence relations One typical problem of this type is to find an explicit formula for the n-th term (an) of the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21, … where the recurrence relation is an = an-1 + an-2
Formula for the Fibonacci sequence for n = 0, 1, 2, 3, 4, …
Definitions of terms Order of a recurrence relation an = 2an–1 + 5 is of order 1 bn = 3bn–1 – 4nbn–2 is of order 2 cn = (cn–1)2 + (-1)ncn–3is of order 3 ( order 0 relations are not really recurrence relations)
Degree of a relation an = 2an–1 + 5an–2 – n(n + 1) is of degree 1 bn = 3(bn–1)(bn–2) + (bn–3 )2 is of degree 2 (cn)2 = (cn–1)3 + 6cn–2is of degree 3 Degree 1 relations are also called linear relations
Homogeneous relations: i.e. every term has the same power an = 2an-1 + 5an-2 is homogeneous bn = 3bn-1– 2bn-2 + (bn-3 )2 is not homogeneous cn = cn-1 + 6cn-2+ n(n + 3)is not homogeneous (dn)2 = n2(dn-1)(dn-2) + (dn-3 )2 is homogeneous
Relations with constant coefficients an = 2an–1– 7an–2 has constant coefficients bn = 3bn–1– (n–1)bn–2 + (cos n)bn–3 has non-constant coefficients
Solving 1st order linear recurrence relations by Iteration. Example 1: sk = sk-1 + (k-1), s1 = 0. Example 2: Example 3: xk = 3xk-1 + k, x1 = 1.
Derangements A derangement of a finite set X={x1, x2, ... , xn} is a permutation of X such that no elements stays in the original position. More precisely, a derangement of X is a bijection f : X X such that f (xi) xi for all i from 1 to n. x1 x1 x2 x2 x3 x3 x4 x4 x5 x5
Examples of Derangements Example I Holiday Gift Exchange In a holiday party, each attendant brings in a gift and exchanges it with someone else in the party. Example II Grading each others paper In a class of n students, each student will give his/her quiz to a classmate to grade, and each student will grade someone else’s quiz.
Derangement The number of possible derangements for a set of n objects is denoted by the symbol d(n). It is also called the subfactorial of n, the notation is not unique, it can be !n or n¡ Clearly d(1) = 0, d(2) = 1, d(3) = 2, but the sequence grows very fast: d(4) = 44, d(5) =265, d(6) = 1854
Recurrence Relations for d(n) d(n) = (n – 1)[d(n - 1) + d(n - 2)] d(n) = nd(n – 1) + (-1)n
All possible derangements of X Part 1: all derangement f :X X such that f(x1) = x2 Part 2: all derangement f :X X such that f(x1) = x3 Part (n – 1): all derangement f :X X such that f(x1) = xn
Part 1 is further divided into two subparts All derangements f :XX such that f(x1) = x2 All derangements f :XX such that f(x1) = x2 and f(x2) = x1 All derangements f :XX such that f(x1) = x2 and f(x2) x1 {x1, x2, x3, …, xn} {x1, x2, x3, …, xn} {x1, x2, x3, …, xn} {x1, x2, x3, …, xn} This side has d(n – 2) elements This side has d(n – 1) elements
Second Order Linear Homogenous equations with Constant coefficients. This is the most complicated type of equations that we will need to solve in this course. • Examples: • The Fibonacci sequence:an = an-1 + an-2 • bn = 2bn-1 + 5bn-2 • 2cn = 3cn-1 – cn-2
Definition: Let an = Aan-1 + Ban-2 for n > 1 be a second-order linear homogeneous relation with constant coefficients. We define the characteristic equation of this relation to be t2 – At – B = 0 • There are two possibilities for this equation, • it has two distinct (real or complex) roots. • it has a double root. • We shall handle these two cases separately.
Distinct Roots Suppose that the characteristic equation t2 – At – B = 0 has two distinct roots r and s, then the most general solution to the recurrence relation is an= C·rn + D·sn where C and D are constants whose values are determined by the values a0 and a1.
A Double Root Suppose that the characteristic equation t2 – At – B = 0 has only one root r, then the most general solution to the recurrence relation is an= C·rn + D·n·rn where C and D are constants whose values are determined by the values a0 and any other value of the sequence.
Example A gambler repeatedly bets $1 that a fair coin will come up heads when tossed. Each time the coin comes up heads, the gambler wins $1; each time the coin comes up tails, he loses $1. The gambler will quit either when he loses all his money or when he has $100. Let Pn be the probability that the gambler will have $0 in his pocket when he starts playing with $n. Clearly P0 = 1 and P100 = 0, but what are those in between?