# Substitution (…and Continued Fractions)

Today in Precalculus I went on a bit of a 7 minute digression, talking about continued fractions. You see, a recursive problem showed up (we’re doing sequences): Write out the first five terms of the following sequence: $a_{n+1}=\sqrt{2+a_n}$ where $a_1=\sqrt{2}$

So obviously they go like: $a_1=\sqrt{2}$, $a_2=\sqrt{2+\sqrt{2}}$, $a_3=\sqrt{2+\sqrt{2+\sqrt{2}}}$, $a_4=\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2}}}}$, and $a_5=\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2}}}}}$

So great. Awesome. NOT. Booooring. So I showed them the decimal expansions: $\approx 1.414, \approx 1.848, \approx 1.961, \approx 1.990, \approx 1.998, \approx 1.999, \approx 1.9998, \approx 1.99996, \approx 1.999991, \approx 1.999997647$

WHOA! This is getting closer and closer to 2… Weiiiird…

And then I say I can show them this will continue, and we can find a way to show that $\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+...}}}}}$ [where the pattern continues forever] will practically become 2.

To do this, I start with something else. I don’t know why, but I really wanted to show them a continued fraction first, to get the point across easier than with the square root. This was the continued fraction. I went through a frenetic mini-lecture, and I think I had about 40% of the kids along with me for the whole ride. I’m not sure… maybe? But later a kid came by my office, and I thought of a better way to show it. Hence, this blogpost, to show you. (I have seen teachers use this method when teaching substitution when solving systems of equations… but I have never used it myself. I’m dumb! This is awesome!) This is what I did when showing the kid how to think about this in my office.

First I took a small piece of paper and I wrote the infinite fraction on it. Then I flipped it over and on the back wrote what it equaled… Our unknown $x$ that we were trying to solve for. I emphasized that that card itself represented the value of that fraction. The front and back are both different ways to express the same (unknown) quantity we were looking for.

Then I took a big sheet of paper and wrote $1+\frac{1}{}$ where I left the denominator blank. And then I put the small card (fraction side up) in the denominator of the fraction… And I said… what does this whole thing equal?

And without too much thinking, the student gave me the answer… Yup. We’ve seen that infinite fraction before. That is $x$!

Flip. THAT FLIP IS THE COOLEST THING EVER FOR A MATH TEACHER. That flip was the single thing that made me want to blog about this.

Now you have an equation that you can solve for $x$… and $x$ is what you’re trying to find the value of. This equation can easily be turned into a quadratic, and when you solve it you get $x=\frac{1+\sqrt{5}}{2}\approx 1.618$ (yes, the Golden Ratio). And it turns out that is close to what we might have predicted…

Because in class, we (by hand) calculated the first few terms of $a_{n+1}=1+\frac{1}{a_n}$ where $a_1=1$… and we saw: $1, 2, 1.5, 1.66666666, 1.6, 1.625, ...$

And when I drew a numberline on the board, plotted 1, then 2, then 1.5, then 1.66666666, then 1.6, then 1.625, we saw that the numbers bounced back and forth… and they seemed to be getting closer and closer to a single number… And yes, that single number is about 1.618.

COOL! 

BACK TO OUR REGULARLY SCHEDULED PROGRAM

So after I showed them how to calculate the crazy infinite fraction, I went back to the problem at hand… What is $\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+...}}}}}$?

Let’s say $\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+...}}}}}=x$

Then we can say $\sqrt{2+x}=x$

And even simply by inspection, we can see that $x=2$ is a solution to this!

Fin.

 What’s neat is that yesterday I introduced the notion of a recursive sequence that relies on the previous two terms. So soon I can show them the Fibonacci sequence (1,1,2,3,5,8,13,…). What does that have to do with any of this? Well let’s look at the exact values of $a_{n+1}=1+\frac{1}{a_n}$ where $a_1=1$. $2, \frac{3}{2}, \frac{5}{3}, \frac{8}{5}, \frac{13}{8}, ...$. WHAAAA?!?!

Lovely. It’s all coming together!!!

1. howardat58 says:

I’m having a “wanna be a real pain in the ????”evening, so
the Fibonacci sequence should start at 2/1, not at 1.
Otherwise I love it all !!!!!!!

1. samjshah says:

Duh! Thanks!

2. revuluri says:

Love the flip! And your mention of the number line representation also reminded me of another way to display (which if I had to guess, I first saw when I read “Chaos” back when I was in high school) — on the x-axis, put the value of a_n, and then on the y-axis, put the value of a_n+1. Makes a cool picture! (If I had any idea what to Google, I’d do so and link to a diagram here, but I don’t know what it’s called or even how others would describe it.)

1. samjshah says:

I think it’s called a “phase portrait.” For me, the number line was really beautiful. I think for this a phase portrait would have been okay, but it would have taken waaay longer to get students to understand what we were doing and why (in plotting it in that way) — to get the same effect. But you’re right — it is such a useful tool/visualization for many recursive sequences. I worked with two kids last year on the Logistic Equation and they generated phase portraits of that, as well as the bifurcation diagram!

3. Steven Carr says:

I did the square root thing by squaring both sides and getting 2 + x = x^2

You can also solve quadratic equations by continued fractions.

x^2 + 2x = 8 turns into x = 8/(2+x).

So x = 8/(2 +8/(2+x)) etc

This continued fraction gets closer and closer to 2.

1. samjshah says:

Ooooh! The backwards question!!! Love it!

4. Cleargrace says:

Recursives are symphonies! Within the music, I can hear every instrument – you just made beautiful music! I love the card. I also see how I can use that for something else I am teaching my ALG II class! Thank you!

1. samjshah says:

Yay for cards for substitution. I wish I could remember whose blog I saw that on for systems of equations… I did the card because I saw the infinite fraction as a “fractal” and so I thought I could use the card for the self-similarity. But once I did it, I realized that’s exactly what someone else did for systems of equations!

5. Lisa says:

This is great! I did it today in class and it really helped. THANKS!

6. Elaine Watson says:

I love it! Thanks for sharing the idea of using the card for substitution, which makes it so intuitive for students.

7. mrstuartcampbell says:

Reblogged this on Mr Campbell Writes… and commented:
This one’s really only for the Maths teachers of there. But I saw it and just had to reblog it! Awesome. SC.

8. Amy Zimmer says:

Works for e, no? Now I gotta go back and give the Pre- Calc kids a visual stunner! Thanks

1. Amy Zimmer says:

Ack! Time change and brain damage…not gonna happen for e. Whaaa….Love all of it just the same….Amy

9. Joshua says:

Here’s another interesting coincidence about your choice of the [1,1,1,1,…] continued fraction as an illustration:

Sqrt(x) has two choices and, conventionally, we prefer the positive branch. However, what if you sometimes took the negative inside your nested square roots? Would the series still converge and, if so, to what values?

Let’s do one special case where we just alternate the signs: sqrt(2-sqrt(2+sqrt(2-sqrt(2….)))

You can do your substitution trick again, but have to start 2 levels down. Square once, rearrange terms, then square again to get rid of all the radicals and liberate your starting variable.

You think, ugh, this is a quartic and I don’t remember how to calculate roots of quartic polynomials. However, notice that the original (all positive) sequence will also satisfy this quartic. A little more thought will also turn up another (discarded) root from your original analysis that also has to be a root of this quartic. That means we have a quadratic polynomial factor of our quartic.

Doing some quick polynomial long-division, you get x^2 + x -1 as the other factor. For those fibonacci/golden ratio fans, this quadratic will already look familiar. You can quickly see that the positive root here is the inverse of the golden ratio and is, indeed the value to which our nested alternating positive/negative roots converges.