# continued fraction expansion for √7 [duplicate]

This question already has an answer here:

Can someone help me find the continued fraction expansion for $\sqrt{7}$ just like I did for below.

For $\sqrt{3}$ I did this:

I was given that $x = \sqrt{3} -1$

$x = \frac{1}{1+\frac{1}{2+x}}$

take the second

$x = \frac{1}{1+\frac{1}{2+x}}$

$x = \frac{1}{\frac{2+x+1}{2+x}}$

$x = \frac{2+x}{x+3}$

$x(x+3) = 2+x$

$x^2 +3x = 2+x \Rightarrow x^2+2x-2=0$

find x,then we are done

how to write $x =\sqrt{3}-1$ in continued fraction using $x = \frac{1}{1+ \frac{1}{2+x}}$

$\sqrt{3}-1 = \dfrac{1}{1+ \dfrac{1}{2+\dfrac{1}{1+\dfrac{1}{2+\dfrac{1}{1+\d frac{1}{2+\dfrac{1}{1+\dfrac{1}{2+\dfrac{1}{1+\dfr ac{1}{2+..}}}}}}}}}}$

I just sub x value each time it will never end

$\sqrt{3}-1 = \dfrac{1}{1+ \dfrac{1}{2+\dfrac{1}{1+\dfrac{1}{2+\dfrac{1}{1+\d frac{1}{2+\dfrac{1}{1+\dfrac{1}{2+\dfrac{1}{1+\dfr ac{1}{2+..}}}}}}}}}}$

so

$\sqrt{3} = 1 +\dfrac{1}{1+ \dfrac{1}{2+\dfrac{1}{1+\dfrac{1}{2+\dfrac{1}{1+\d frac{1}{2+\dfrac{1}{1+\dfrac{1}{2+\dfrac{1}{1+\dfr ac{1}{2+..}}}}}}}}}}$

So it would be <1;1,2,1,2,1,2>

## marked as duplicate by MJD, Andrew D. Hwang, Lord_Farin, Jonas Meyer, Peter WoolfittMar 20 '15 at 20:08

First observe that $2<\sqrt{7}<3$. This is easy to see by taking squares.

Therefore $\sqrt{7}=2+(\sqrt{7}-2)$, where $0<\sqrt{7}-2<1$. We can write it as $$\sqrt{7}=2+\frac{1}{\frac{1}{\sqrt{7}-2}}$$

Now we continue working with the fraction $\frac{1}{\sqrt{7}-2}$. We multiply numerator and denominator by $\sqrt{7}+2$ and get $\frac{\sqrt{7}+2}{3}$. This number is between $1$ and and less than $2$. Therefore we can write it as $$1+\frac{\sqrt{7}-1}{3}.$$ We have so far $$\sqrt{7}=2+\frac{1}{1+\frac{1}{\frac{3}{\sqrt{7}-1}}}$$

We continue to work with the fraction $\frac{3}{\sqrt{7}-1}$. Multiply numerator and denominator by $\sqrt{7}+1$. This results in $\frac{3(\sqrt{7}+1)}{6}=\frac{\sqrt{7}+1}{2}=1+\frac{\sqrt{7}-1}{2}=1+\frac{1}{\frac{2}{\sqrt{7}-1}}$.

We work with $\frac{2}{\sqrt{7}-1}=\frac{2(\sqrt{7}+1)}{6}=\frac{\sqrt{7}+1}{3}=1+\frac{\sqrt{7}-2}{3}=1+\frac{1}{\frac{3}{\sqrt{7}-2}}.$

We work with the fraction $\frac{3}{\sqrt{7}-2}=\frac{3(\sqrt{7}+2)}{3}=\sqrt{7}+2=4+\frac{1}{\frac{1}{\sqrt{7}-2}}$.

At this point the periodicity appears since we have again the fraction $\frac{1}{\sqrt{7}-2}$.

Therefore the continued fraction is $$\sqrt{7}=[2|1,1,1,4,1,1,1,4,....]$$ where the pattern $1,1,1,4$ repeats indefinitely. Such periodicity is expected whenever you are finding the continued fraction of a solution of a quadratic polynomial. In our case $\sqrt{7}$ is a solution of $x^2-7=0$.