# Prove that irrational number $a= \sqrt K$ is a periodic continued fraction

I am trying to understand the proof for this.

As I understand you take $a=[a_0,a_1....]$ and $r_n=[a_n,a_{n+1}...]$ thus $$a=[a_0,a_1,a_2,....r_n] = \frac{r_np_{n-1}+p_{n-2}}{r_nq_{n-1}+q_{n-2}}$$

we then substitute this into the quadratic equation $f(x) = x^2-K$ and get that the discriminant equals 4K. However after that I'm a bit puzzled.

-

So, you get that $r_n$ satisfies an equation of the form $$A_nx^2+B_nx+C_n=0\tag1$$ with $B_n^2-4A_nC_n=4K$. Now the next part of the proof at your first link shows that $A_n$ is bounded, then that $B_n$ and $C_n$ are also bounded. That means there are only finitely many equations of type (1). That means that some equation has to occur repeatedly, as $n$ takes on the values $1,2,3,\dots$. Since each of these equations has only two roots, that means some $r_n$ has to come up more than once. But as soon as some $r_n$ comes up for a second time, the sequence $a_i$ of partial quotients must repeat, and the continued fraction must be periodic.