Loading [MathJax]/jax/output/HTML-CSS/jax.js

Sunday, July 10, 2011

Continued Fractions for the Greater Good part 1

OK, maybe not for the greater good, but still fun. This first post will be relatively short and sweet, intended to give an introduction for the posts that will follow.

Before the introduction, some motivation courtesy of Wikipedia:
“...decimal representation has some problems. One problem is that many rational numbers lack finite representations in this system. For example, the number 13 is represented by the infinite sequence (0,3,3,3,3,). Another problem is that the constant 10 is an essentially arbitrary choice, and one which biases the resulting representation toward numbers that have some relation to the integer 10. For example, 1371600 has a finite decimal representation, while 13 does not, not because 1371600 is simpler than 13, but because 1600 happens to divide a power of 10 (106=1600×625). Continued fraction notation is a representation of the real numbers that avoids both these problems. Let us consider how we might describe a number like 41593, which is around 4.4624. This is approximately 4. Actually it is a little bit more than 4, about 4+12. But the 2 in the denominator is not correct; the correct denominator is a little bit more than 2  about 2+16, so 41593 is approximately 4+12+16. But the 6 in the denominator is not correct; the correct denominator is a little bit more than 6, actually 6+17. So 41593 is actually 4+12+16+17. This is exact...”
With this in mind, one can define an infinite continued fraction to be a0+1a1+1a2+. With the denominators a0,a1,a2,, we can define a recurrence for the finite approximations (convergents) of this value. For example, the zeroth is a0 and the first is a0+1a1=a0a1+1a1.

The other motivation (the one I actually learned first in real life) for continued fractions comes from 2 being represented by an infinite continued fraction. (Instead of saying a probability of 0.01876, people would rather say a 1 in 53 chance.) So we try to write 2=1.41421356 as 1+12.414. But, instead, notice that 2=1+(21)=1+12+1. Plugging this into itself, we have 2=1+11+1+12+1=1+11+1+11+1+12+1 and notice it can be represented by (1;2,2,2,).

Define the nth convergent to be hnkn, so above we have h0=a0,k0=1 and h1=a0a1+1,k0=a1.

Claim: hn and kn satisfy hn=anhn1+hn2kn=ankn1+kn2 along with h1=1,h2=0 and k1=0,k2=1.

Proof: The fraction hnkn is converted into hn+1kn+1 simply by changing an to an+1an+1 in the final denominator. Since hnkn=anhn1+hn2ankn1+kn2 we similarly have hn+1kn+1=(an+1an+1)hn1+hn2(an+1an+1)kn1+kn2=an+1(anhn1+hn2)+hn1an+1(ankn1+kn2)+kn1=an+1hn+hn1an+1kn+kn1
Thus hn+1 and kn+1 satisfy the same recurrence.

It remains to check the initial conditions work, but note h0=a0h1+h2=a01+0=a0k0=a0k1+k2=a00+1=1 and h1=a1h0+h1=a0a1+1k1=a1k0+k1=a11+0=a1 as we checked above.  

Check out my next post, where I actually accomplish something with fractions (or at least prepare to accomplish something).

No comments: