06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

“mcs” — 2017/3/3 — 11:21 — page 950 — #958<br />

950<br />

Chapter 22<br />

Recurrences<br />

Short Guide to Solving Linear Recurrences<br />

A linear recurrence is an equation<br />

f .n/ D a 1 f .n<br />

„<br />

1/ C a 2 f .n 2/ C C a d f .n<br />

ƒ‚<br />

d/<br />

…<br />

homogeneous part<br />

C g.n/<br />

„ ƒ‚ …<br />

inhomogeneous part<br />

together with boundary conditions such as f .0/ D b 0 , f .1/ D b 1 , etc. Linear<br />

recurrences are solved as follows:<br />

1. Find the roots of the characteristic equation<br />

x n D a 1 x n 1 C a 2 x n 2 C C a k 1 x C a k :<br />

2. Write down the homogeneous solution. Each root generates one term and<br />

the homogeneous solution is their sum. A nonrepeated root r generates the<br />

term cr n , where c is a constant to be determined later. A root r with multiplicity<br />

k generates the terms<br />

d 1 r n d 2 nr n d 3 n 2 r n : : : d k n k 1 r n<br />

where d 1 ; : : : d k are constants to be determined later.<br />

3. Find a particular solution. This is a solution to the full recurrence that need<br />

not be consistent with the boundary conditions. Use guess-and-verify. If<br />

g.n/ is a constant or a polynomial, try a polynomial of the same degree, then<br />

of one higher degree, then two higher. For example, if g.n/ D n, then try<br />

f .n/ D bnCc and then an 2 CbnCc. If g.n/ is an exponential, such as 3 n ,<br />

then first guess f .n/ D c3 n . Failing that, try f .n/ D .bn C c/3 n and then<br />

.an 2 C bn C c/3 n , etc.<br />

4. Form the general solution, which is the sum of the homogeneous solution<br />

and the particular solution. Here is a typical general solution:<br />

f .n/ D c2 n C d. 1/ n<br />

„ ƒ‚ …<br />

C<br />

„<br />

3n<br />

ƒ‚<br />

C<br />

…<br />

1.<br />

homogeneous solution inhomogeneous solution<br />

5. Substitute the boundary conditions into the general solution. Each boundary<br />

condition gives a linear equation in the unknown constants. For example,<br />

substituting f .1/ D 2 into the general solution above gives<br />

IMPLIES 2 D 2c d:<br />

2 D c 2 1 C d . 1/ 1 C 3 1 C 1<br />

Determine the values of these constants by solving the resulting system of<br />

linear equations.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!