The task:
Function below returns approximation to $\sqrt5$:
F(n)
- $r=2.0$
- $for$ $i=1$ $to$ $n$ $do$
- $r=(2r+5)/(r+2)$
- $return$ $r$
Prove that $\lim_{n\to \infty}F(n)=\sqrt5$.
I've found this kind of answer:
At first, let's change $r=(2r+5)/(r+2)$:
$r=\frac {2\times r+5}{r+2}=\frac {2\times (r+2)+1}{r+2}=2\times\frac{r+2}{r+2}+\frac{1}{r+2}=2+\frac{1}{2+r}$
That sum from $1$ to $n$ means that: $r_n=2+\frac{1}{2+r_{n-1}}$(where $r_0=2$)
And now, to prove that $\lim_{n\to \infty}F(n)=\sqrt5$, (where $F(n)=r_n$) will be enough to write continued fraction of $\sqrt5$:
$\sqrt5=\lfloor\sqrt5\rfloor+\frac 1 q$, where $\lfloor\sqrt5\rfloor$ is a floor of number $\sqrt5$
$$\sqrt5=2+\frac 1 q$$ $$\frac 1 q=\sqrt5-2=(\sqrt5-2)\times\frac{\sqrt5+2}{\sqrt5+2}=...=\frac{1}{\sqrt5+2}$$ $$q=\sqrt5+2$$ $$\sqrt5=2+\frac{1}{2+\sqrt5}=...=2+\frac{1}{2+2+\frac{1}{2+2+\frac{1}{2+2+\frac{1}{2+2+\frac{1}{2+\sqrt5...}}}}}$$ $\sqrt5=[2;4,4,4,4...]$ or $\sqrt5=\lim_{n\to \infty}[q_1;q_2,q_3,...]$, where $2\times q_1=q_2=q_3=...=q_n=4$
Now, instead of $\lim_{n\to \infty}F(n)=\sqrt5$ we can write: $$\lim_{n\to \infty}F(n)=\sqrt5=\lim_{n\to \infty}[q_1;q_2,q_3,...]$$ $$\lim_{n\to \infty}F(n)-\lim_{n\to \infty}[q_1;q_2,q_3,...]=0$$ $$\lim_{n\to \infty}{(F(n)-[q_1;q_2,q_3,...])}=0$$ Now if instead of $F(n)$ and $[q_1;q_2,q_3,...]$ we will write our values and count this equation we will get $0=0$, which proves that $\lim_{n\to \infty}F(n)=\sqrt5$.
That's what I've found. I am not even sure that this answer is valid. Any notices or suggestions about this answer would be really appreciated.(I mean if everything is valid, then just let me know, I might be that stupid) Thanks.