# Extracting Square Roots Made Easy: A Little Known Medieval Method - A Close Connection Between Our Square Roots and the Pell Equation

Author(s):
Friedrich Katscher (Vienna University of Technology)

There is a very intimate relation between the approximations of square roots and the Pell equation. Thus the ancient and medieval Indian approximations for $\sqrt{2},$ namely $\frac{17}{12}$ and $\frac{577}{408},$ and the approximations $\frac{26}{15}$ and $\frac{1351}{780}$ for $\sqrt{3},$ all satisfy the Pell equation, when we take the radicand for $d,$ the numerator for $x,$ and the denominator for $y.$ For example, $1351^2-3 \times 780^2=1825201 - 3 \times 608400=1825201-1825200=1.$

We detect that $p$ and $q$ of our approximations $\frac{p}{q},$ but only those with unit fraction excesses, are solutions of the Pell equation if we set the radicand $N=d,\: p=x,$ and $q=y,$ which yields the Pell equation $p^2-Nq^2=1.$ With the formula $\frac{2p^2-1}{2pq},$ it is easy to obtain new and larger solutions $x$ and $y$ for Pell equations with a given $d.$

It is not difficult to prove why in the first approximation $p$ and $q$ fulfill the Pell equation: You can apply our formula only if $N = a^2\pm \frac{2a}{n}.$ Then the first approximation is $\frac{p}{q}=a\pm \frac{1}{n}=\frac{an\pm 1}{n},$ with $p=an\pm 1$ and $q=n.$ Their squares are $p^2=a^2n^2\pm 2an+1$ and $q^2=n^2.$ Then the Pell equation is $p^2-Nq^2=a^2n^2\pm 2an+1-\left(a^2\pm \frac{2a}{n}\right)n^2=1.$

It is important to note that the numerator and the denominator of square roots whose $\frac{r}{2a}$ does not have the form $\frac{1}{n},$ where $n$ is an integer, are not solutions to Pell equations with the result $1.$ This can be easily shown: If we reduce $\frac{r}{2a}$ to the lowest numerator $m$ and denominator $n,$ the first approximation is $a\pm \frac{m}{n}=\frac{an\pm m}{n}.$ Its square is $\frac{a^2n^2\pm 2amn+m^2}{n^2},$ where $N=\frac{a^2n^2\pm 2amn}{n^2}$ and the excess is $\frac{m^2}{n^2}.$ The Pell equation is $a^2n^2\pm 2amn+m^2-Nn^2=a^2n^2\pm 2amn+m^2-\frac{a^2n^2\pm 2amn}{n^2}n^2=m^2.$ Hence $m^2=1$ only if $m=1.$

From this we can draw the conclusion that $x^2-dy^2 = 1$ only if the square of the calculated $\sqrt{d}\:$ has an excess in the form of a unit fraction $\frac{1}{n}.$

For example, for $\sqrt{22}=\sqrt{5^2-3}\approx 5 - \frac{3}{10} = 4\frac{7}{10}=\frac{47}{10},$ where $a=5,\: m=3,\: n=10,$ and $\frac{3}{10}$ is not a unit fraction, we get the wrong Pell equation: $47^2-22\times 10^2=2209-2200=9,$ not $1,$ because $m=3$ and $m^2=9.$

For $d=22,$ the smallest, or the so-called fundamental, Pell solution, calculated with the help of continued fractions, is $x=197$ and $y=42,$ yielding $197^2=38809,$ $22\times 42^2=38808,$ and $\left(\frac{197}{42}\right)^2=22\frac{1}{1764}.$ Here we have the expected unit fraction. Therefore, we can now apply our formula for the next approximation, $\frac{2p^2-1}{2pq},$ with $p=197$ and $q=42.$ We get $\frac{77617}{16548},$ and the Pell equation $77617^2-22\times 16548^2=6024398689-6024398688=1.$

It is especially simple to find the fundamental solution of the Pell equation for the numbers $d=a^2+1,\, a^2+2,\,$ and $a^2-2.$ The first approximations for the square roots of these numbers are respectively $a+\frac{1}{2a}=\underline{\frac{2a^2+1}{2a}},\, a+\frac{2}{2a}=a+\frac{1}{a}=\underline{\frac{a^2+1}{a}},\,\,{\rm and} \,\,a -\frac{2}{2a}=a-\frac{1}{a}=\underline{\frac{a^2-1}{a}}.$ The numerators and denominators of the underlined fractions are $x$ and $y$ for $d.$ For $d=a^2-1,$ the fundamental solution is always $x=a,$ $y=1.$

Friedrich Katscher (Vienna University of Technology), "Extracting Square Roots Made Easy: A Little Known Medieval Method - A Close Connection Between Our Square Roots and the Pell Equation," Convergence (November 2010), DOI:10.4169/loci003494