# Trouble with Pell 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 ?

• I think the formatting of your equations is wrong – B.Swan Jul 18 at 19:55
• For all $d$ of the form $d=n^2+1$ the fundamental unit of $\mathbb Q(\sqrt{d})$is evident. This is the case here with $37=6^2+1$. – Piquito Jul 18 at 20:50
• @B.Swan would you mind pointing out the error for me ? It might have been a typo in my notes – excalibirr Jul 19 at 14:41
• @excalibirr It was just the wrong format for exponents... already corrected – B.Swan Jul 19 at 14:49

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$$
$$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.