While chatting through an exercise from A Friendly Introduction to Number Theory with Guille, he pointed out a connection between Pell's equation and Newton's method. I thought the perspective was cool, so I wanted to catalog it here. (There's also a connection with square-triangular numbers, which is explored in exercise 3.5.)
Given a nonlinear equation,
Newton's method seeks to find a root by starting from an initial guess and then updating this guess with the zero of the line tangent to at , i.e.,
Pell's equation, in the case is
We wish to find integer solutions for and . A natural question is given an initial solution, for example , how can generate additional solutions.
A slight rearrangement of Pell's equation gives
As and become large, the fraction will provide better and better approximations to .
Inspired by this observation, we consider solving the equation with Newton's method. Starting from some initial iterate , Newton's method gives the iteration
If is a rational number, then it is clear that will be rational as well, and we can write for some integers and . Plugging this in, we get the iteration
Splitting the numerator and denominator, we have the updates
Assume that is a solution to Pell's equation. Plugging in the update, we see that is also a solution:
In other words, given an initial solution to Pell's equation, e.g., , we can generate additional solutions via Newton's method applied to the root finding problem. The ratio will also provide a better and better approximation to .
Exercise 3.5 in the book derives this procedure using a more geometric approach. This derivation via Newton's method may be well-known (my number theory knowledge is very much lacking), but I thought it was an interesting connection.