09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

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.

14 RECURRENT PROBLEMS<br />

by separating out its dependence on K, /3, and y, it seems that<br />

A(n) = 2m;<br />

B(n) = 2”‘-1-L; (1.14)<br />

C(n) = 1.<br />

Here, as usual, n = 2m + 1 and 0 < 1 < 2m, <strong>for</strong> n 3 1.<br />

It’s not terribly hard to prove (1.13) and (1.14) by induction, but the Ho/d onto your<br />

calculations are messy and unin<strong>for</strong>mative. Fortunately there’s a better way hats, this next part<br />

to proceed, by choosing particular values and then combining them. Let’s<br />

is new stuff.<br />

illustrate this by considering the special case a = 1, (3 = y = 0, when f(n) is<br />

supposed to be equal to A(n): Recurrence (1.11) becomes<br />

A(1) = 1;<br />

A(2n) = 2A(‘n), <strong>for</strong> n 3 1;<br />

A(2n + 1) = 2A(n), <strong>for</strong> n 3 1.<br />

Sure enough, it’s true (by induction on m) that A(2” + 1) = 2m.<br />

Next, let’s use recurrence (1.11) and solution (1.13) in Teverse, by starting<br />

with a simple function f(n) and seeing if there are any constants (OL, 8, y)<br />

that will define it. Plugging in the constant function f(n) = 1 says that A neat idea!<br />

1 = a;<br />

1 = 2.1+p;<br />

1 = 2.1+y;<br />

hence the values (a, 6, y) = (1, -1, -1) satisfying these equations will yield<br />

A(n) - B(n) - C(n) = f(n) = 1. Similarly, we can plug in f(n) = n:<br />

1 = a;<br />

2n = 2+n+ L3;<br />

2n+l = 2.n+y;<br />

These equations hold <strong>for</strong> all n when a = 1, b = 0, and y = 1, so we don’t<br />

need to prove by induction that these parameters will yield f(n) = n. We<br />

already know that f(n) = n will be the solution in such a case, because the<br />

recurrence (1.11) uniquely defines f(n) <strong>for</strong> every value of n.<br />

And now we’re essentially done! We have shown that the functions A(n),<br />

B(n), and C(n) of (1.13), which solve (1.11) in general, satisfy the equations<br />

A(n) = 2”) where n = 2” + 1 and 0 6 1 < 2”;<br />

A(n) -B(n) - C(n) = 1 ;<br />

A(n) + C(n) = n.

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

Saved successfully!

Ooh no, something went wrong!