Trouble with Pell equations

elementary-number-theorynumber theorypell-type-equations

I'm trying to solve the Pell equations

$$x^2-37y^2=1$$

and

$$x^2-37y^2=-1.$$

I've already computed the continued fraction of $\sqrt{37}=[6:\bar{12}]$

In my notes it says that if the period length $n$ of the recurring part of the continued fraction is even, then $x=p_{jn-1}$, $y=q_{jn-1}$ are the solutions of $x^2-dy^2=1$, and there are no solutions for $x^2-dy^2=-1$.

And if $n$ is odd, then the solutions are $x=p_{2jn-1}, y=q_{2jn-1}$ for $x^2-dy^2=1$ and $x=p_{2(j-1)n}, y=q_{2(j-1)n}$ for $x^2-dy^2=-1$ .

It is an odd period length, so the solutions should be $x=p_{2jn-1}, y=q_{2jn-1}$ for $x^2-dy^2=1$, but we can take for example $p_{2jn-1}=p_1=a_0a_1=6.12=72$, and $q_1=a_1$. But this gives $72^2-37(12^2)=-144$ which is clearly not a solution. What am I doing wrong ?

Best Answer

You period $n = 1$.

The first convergent is $\frac{73}{12}$ which means your fundamental solution can be $$x = 73, y = 12$$ and indeed $$73^2 - 37(12)^2 = 1$$

Assuming your continued fraction is right, the second convergent is

$$6+\frac{1}{12+\frac{1}{12}} = \frac{882}{145} $$ and indeed $$ 882^2-37(145)^2 = -1 $$ What you had done wrong is you had a wrong idea of what constituted the "first" convergent, using $12$ instead of $6\frac1{12}$. In point of fact, the zero-th convergent would be $6 = \frac61$ and indeed $$ 6^2 - 37(1)^2 = -1 $$ is the fundamental solution for the equation with $-1$ on the right.

Related Question