Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I enter this equation in Wolfram Alpha : $x^2+x-2y^2=0$ and it gave me something like this :

enter image description here

and I am wondering how this solution is found and how to know if a given equation would guarantee to have integer solution.

Can anyone teach me what's behind the hood?


share|cite|improve this question
It looks like the problem was done by completing the square on the $x$ variable and then using "Pell's equation". I'd suggest looking up the Pell equation to see what's going on. – coffeemath Jan 30 '13 at 10:34

Rewrite the equation: $x^2+x=2y^2$, that is $$x(x+1)=2y^2$$ Notice that $(x,x+1)=1$, so we can write $y^2$ as $2a^2b^2$, here $(a,b)=1$ and $2\nmid b$.
Then we get $$\left\{\begin{array}\\x=2a^2\\x+1=b^2\end{array}\right.\text{ or }\left\{\begin{array}\\x+1=2a^2\\x=b^2\end{array}\right.$$ Hence, $$b^2-2a^2=\pm 1$$ So we get two Pell-like equations. And you know what's going on then?

share|cite|improve this answer

$$8y^2=4x^2+4x=(2x+1)^2-1\implies z^2-8y^2=1\text{ where } z=2x+1$$

Using this,

$$z_k\pm2\sqrt2y_k=(z_1\pm2\sqrt2\cdot y_1)^k$$

By observation, $z_1=\pm3,y_1=\pm1$ as $z^2-8y^2=1=3^2-8\cdot1$

If we take $z_1=3,y_1=1$ $$z_k+2\sqrt2y_k=(3+2\sqrt2)^k \text{ and } z_k-2\sqrt2y_k=(3-2\sqrt2)^k$$

Now solve for $z_k,y_k$

Similarly for the other combinations



and $z_1=-3,y_1=1$

From the recurrence relation in Wikipedia, if $x_1,y_1,x_k,y_k$ are integers, so will be $x_{k+1},y_{k+1}$

share|cite|improve this answer

Expanding on answerr by @lab bhattacharjee:

z^2 = 8.y^2 + 1 gives us equation of form x^2 = N.y^2 + 1

which can be done simply

started in 6th century CE India

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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