# The Fermat-Pell Equation

Consider a Diophantine equation of the form

If d is a perfect square, you can solve the equation directly.

Example. Solve the Diophantine equation .

I can write the equation as

This is an equation in integers, and represents a factorization of 13. There are only two ways to factor 13 in positive integers: and . (You can check that the negative factorizations give the same results.)

Suppose and . This is

So

is an integer solution, so it qualifies as a solution to the original equation. Since x and y appear as and in the original equation, , , and also work.

Similarly, and give (which I already know).

So the solutions to the Diophantine equation are , , , and .

Now suppose I change the problem to . Write it as

The possible factorizations of 10 are , , , and .

Try , . Then

This is not a solution in integers, so this factorization gives no integer solutions.

You can verify that the other factorizations do not give integer solutions. Hence, has no integer solutions.

Now consider the case where d is not a perfect square. The following facts (which I'll state without proof) relate the solutions to to the continued fraction expansion of .

Theorem. Suppose , d is not a perfect square, and . Any positive solution of with satisfies , for some , where is the n-th convergent of the continued fraction expansion of .

The theorem doesn't say which convergent will give a solution. The special form is called the Fermat-Pell equation. In this case, it's possible to say which convergent will solve the equation. I'll state the following facts without proof, and give some examples.

First, recall from the theory of periodic continued fractions that a quadratic irrational --- in particular, a number of the form , where d is not a square --- has a periodic continued fraction expansion.

Theorem. If and d is not a perfect square, then the continued fraction expansion of is periodic, and has the form

Theorem. Suppose and d is not a perfect square. Any positive solution of with satisfies , for some , where is the n-th convergent of the continued fraction expansion of .

Let t be the period of the expansion of .

(a) If t is even, then has no solutions. has solutions , for .

(b) If t is odd, then has solutions , for , and has solutions , for .

Example. (a) Find the first 6 terms ( through ) and the numerators and denominators of the first 6 convergents ( , through , ) of the continued fraction expansion of .

(b) Use the continued fraction for to find solutions to the Fermat-Pell equations

(a)

(b) The expansion has period 4, which is even. Hence, has no solutions.

The first solution to is . You can check that

Example. (a) Find the first 6 terms ( through ) and the numerators and denominators of the first 6 convergents ( , through , ) of the continued fraction expansion of .

(b) Use the continued fraction for to find solutions to the Fermat-Pell equations

(a)

(b) The period is 3, which is odd. The first solution to is given by . You can check that

For , I have , so the first solution is given by . You can check that

In fact, you can generate the solution to the second equation using the solution to the first. Take , and compute

The coefficients give the solution to the second equation.

Here's an interesting example. The continued fraction expansion of is

It repeats after that.

The period is , so has solutions of the form , . The first is

Contact information