Find $p,q$ s.t. $2q^2-p^2=\Box$ and $2p^2-q^2=\Box$

Problem. Find all integers $p,q$ such that $2q^2-p^2$ and $2p^2-q^2$ are perfect squares.

I think this is only true when $p=\pm q$ but I have not been able to prove it.

One approach I tried is letting (wlog) $q=p+t$ with $t>0$ to get $p^2+4pt+2t^2$ and $p^2-2pt-t^2$ are squares. Then completing the square we have $(p+2t)^2-2t^2$ and $(p-t)^2-2t^2$, but I didn't get much from here.

Another thing I tried is setting $2q^2-p^2=x^2$ to get $x^2+p^2=2q^2$, and similarly $y^2+q^2=2p^2$. Then write these as $(x-p)^2+(x+p)^2=(2q)^2$ and $(y-q)^2+(y+q)^2=(2p)^2$, then use the Pythagorean triples formula. But it got a bit messy after that.

• With your notations, $x^2 - y^2 = (x-y)(x+y) = 3(q^2-p^2) = 3 (q-p)(q+p)$, so $3 \mid x-y$ or $3\mid x+y$. Does that lead to something? – Alexandre Halm Mar 29 '15 at 20:07
• I've added the 'contest-math' tag to this question as it seems olympiad-like. – user26486 Mar 30 '15 at 12:11

We may assume WLOG $p,q\in \mathbb{N}^+$ and $\gcd(p,q)=1$.

Lemma 1. If $\gcd(a,b)=1$ and $a^2+b^2=2c^2$, then: $$\{a,b\} = \{u^2-2uv-v^2,u^2+2uv-v^2\},\quad c=u^2+v^2,\quad \gcd(u,v)=1.$$

Proof. We have that $P=\left(\frac{a}{c},\frac{b}{c}\right)$ is a rational point on the circle $\Gamma:x^2+y^2=2$, hence the line joining $P$ with $(1,1)\in\Gamma$ has a rational slope. The vice-versa also holds: by Vieta's formulas, a line with rational slope through $(1,1)$ intersects $\Gamma$ in a rational point.

Lemma 1. gives that both $p$ and $q$ are the sum of two squares and are represented by the quadratic form $A^2-2B^2$. Moreover, both $3p^2$ and $3q^2$ are represented by the quadratic form $A^2+2B^2$.

Lemma 2. If $\gcd(a,b)=1$ and $a^2+2b^2 = 3c^2$, then: $$a=2u^2+4uv-v^2,\quad b=2u^2-2uv-v^2,\quad c=2u^2+v^2,\quad \gcd(u,v)=1.$$

Proof. We have that $P=\left(\frac{a}{c},\frac{b}{c}\right)$ is a rational point on the ellipse $\Gamma:x^2+2y^2=3$, hence the line joining $P$ with $(1,1)\in\Gamma$ has a rational slope. The vice-versa also holds: by Vieta's formulas, a line with rational slope through $(1,1)$ intersects $\Gamma$ in a rational point.

Lemma 2. gives that $p$ and $q$ are both represented by the quadratic form $A^2+2B^2$. By putting all together, we have that both $p$ and $q$ are represented by the quadratic forms $$A^2+B^2,\quad A^2-2B^2,\quad A^2+2B^2.$$ Now it is possible to set a descent argument leading to $p=q=1$. Continues.

• @Ark: you will find this page really useful: en.wikipedia.org/wiki/Vieta_jumping – Jack D'Aurizio Mar 29 '15 at 21:45
• @Ark: the approach outlined above find all the rational points on $ax^2+bxy+cy^2=1$ given one rational point, no matter if the conic section is a circle, a hyperbola or whatsoever. I will expand my answer tomorrow, now it is a bit late. – Jack D'Aurizio Mar 29 '15 at 23:07
• @Ark: I am quite busy, but in the meantime you may have a look at mathpages.com/home/kmath044/kmath044.htm , I bet you'll find it really inspiring. – Jack D'Aurizio Mar 30 '15 at 12:13

If I'm not mistaken, this problem is a direct consequence of that theorem!--This has just occurred to me. Because if $x,y,p,q$ are distinct then $x^2+p^2=2q^2$ and $y^2+q^2=2p^2$ together imply $p^2-y^2=q^2-p^2=x^2-q^2$, which implies the existence of an arithmetic progression, $y^2,p^2,q^2,x^2$, consisting of four distinct squares. Now this is impossible (by Jack D'Aurizio's link: mathpages.com/home/kmath044/kmath044.htm ), and so two of the squares must be equal. This immediately leads to (supposing $x,y,p,q\in \mathbb{Z}_+$) $x=y=p=q$.