How are continued fractions useful?

Solution 1:

How are continued fractions cool? Let me count the ways:

  1. If you know how to get the partial terms of the continued fraction expansion of an irrational number, you essentially have a way to find approximate values of the irrational number. This gives you one possible way to get a floating-point estimate for $\sqrt{2}$, $\pi$, etc.

  2. It is known that a number is irrational if and only if it has an infinite continued fraction expansion. This makes it a sort of irrationality test.

  3. Continued fraction expansions of irrational numbers exhibit sometimes surprising regularity. $\pi$ and $e$ have continued fraction representations that are simple, which is strange seeing as they are transcendental numbers. This can sometimes tell you things about these numbers, and other times the existence of such a regular expansion is just plain cool.

  4. As mentioned in the comments, continued fractions can be used to solve certain equations like the Pell equation.

And others. Continued fractions solve some other problems - a famous story relates that Mahalanobis and Ramanujan shared a room, and one day Mahalanobis posed Ramanujan a problem which he instantly solved for all cases via continued fractions.

Solution 2:

I once encountered a situation where I had a floating-point number, probably 10 or 12 decimal places long, but I suspected that it was actually a rounded-off version of some rational number with not-too-big denominator (less than 1000). How can I find (or at least guess) the rational number? What I did was to start computing (in Excel, which tells you something about my programming skills) the continued fraction of my floating-point number. For a while, the integers I got were reasonably small ones, but then I got one that was way bigger than the previous ones. So I said: That must be the rounded-off version of $\infty$. In other words, I replaced that big integer with $\infty$, which amounts to cutting off the continued fraction at that step. The resulting finitely long continued fraction is, of course, rational, and it gave the answer I wanted. (Later, I checked with a number theorist, and he confirmed that this is how one should attack such questions.)