How can I solve (find all the solutions) the nonlinear Diophantine equation $x^2-3x=2y^2$?

I included here what I had done so far. Thanks for your help.

Note: The equation above can be rewritten into $x^2-3x-2y^2=0$ which is quadratic in $x$. By quadratic formula we have the following solutions for $x$.

\begin{equation} x=\frac{3\pm\sqrt{9+8y^2}}{2} \end{equation}

I want $x$ to be a positive integer so I will just consider: \begin{equation} x=\frac{3+\sqrt{9+8y^2}}{2} \end{equation}

From here I don't know how to proceed but after trying out values for $1\leq y\leq 1000$ I only have the following $y$ that yields a positive integer $x$.

\begin{equation} y=\{0,3,18,105,612\}. \end{equation}

Again, thanks for any help.


Multiply through by $4$ and complete the square, $(2x-3)^2 - 8 y^2 = 9,$ so that $(2x-3)^2 + y^2 \equiv 0 \pmod 3.$ It follows that both $(2x-3)$ and $y$ are divisible by $3,$ therefore $x$ as well. Write $x=3t, y=3v.$ So far $(2t-1)^2 - 8 v^2 = 1.$ Let $u=2t-1,$ so $u^2 - 8 v^2 = 1.$

...if we write $$ x = \frac{3(1+u)}{2} $$ and $$ y = 3v, $$ we get $$ u^2 - 8 v^2 = 1. $$ This gives a sequence of pairs, $u=1,3,17,99,...$ and $v=0,1,6,35...$

see https://oeis.org/A001541 and https://oeis.org/A001109

These obey $$ u_{n+1} = 3 u_n + 8 v_n, $$ $$ v_{n+1} = u_n + 3 v_n. $$ By Cayley-Hamiton $$ u_{n+2} = 6 u_{n+1} - u_n, $$ $$ v_{n+2} = 6 v_{n+1} - v_n. $$ Then

$$ x_{n+2} = 6 x_{n+1} - x_n - 6, $$ $$ y_{n+2} = 6 y_{n+1} - y_n. $$ The (non-negative) $(x,y)$ pairs begin $$ (3,0) $$ $$ (6,3) $$ $$ (27,18) $$ $$ (150,105) $$ $$ (867,612) $$ $$ (5046,3567) $$

  • $\begingroup$ Thanks Sir @WillJagy for the comprehensive answer. This is exactly the answer I am looking for. Thanks again. $\endgroup$ – Jr Antalan Sep 17 '15 at 21:48
  • $\begingroup$ Good Day Sir @WillJagy. I just want to ask if you can suggest a reference in helping me solving equations of this type: $x^2-3x=2y^n$ where $n\geq 2$. This is a generalization of my question here on MSE. Thanks a lot. $\endgroup$ – Jr Antalan Sep 20 '15 at 0:13
  • $\begingroup$ @JrAntalan, no particular reference. When $n=3,$ it might be (I'm not sure) that it separates into a small number of Mordell curves, in which case the answers are sometimes tabulated on websites. For $n \geq 4$ i have no idea, except to point out the great likelihood of finiteness. $\endgroup$ – Will Jagy Sep 20 '15 at 0:22
  • $\begingroup$ ok Sir, thanks a lot. $\endgroup$ – Jr Antalan Sep 20 '15 at 0:30
  • $\begingroup$ Sir, I am trying to revisit your answer and it was brilliant! But I am curious about your method on solving this non-homogeneous Diophantine Equation. Is there a general method on solving 2nd order non-homogeneous Diophantine Equations such as the given here? If so, can you recommend some readings on it Sir? I do not find any method on my search over the web. Thank you so much Sir, I will also send some message thru email Sir about this topic. Again thank you. $\endgroup$ – Jr Antalan Oct 24 '15 at 12:34

It is evident that equation.


This is a Pell equation. And we have to use solutions which are determined by the sequence. The next value from the previous one.



If we use the sequence where the first number. $(p_1 ;s_1) - (1 ; 1)$

Decisions will be.



If we use the sequence where the first number. $(p_1 ;s_1) - (3 ; 2)$

Decisions will be.



  • $\begingroup$ You mean "solutions", not "decisions". $\endgroup$ – user236182 Sep 18 '15 at 6:23

I'll solve it in integers instead. $x^2-3x=2y^2$, by the quadratic formula, is equivalent to


So i.e. the problem is equivalent to solving $8y^2+9=m^2$ in integers.

$8y^2\equiv m^2\pmod{3}$, so $(y,m)=\left(3y_1,3m_1\right)$ for some $y_1,m_1\in\Bbb Z$, because $h^2\equiv \{0,1\}\pmod{3}$ for any integer $h$.

The problem is equivalent to $m_1^2-8y_1^2=1$ with $m_1,y_1\in\Bbb Z$. This is a Pell's Equation and has infinitely many solutions given exactly by $\pm\left(3+\sqrt{8}\right)^n=x_n+y_n\sqrt{8}$ for $n\ge 0$ (because $(m_1,y_1)=(3,1)$ is the minimal non-trivial solution), so for example $\pm\left(3+\sqrt{8}\right)^2=\pm17\pm6\sqrt{8}$ and $(m_1,y_1)=(\pm 17,\pm 6)$ is another solution.

In general, Pell's Equation $x^2-dy^2=1$ with $d$ not a square has infinitely many solutions; which are given exactly by $\pm\left(x_m+ y_m\sqrt{d}\right)^n=x_n+y_n\sqrt{d}$, $n\ge 0$, where $(x_m,y_m)$ is the minimal solution, i.e. the solution with $x_m,y_m$ positive integers and minimal value of $x_m+ y_m\sqrt{d}$.

  • $\begingroup$ thanks for the answer @user236182 . I have a question from your answer since Im a bit confused. the expression $3\cdot [(3+\sqrt{8}^n)]_{\sqrt{8}}$ is always an integer? I am not familiar with the notation$_{\sqrt{8}}$ $\endgroup$ – Jr Antalan Sep 17 '15 at 14:09
  • $\begingroup$ @JrAntalan I created the notation myself. I thought the example would make it clear, sorry for the confusion. $\endgroup$ – user236182 Sep 17 '15 at 14:10
  • $\begingroup$ it is okay, thanks for the answer. an up vote for that, will consider it as a correct answer once I understand the whole thing. Thanks again. $\endgroup$ – Jr Antalan Sep 17 '15 at 14:12
  • $\begingroup$ @JrAntalan Please tell me if anything is unclear about my answer. I've edited it. $\endgroup$ – user236182 Oct 25 '15 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.