I want to know the proof that the continued fraction of $\sqrt{n}$ has a period.

This question and answer prove that when the continued fraction has a period, it can be represented by quadratic form. However, it doesn't prove that the continued fraction of quadratic form have a period. According to wikipedia, Lagrange prove it.

"Amazingly, Lagrange's discovery implies that the canonical continued fraction expansion of the square root of every non-square integer is periodic"

Does anybody know how to prove this?


1 Answer 1


I would recommend to read the posts of Ben Lynn on continued fractions. In particular, in the second theorem of this post, he proves what you are basically asking.

The sketch of the prove is the following:

  1. Show that tail fractions $x_k=[a_k, a_{k+1},\ldots]$ of the number $\sqrt{n}=x=[a_0;a_1,a_2,\ldots]$ are the roots of a quadratic equation $Az^2+Bz+C=0$ with integer coefficients.
  2. Show that coefficients $A$, $B$, $C$ are bounded, i.e. $|A|,|B|,|C|<f(x)$.
  3. Since $A,B,C$ are integer and bounded, the number of possible equations $Az^2+Bz+C=0$ is finite, and so is the number of possible values for $x_k$.
  4. That means for some $k,m$: $x_k=x_m$, which means the continued fraction has to repeat itself.
  • $\begingroup$ Thank you. How he get $|ru-ts|=1$? $\endgroup$
    – ueir
    Feb 13, 2020 at 14:02
  • $\begingroup$ By induction you can show that $\begin{pmatrix}p_n&p_{n-1}\\q_n&q_{n-1}\end{pmatrix}=\begin{pmatrix}a_0&1\\1&0\end{pmatrix}\begin{pmatrix}a_1&1\\1&0\end{pmatrix}\cdots\begin{pmatrix}a_n&1\\1&0\end{pmatrix}$. Taking the determinant, you show that $p_nq_{n-1}-p_{n-1}q_n=(-1)^n$ $\endgroup$ Feb 14, 2020 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .