Title: Section 5.7 Solving recurrence relations
1Section 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
2Formula for the Fibonacci sequence
for n 0, 1, 2, 3, 4,
3Definitions of terms
Order of a recurrence relation
an 2an1 5 is of order 1 bn
3bn1 4nbn2 is of order 2 cn
(cn1)2 (-1)ncn3 is of order 3
( order 0 relations are not really recurrence
relations)
4Degree of a relation
an 2an1 5an2 n(n 1) is of
degree 1 bn 3(bn1)(bn2) (bn3 )2
is of degree 2 (cn)2 (cn1)3 6cn2
is of degree 3
Degree 1 relations are also called linear
relations
5Homogeneous 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
6Relations with constant coefficients
an 2an1 7an2 has
constant coefficients bn 3bn1 (n 1)bn2
(cos n)bn3
has
non-constant coefficients
7Solving 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.
8Derangements
A derangement of a finite set Xx1, 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
9Examples 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 elses quiz.
10Derangement
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
11Recurrence Relations for d(n)
d(n) (n 1)d(n - 1) d(n - 2)
d(n) nd(n 1) (-1)n
12All 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
13Part 1 is further divided into two subparts
All derangements f X?X such that f(x1) x2
All derangements f X?X such that
f(x1) x2 and f(x2) x1
All derangements f X?X 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
14Second 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
15Definition Let an Aan-1
Ban-2 for n gt 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.
16Distinct 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 Crn Dsn where C and
D are constants whose values are determined by
the values a0 and a1.
17A 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 Crn Dnrn where C and D are
constants whose values are determined by the
values a0 and any other value of the sequence.
18Example
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?