# Find all primes $p$ and $q$ such that $p^2-2q^2=1.$

Find all primes $p$ and $q$ such that $p^2-2q^2=1.$

My idea so far was to observe that since $2q^2$ is even, then $q^2$ must be odd or even. If $q^2$ is even, then $q$ is even and the only even prime is $2.$ Thus one pair of primes $(p,q)=(3,2).$

But, if $q^2$ is odd, then $q$ is also odd and $q=2d+1$ for some integer $d.$ Then,

$p^2-2q^2=1$ turns into $p^2=4(2d^2+2d)+3.$

From here I do not know how to proceed.

Any ideas or suggestions would be greatly appreciated.

Since $p^2-2q^2=1$, $p$ must be odd. Furthermore, $q$ must be even; if $q$ were odd, then $p^2-2q^2$ would be $3$ mod $4$. Thus, $q=2$ and then $p=3$.

• Very elegant solution. +$1$ – Clayton Oct 3 '15 at 0:30

From your last expression we have $$\tag1(p+1)(p-1)=2\cdot[\;2(2d^2+2d)+1\;].$$
If $p=2$ then you get from the original expression that $2q^2=3,$ which is impossible. Therefore $p>2$ and hence $p$ is odd. Then $p-1$ and $p+1$ are both even, which implies that their product $(p+1)(p-1)$ is divisible by $4$ which is clearly false by $(1).$ Therefore $q$ must be even and thus it must be equal $2,$ which implies that $p=3.$

Another approach: Since $p^2-2q^2=1$ then $(p+1)(p-1)=2q^2$ and the Unique Factorization Theorem implies that either $p+1=q^2\;\wedge\;p-1=2$ or $p+1=2q\;\wedge\;p-1=q$ but in either case $p=3$ and $q=2.$

• The way you have written your last statement seems a bit unusual. I read it as though you are saying $xy=p\cdot q^2$ where $x$ and $y$ are integers implies $p=x$ and $y=q^2$, which is not true. – Clayton Oct 3 '15 at 0:30
• Thank you for the correction – CIJ Oct 3 '15 at 0:34
• What you've said in your post isn't wrong, it's just how it reads to me. I thought I'd let you know in case it was an error you agreed with and didn't notice beforehand – Clayton Oct 3 '15 at 0:37

HINT ON THE SEARCH OF ALL SOLUTIONS

As an elementary consequence of Dirichlet's theorem of units on number fields, we have for the quadratic cases the general solution of the equation of Pell-Fermat $x^2-dy^2=\pm1$ which concerns the units (a.e. elements of norm equal to $\pm1$) of the field $\mathbb Q(\sqrt d)$.

The field $\mathbb Q(\sqrt2)$ has as fundamental unit of its ring of integers $\mathbb Z[\sqrt 2]$ the number $1+\sqrt 2$ so it is known that all the integer solutions of the equation $$x^2-2y^2=1$$ are given by $$a_{2n}+b_{2n}\sqrt 2=(1+\sqrt 2)^{2n}$$ Here we are interested in all the $(a_{2n},b_{2n})$ being both primes.

$p^2-2q^2\equiv p^2+q^2\equiv 1\pmod{3}$.

But $a^2\equiv \{0,1\}\pmod{3}$ for all $a\in\Bbb Z$, so exactly one of $p,q$ is equal to $3$.

$q=3$ gives $p^2=19$, impossible. $p=3$ gives $(p,q)=(3,2)$.