# Golden ratio

1. Jun 9, 2016

### geoffrey159

1. The problem statement, all variables and given/known data

I'm helping a 12th grader with his homework, and he is asked to prove the following equality as the conclusion of a problem :

$1 + \frac{1}{1+ \frac{1}{1+...}} = \sqrt{1+ \sqrt{1+ \sqrt{1+...}}}$

Written like this, the formula is intimidating while it really shouldn't be after working the problem.
But still, I have a doubt now and would like to see the output of a computer program. Can someone with programming skills compare these terms to the golden ratio and print a few outputs ?

Thank you.

2. Relevant equations

3. The attempt at a solution

2. Jun 9, 2016

### phyzguy

Interesting. I'm assuming, that since this isn't your homework, I won't run afoul of PF rules by providing you with a solution. Here is the simple Python program I wrote:
Code (Text):

import numpy as np
def ContinuedFraction(n):
D = 1.0
for i in range(n):
D = 1.0 + 1.0 / D
return D

def ContinuedSquareRoot(n):
D = 1.0
for i in range(n):
D = np.sqrt(1.0 + D)
return D

for n in range(25):
print("n = %d, ContinuedFraction = %.9f, ContinuedSquareRoot = %.9f"%(n,ContinuedFraction(n),ContinuedSquareRoot(n)))

And here are the first 25 terms:
n = 0, ContinuedFraction = 1.000000000, ContinuedSquareRoot = 1.000000000
n = 1, ContinuedFraction = 2.000000000, ContinuedSquareRoot = 1.414213562
n = 2, ContinuedFraction = 1.500000000, ContinuedSquareRoot = 1.553773974
n = 3, ContinuedFraction = 1.666666667, ContinuedSquareRoot = 1.598053182
n = 4, ContinuedFraction = 1.600000000, ContinuedSquareRoot = 1.611847754
n = 5, ContinuedFraction = 1.625000000, ContinuedSquareRoot = 1.616121207
n = 6, ContinuedFraction = 1.615384615, ContinuedSquareRoot = 1.617442799
n = 7, ContinuedFraction = 1.619047619, ContinuedSquareRoot = 1.617851291
n = 8, ContinuedFraction = 1.617647059, ContinuedSquareRoot = 1.617977531
n = 9, ContinuedFraction = 1.618181818, ContinuedSquareRoot = 1.618016542
n = 10, ContinuedFraction = 1.617977528, ContinuedSquareRoot = 1.618028597
n = 11, ContinuedFraction = 1.618055556, ContinuedSquareRoot = 1.618032323
n = 12, ContinuedFraction = 1.618025751, ContinuedSquareRoot = 1.618033474
n = 13, ContinuedFraction = 1.618037135, ContinuedSquareRoot = 1.618033830
n = 14, ContinuedFraction = 1.618032787, ContinuedSquareRoot = 1.618033940
n = 15, ContinuedFraction = 1.618034448, ContinuedSquareRoot = 1.618033974
n = 16, ContinuedFraction = 1.618033813, ContinuedSquareRoot = 1.618033984
n = 17, ContinuedFraction = 1.618034056, ContinuedSquareRoot = 1.618033987
n = 18, ContinuedFraction = 1.618033963, ContinuedSquareRoot = 1.618033988
n = 19, ContinuedFraction = 1.618033999, ContinuedSquareRoot = 1.618033989
n = 20, ContinuedFraction = 1.618033985, ContinuedSquareRoot = 1.618033989
n = 21, ContinuedFraction = 1.618033990, ContinuedSquareRoot = 1.618033989
n = 22, ContinuedFraction = 1.618033988, ContinuedSquareRoot = 1.618033989
n = 23, ContinuedFraction = 1.618033989, ContinuedSquareRoot = 1.618033989
n = 24, ContinuedFraction = 1.618033989, ContinuedSquareRoot = 1.618033989

3. Jun 9, 2016

### RUber

The golden ratio is defined to be:
$\varphi = \frac{1+\sqrt{5}}{2}.$
This is exactly what you get for solutions to the continued fraction and continued radical forms you expressed above.
Analytically, and numerically (shown by phyzguy), you arrive at the same conclusions.

4. Jun 9, 2016

### geoffrey159

Yes, we had the analytical answer, as the limit of two converging sequences, but the way the question was put, I suddenly had a doubt and needed to see it work on a computer program. But thanks to @phyzguy 's program I am convinced now :-)

5. Jun 9, 2016

### Ray Vickson

You can also convince yourself of those results using elementary algebra (entirely suited to a Grade 12 student). Assuming that the continued fraction exists (and there are theorems about that), call it $S$. If you look carefully at the form of $S$ you will see that the first denominator on the right is $S$ again, so $S$ obeys the equation
$$S = 1 + \frac{1}{S}$$
Clearly, $S > 0$, so solving the resulting quadratic you get $S = (1+\sqrt{5})/2$ for the positive root.

You can also write $S^2 = S + 1$ (from the equation above), so $S = \sqrt{1+S}$, and iterating that gives the second form
$$S = \sqrt{1+ \sqrt{1+ \sqrt{1+...}}}$$

6. Jun 9, 2016

### SteamKing

Staff Emeritus
Man, if I had problems like this in 12th grade, I don't think I would have graduated HS ...

7. Jun 9, 2016

### geoffrey159

Lol, this is not a lonely question in a problem set, it is the conclusion of a lengthy problem on sequences, and all the steps needed to answer this question were worked in previous questions. There was almost no work involved here, but honestly, this equality looks too good, and I found it hard to believe without testing it.

Thank you everyone

8. Jun 9, 2016

### late347

As far as the subject matter goes, it probably depends on the curriculum that is used, but in some countries 17-year olds have rational equations and functions are inside the calculus course (it seems debateable whether it is pre-calculus).It probably differs from country-to-country.

I must admit that the eternally continuing division notation makes my eyes bleed... Same with the eternally continuing squarerroot...

1.How does one assume that the fraction exists? Where did you come up with S= 1+ 1/S

2.why must S be greater than zero? (therefore positive number)
Obviously it seems that S should be unequal to zero at the very least.
why not something like
S= -0.001

This kind of value might make things bad for the squareroot side, though....

$x= 1 + \frac {1} {x}$
$x^2 ~~ = x +1$
$0= ~~-x^2~~+x~~+1$

negative cannot be inside the squarerroot sign. This seems to be problematic for the squarerroot side of the equation. Is that the reason for disregarding the negative root?

$$\frac {1- \sqrt {5}} {2} = -0,618033.....$$
$$\frac {1+ \sqrt {5}} {2} =~~ 1,618033...$$

$x= \sqrt {x~+1}$
$x=~ 1~+\frac {1}{x}$

$1~+\frac {1}{x}~~=~~\sqrt {x~+1}$

result would be negative = positive which is contradicting in a sense, when the negative root is inputted on the left hand side [$x~~=~~-0,618033....$]

Last edited: Jun 9, 2016
9. Jun 9, 2016

### Ray Vickson

For your question 1: I did say that there were theorems about existence (but did not quote them). As to why $S = 1 + \frac{1}{S}$: I did offer an explanation. What I part of that explanation is unclear to you?

For your question 2: $S$ is made by adding positive quantities together, so how could it ever come out negative?

I have no idea what the rest of your post is about. Of course we can re-write $x^2 = x+1$ as $-x^2 + x+1 = 0$, and can apply the quadratic solution of the general equation $ax^2 + bx + c = 0,$ just by putting $a = -1, b = 1, c = 1$. If you prefer, you can re-write the equation as $x^2 - x - 1 = 0$ and deal with that, instead.

There is no way you can validly and legally obtain "negative = positive" from what I said. If you have managed to do that you have made an error.

10. Jun 10, 2016

### late347

I think for me the un-ending fraction notation was the most difficult part. I suppose I'm more acquainted with recursive notation... I did not understand the algebra behind point 1. [ S= 1 + 1/S ]

I think I understood point 2 now. But point 1 seems little bit unclear to me still. For me it was difficult to understand what exactly was the zero-eth term. And what exactly was the first term, and the second term. If you wanted to calculate only limited number of terms from the continued fraction, from n0 to n5. How could you calculate only a limited number of terms from the continued root or from the continued fraction? Certainly it does seem like only 1's are being added into the continued fraction. This would tell us to disregard the negative root of $S^2~~= S~~+1$ , I presume. You are correct that it is impossible to get negative values out from calculating addition and division with only 1's, because, (1>0)

couple questions for clarity's sake...
I can see readily from phyzguy's post what the numerical values would be like. No problem with that post.
I put on my graph calculator the recursive notation such as
$a_{n+1}~~= \frac {1} {a_n} +1$ and it seemed to give me the correct values for the fraction. Same as phyzguy's values, differing only by the accuracy of the representation...

3.) Are the two sequences actually equal between each other (continued fraction) and (the continued root)? It does not appear that the sequences are equal. I was looking at a Finnish language math resource about sequences. According to that math teacher. Two sequences are equal if they have same terms, in the same order. (the teacher didn't really elaborate that one beyond that simple description). Clearly one can see that the third term n=3. When the third term is calculated for the continued fraction, and the third term for the continued root... the results are non-equal. If the terms are unequal, how could the sequences be equal then?

4.) Are the sequences equal, or do the sequences just have the same limit? How could the sequences be equal, because the first three terms are unequal when you compare the terms n=0, n=1, n=3, are unequal for the root, and for the fraction side?

5.) Although if you actually were to calculate infinitely many terms for each of those sequences ( the so-called ... notation) Then I think it seems good to say that those sequences would be equal because they tend to converge toward φ ≈ 1,618

11. Jun 10, 2016

### RUber

If you choose to make these into finite sequences, then no, the sequences are not equal...you can see this in the numerical trials from post #2. But, as you noted the limits of the sequences as your number of terms goes to infinity are same value, thus the infinite expressions are equivalent.

As written the two are equivalent, as they are not sequences, but simply the infinite expressions.

This is, in effect, the same reasoning applied to say that
$0.33333... = 1/3$
You assume that the infinite part has a value, and apply algebra to that value.
$A = 0.33333...\\ 10A = 3.33333...\\ 10A-A = 3\\ A = 1/3$