There is a very intimate relation between the approximations of square roots and the Pell equation. Thus the ancient and medieval Indian approximations for √2, namely 1712 and 577408, and the approximations 2615 and 1351780 for √3, all satisfy the Pell equation, when we take the radicand for d, the numerator for x, and the denominator for y. For example, 13512−3×7802=1825201−3×608400=1825201−1825200=1.
We detect that p and q of our approximations pq, 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 p2−Nq2=1. With the formula 2p2−12pq, 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=a2±2an. Then the first approximation is pq=a±1n=an±1n, with p=an±1 and q=n. Their squares are p2=a2n2±2an+1 and q2=n2. Then the Pell equation is p2−Nq2=a2n2±2an+1−(a2±2an)n2=1.
It is important to note that the numerator and the denominator of square roots whose r2a does not have the form 1n, where n is an integer, are not solutions to Pell equations with the result 1. This can be easily shown: If we reduce r2a to the lowest numerator m and denominator n, the first approximation is a±mn=an±mn. Its square is a2n2±2amn+m2n2, where N=a2n2±2amnn2 and the excess is m2n2. The Pell equation is a2n2±2amn+m2−Nn2=a2n2±2amn+m2−a2n2±2amnn2n2=m2. Hence m2=1 only if m=1.
From this we can draw the conclusion that x2−dy2=1 only if the square of the calculated √d has an excess in the form of a unit fraction 1n.
For example, for √22=√52−3≈5−310=4710=4710, where a=5,m=3,n=10, and 310 is not a unit fraction, we get the wrong Pell equation: 472−22×102=2209−2200=9, not 1, because m=3 and m2=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 1972=38809, 22×422=38808, and (19742)2=2211764. Here we have the expected unit fraction. Therefore, we can now apply our formula for the next approximation, 2p2−12pq, with p=197 and q=42. We get 7761716548, and the Pell equation 776172−22×165482=6024398689−6024398688=1.
It is especially simple to find the fundamental solution of the Pell equation for the numbers d=a2+1,a2+2, and a2−2. The first approximations for the square roots of these numbers are respectively a+12a=2a2+12a_,a+22a=a+1a=a2+1a_,anda−22a=a−1a=a2−1a_. The numerators and denominators of the underlined fractions are x and y for d. For d=a2−1, the fundamental solution is always x=a, y=1.