# Sequence Converging to the Square Root of an Integer $S \gt 1$

I noticed this answer to the question

$$\quad$$ Continued fraction of a square root

and the comment

So I felt obliged to take this on using the theory of sequences.
Confession: I find it difficult working with continued fractions.

Let $$S \gt 0$$ be an integer that is not the square of another integer.

Let $$a$$ be the greatest positive integer satisfying $$a^2 \lt S$$.

Using the algebra and notation from user Julien Blanchon,

$$x = \frac{S - a^2}{x + 2a}$$

The positive number $$x$$ satisfies $$x \lt 1$$.

Set $$x_0$$ to any positive number and recursively define

$$x_{n+1} = \frac{S - a^2}{x_n + 2a}$$

Show that the sequence $$a + x_n$$ converges to $$\sqrt S$$.

It would be interesting to see if this can be explained using the theory of continued fractions.

My Work

I checked it out using a Python program and would bet that the claim is true. Showing it is true mathematically is another matter, and I'm hoping to see some short answers; I'm not sure how to proceed to 'deconstruct' the method and avoid an algebraic nightmare.

Also, I suspect that it doesn't really matter what you choose for the value of $$a$$ - any positive number will work.

$$a + \frac{S - a^2}{2a + \dfrac{S - a^2}{2a + \dfrac{S-a^2}{2a+\ldots}}}$$ is not a simple continued fraction.
Let $$f(x) = \frac{S - a^2}{2a + x}$$ so your recursion is $$x_{n+1} = f(x_n)$$. This function has two fixed points $$-a \pm \sqrt{S}$$. Since $$f'(-a+\sqrt{S}) = \frac{a-\sqrt{S}}{a+\sqrt{S}}$$ has absolute value $$< 1$$, $$-a + \sqrt{S}$$ is an attracting fixed point. Thus the iteration starting "sufficiently close" to this fixed point will converge to it. Moreover, it's easy to check that there are no $$2$$-cycles. The boundaries of the immediate basin of attraction of an attracting fixed point can only be points on a $$2$$-cycle, repelling fixed points, singular points (where the function goes to $$\infty$$: here $$x = -2a$$), or $$\pm \infty$$. Thus in this case those boundary points are $$-2a$$ and $$+\infty$$. We conclude that $$x_n$$ does converge to $$-a + \sqrt{S}$$ for any $$x_0 > -2a$$.