An Elementary Continued Fractions Problem.

September 7, 2011

To celebrate the 15k people who have, for whatever reason, happened upon this blog, I thought I’d post about something kind of fun.  I was going through some of my older books to try to see what I could give away, and I happened upon the sequence

$1 + \cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1 \cdots}}}}$

which should look familiar to you.  Something kind of fun and mean to do is to tell someone who doesn’t know much math to evaluate this.  After they’ve had some time to get frustrated, you note that if we let

$y = 1 + \cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1 \cdots}}}}$

then then the original fraction is just $y = 1 + \dfrac{1}{y}$.  Of course, this has an easy solution; $y^2 - y - 1 = 0$, or $\dfrac{1\pm \sqrt{5}}{2}$ which is known as the golden ratio.  Similar looking "regular" continued fractions can be computed similarly.

For ease of notation, I will say $[a_{0}; a_{1}, a_{2}, \dots ]$ when I mean

$a_{0} + \cfrac{1}{a_{1}+\cfrac{1}{a_{2}+\cfrac{1}{a_{3}+\cfrac{1}{a_{4} \cdots}}}}$

which is standard notation.  Note the semi-colon.  This means the golden ratio is $[1;1,1,1,1,1,\dots]$

It’s kind of neat to see what kinds of things you get with things of the form $[z;z,z,z,z,z,z,\dots]$ where I have purposely used $z$ here to hint that even complex values may be used.  Try out a few values.  Here’s a list of things to try:

1. Try to get a rational number.
2. Try to get a purely imaginary number.  Is it possible?
3. What kinds of numbers will give you rational numbers?  (There is actually a theorem about this!)
4. Can you ever obtain 0?  Why not?  Is it obvious from how we construct $[z;z,z,z,z,z\dots]$?  It it obvious from the solution to the quadratic?
5. (Something I haven’t tried yet!) Do any complex numbers give you real numbers?  Do any complex numbers give you rational numbers?  (After reading below, is $CF_{+}$ analytic?  What does it look like in the complex plane?)

The nice thing about this problem is that it is actually accessible for a student in high school who has seen the quadratic formula!

A little edit below, WITH PICTURES!

Brief Edit: I haven’t tried this for any imaginary numbers, but it’s kind of neat to look at the graphs to see what kind of real numbers give what kind of continued fractions.  I’m going to call $CF_{+}(x) = [x;x,x,x,x,x,x,\dots]$ (the function name is, of course, Continued Fractions).  In other words,

$CF_{+}(x) = \dfrac{x + \sqrt{x^{2} + 4}}{2}$

where notice we have taken "+" in place of $\pm$ in the quadratic formula.  This is the significance of the "+" subscript in the function name.  I’ll plot $CF_{+}$ below:

The first is from -10 to 10; notice that nice "curvy" behavior near the origin.  Notice the near asymptotic behavior in the second quadrant.  Notice the near $f(x) = x$-type behavior in the first quadrant!  The second graph shows this off better, now going from -100 to 100.  I’ve also graphed the first graph against $f(x) = x$ to show you how close they get.

Of course, this isn’t that crazy.  Why not?  As we get larger and larger values of $x$, what happens to $CF(x)$?  Formally, we can write this function as

$CF_{+}(x) = \dfrac{x \pm \sqrt{x^{2} + 4}}{2}$

so what happens when we put in large values of $x$?  Ultimately, the 4 will "contribute less and less" to the sum, allowing the radical to approximate $\sqrt{x^{2}} = x$ for positive $x$.  Hence, our CF function will approximate $CF(x) \sim \dfrac{x + \sqrt{x^{2}}}{2} = x$ for positive $x$.  Taking negative $x$, we see that we obtain nearly the same equation, except we now have that $\sqrt(x^{2})$ will be positive and cancel, leaving us approximating the zero function.  Neato.

For kicks, I’m going to also plot the $CF_{-}$ function, which is the corresponding "take the minus in plus or minus in the quadratic formula" part of the continued fraction function above:

Are you surprised?  Of course not.  Same reasoning as above.

Does this give you a warm geometric feeling in your stomach?  It does for me.  The most interesting part of the graph is the part where it starts turning upwards; this is where that "4" is really doing something.  Kind of neat.