# Quadratic Diophantine Equation with Rational Coefficients

The problem is as below:

Solve all solutions to $x^2+\dfrac{p}{q}(xy)+y^2=z^2$ for $x$, $y$, $z\in\mathbb{Q}$ and $p$, $q\in\mathbb{N}$ with $\gcd{(p,q)}=1$.

My attempt: Noticing that for a Diophantine Equation $x^2+axy+y^2$, it's solution is given by:

\begin{equation*} \begin{split} x&=k(an^2-2mn) \\ y&=k(m^2-n^2) \\ z&=k(amn-m^2-n^2). \\ \end{split} \end{equation*}

By multiplying the whole equation with $q^2$ gives $(qx)^2+pqxy+(qy)^2=(qz)^2$. And I'm stuck from here.

• after "Noticing that," what is it that $x^2 + axy + y^2$ is being set equal to???? – Will Jagy Aug 31 '16 at 2:09
• I see, you give an explicit formula for $z,$ so somebody told you that all solutions to $x^2 + axy+ y^2 = z^2$ are given that way. Who told you that? – Will Jagy Aug 31 '16 at 2:13
• @WillJagy Oops, sorry, it should be $z^2$. – blastzit Aug 31 '16 at 2:13
• – blastzit Aug 31 '16 at 2:14
• I requested one of the Andreescu and Dorin books, their 2015 book Quadratic Diophantine Equations rather than the 2010 one mentioned in that earlier question. It is a theorem that the integer solutions of $x^2 + a xy + y^2 - z^2 = 0$ is made up from a finite number of formulas such as you list; for now, I do not see why there is only one. – Will Jagy Aug 31 '16 at 3:48

$$x^2+\dfrac{p}{q}(xy)+y^2=z^2$$

Let $X = \dfrac xz$ and $Y = \dfrac yz$.

$qX^2 + pXY + qY^2 =q$

A solution is $(X, Y) = (1,0)$

So consider a solution of the form $$Y = \dfrac st( X - 1)$$

a line with rational slope which passes through a known solution.

We find\begin{align} qX^2 + pXY + qY^2 &= q \\ qX^2 + p \dfrac st X(X - 1) + q\dfrac{s^2}{t^2}(X^2 - 2X + 1) &= q \\ \left( q + p \dfrac st + q\dfrac{s^2}{t^2} \right)X^2 + \left(-p\dfrac st - 2q\dfrac{s^2}{t^2}\right)X + \left( q\dfrac{s^2}{t^2} - q \right) &= 0 \\ (qt^2 + pst + qs^2)X^2 + (-pst - 2qs^2)X + (qs^2 - qt^2) &= 0 \end{align}

We know that $X = 1$ is a solution. So $X-1$ must be a factor. Dividing by $X-1$ we get $(qt^2 + pst + qs^2)X + (qt^2 - qs^2) = 0$

So $X = \dfrac{qs^2 - qt^2}{qs^2 + pst + qt^2}$ and $Y = \dfrac{-ps^2 - 2qst}{qs^2 + pst + qt^2}$

Hence $(x,y,z) = (qs^2 - qt^2, -ps^2 - 2qst, qs^2 + pst + qt^2)$

• Where coefficient $q$ near $Y$? – Yuri Negometyanov Aug 31 '16 at 23:26
• @YuriNegometyanov - Thanks. I hope I made the appropriate corrections. – steven gregory Sep 1 '16 at 0:35
• @StevenGregory Now our answers matched up to a permutation $x,y.$ – Yuri Negometyanov Sep 1 '16 at 5:02
• These are not always primitive; please see math.stackexchange.com/questions/823199/… – Will Jagy Sep 3 '16 at 1:16

$$qx^2+pxy+qy^2=qz^2$$

$$x=(2qk-pt)t$$

$$y=q(t^2-k^2)$$

$$z=qk^2-pkt+qt^2$$

• Can you give an easy proof to the answer? Thanks for the reply anyways! – blastzit Aug 31 '16 at 6:27
• @blastzit I do not understand. What proof? Identity is performed - this is enough. – individ Aug 31 '16 at 6:32
• But how can you know that every $x$, $y$ and $z$ are in this form? – blastzit Aug 31 '16 at 6:36
• @blastzit To do this, there is a general formula. To prove this we have to use it. Still will not use it. So that does not need any proof. – individ Aug 31 '16 at 6:45

We can use formula \begin{equation*} \begin{split} x&=k(an^2-2mn) \\ y&=k(m^2-n^2) \\ z&=k(amn-m^2-n^2). \\ \end{split} \end{equation*} with $$a=\dfrac pq,\quad k=lq,$$ then \begin{equation*} \begin{split} x&=l(pn^2-2mnq) \\ y&=lq(m^2-n^2) \\ z&=l(pmn-m^2q-n^2q). \\ \end{split} \end{equation*}