Professional Documents
Culture Documents
Recurrence Relations
1 The First-Order Linear Recurrence Relation
- Let k Z , and c (6= 0), c
+
n n 1 , c n 2 , . . . , c n k (6= 0) be constants. If a n , n 0, is a discrete function,
then
c n a n + c n1 a n1 + c n 2 a n 2 + + c n k a nk = f (n), n k .
is a linear recurrence relation (with constant coefficients) of order k . When f (n) = 0 for all n 0, the
relation is called homogeneous, otherwise it is nonhomogeneous.
- Consider a n = c a n 1 , n 0, c :constant
1
2 The Second-Order Linear Homogeneous Recurrence Relation
- Consider
c n a n + c n 1 a n 1 + c n2 a n 2 = 0, n 2. (1)
Then solution of the recurrence is of the form
an = crn (2)
where c 6= 0 and r 6= 0
Substituting (2) into (1), we obtain
c n (c r n ) + c n 1 (c r n1 ) + c n2 (c r n 2 ) = 0.
Then
c n r 2 + c n1 r + c n 2 = 0. (3)
Eq. (3) is called the characteristic equation, and its roots r1 and r2 are called the characteristics roots.
Case A : Distinct Real Roots
Example 1 Solve a n + a n 1 6a n 2 = 0, n 2, a 0 = 1, a 1 = 8.
2
Example 3 For n 0, let S = {1, 2, 3, . . . , n} (when n = 0,S = ), and let a n denote the # of subsets of
S that conatin no consecutive integers. Find and solve a recurrence relation for a n .
Example 4 Find a recurrence relation for the # of binary sequence length n that contain no consec-
utive 0s
Case B : Complex Roots
1. p
r1 = x + i y = x 2 + y 2 (cos + i sin )
p
r2 = x i y = x 2 + y 2 (cos i sin )
3
Example 6 Solve a n = 2(a n 1 a n 2 ), n 2, a 0 = 1, a 1 = 2.
Example 7 Find D n = b b 0 0 0 0 . . . 0 0 0 0 0
b b b 0 0 0 . . . 0 0 0 0 0
0 b b b 0 0 . . . 0 0 0 0 0
0 0 b b b 0 . . . 0 0 0 0 0
0 0 0 b b b . . . 0 0 0 0 0
...
0 0 0 0 0 0 . . . b b b 0 0
0 0 0 0 0 0 . . . 0 b b b 0
0 0 0 0 0 0 . . . 0 0 b b b
0 0 0 0 0 0 ... 0 0 0 b b
4
Case C : Repeated Real Roots
Let r be the characteristic root. The general solution is of the form
a n = c 1r n + c 2n r n
Example 11 Solve a n 4a n 1 + 5a n 2 2a n 3 = 0, n 3, a 0 = 1, a 1 = 3, a 2 = 6.
5
3 The Linear Nonhomogeneous Recurrence Relation
- Consider
c n a n + c n1 a n1 + c n 2 a n 2 + + c n k a nk = f (n ), n k .
where c i : constants for n k i n.
(h) (p )
The solution a n is the sum of the parts a n and a n .
(h)
a n : the homogeneous solution, which satisfies the equation with f (n) = 0.
c n a n + c n 1 a n 1 + c n2 a n 2 + + c n k a n k = 0
(p )
a n : a particular solution to the equation.
c n a n + c n 1 a n 1 + c n2 a n 2 + + c n k a n k = f (n)
a n = a n(h) + a n(p )
(p ) (p )
There is no general way to find a n . However, when f (n) is in a relatively simple form, a n can be
determined by method of undetermined coefficients.
Example 1 Solve a n + 2a n 1 = n + 3, n 1, a 0 = 3.
For example, a n = a n 1 + 3n 2
6
Example 3 Solve a n 3a n 1 = 5(7n ), n 1, a 0 = 2.
7
Example 6 Solve a n + 2a n 1 + a n 2 = 2n , n 2, a 0 = 1, a 1 = 2.
Example 7 Character set: = {0, 1, 2, 3}. There are 410 strings of length 10. How many of these more
than 1 million strings contain an even number of 1s.
8
Example 8 nth Fibonacci number
int fib1(int n) {
if (n<=1)
return n;
else return fib1(n-1)+fib1(n-2);
}
9
4 The Methods of Generating Functions
Example 1 Solve a n 3a n 1 = n, n 1, a 0 = 1
10
Example 2 Solve a n+2 5a n +1 + 6a n = 2, n 2, a 0 = 3, a 1 = 7.
11