# The diophantine equation $a^2+ab-b^2=0$

I first tried with brute force with $-1000 \leq a,b \leq 1000$ but found no solution. But then a simple argument showed me that there was no solution. Not only in the integers, but even for the rationals. What was that argument?

And why is it impossible to solve the equation? $a^2+ab-b^2=0$

$$a=\frac{-b\pm\sqrt{b^2+4b^2}}{2}=b\frac{-1\pm\sqrt{5}}{2}$$

you can see the whole decision no.

If $a^3+ab-b^2=0$ would have acted similarly. $b^2-ab-a^3=0$

$$b=\frac{a\pm\sqrt{a^2+4a^3}}{2}=a\frac{1\pm\sqrt{4a+1}}{2}=a\frac{1\pm{k}}{2}$$

$a$ - to choose such that the root was intact. $a=\frac{k^2-1}{4}$

If $a^2+pab-b^2=0$

$$a=\frac{-pb\pm\sqrt{p^2b^2+4b^2}}{2}=b\frac{-p\pm\sqrt{p^2+4}}{2}$$

There are solutions when: $p=0$

• +1:This answer is also correct though it makes no use of arithmetics. – Marc Bogaerts Sep 5 '14 at 14:12
• But what would you do if the equation were $a^3+ab-b^2$ or even $a^2+pab-b^2$ with p a prime? – Marc Bogaerts Sep 5 '14 at 14:15

For rational numbers, simply write $a$ and $b$ with common denominators, and then clear denominators to get an integer solution. So if there is no integer solution, there is no rational solution.

For integers:

$$a^2+ab-b^2=0$$ $$4a^2+4ab-4b^2=0$$ $$4a^2+4ab+b^2=5b^2$$ $$(2a+b)^2=5b^2$$

Left side is a perfect square; right side is not (by Fundamental Theorem of Arithmetic). Contradiction.

Without loss of generality we can assume that $\gcd(a,b)=1$. If we take the equation modulo $a$ (or b) we get $b^2 \equiv 0 \pmod a$, a contradiction.

• That's not a contradiction immediately. It just forces $a = \pm 1.$ – Geoff Robinson Sep 6 '14 at 1:06

We will prove this by checking out different cases:

Case 1: Both are odd. In that case $a^2 - b^2$ is even and $ab$ is odd. You cannot get zero then.

Case 2: $a$ is odd and $b$ is even: $a^2 - b^2$ is then odd and $ab$ is even. Again, not possible to get zero

Case 3: Same as case 2 with $b$ being odd and $a$ even.

Case 4: Let $a=2n$ and $b=2m$ then we have $a^2+ab-b^2=0 \Rightarrow 4n^2 +4nm -4m^2=0 \Rightarrow n^2+nm-m^2=0$ and if they're even then you repeat this till you obtain one of the other three cases which means none of the cases are possible.

• This is correct but there is a much shorter way to arrive at the result. It uses modular arithmetic. – Marc Bogaerts Sep 5 '14 at 14:06
• You can expand this to work in the rationals. Let $a=a_n/a_d$ and $b=b_n/b_d$. It can be shown that $a^2+ab-b^2=0\iff(a_nb_d)^2+(a_nb_d)(b_na_d)-(b_na_d)^2=0$ and since $(a_nb_d), (b_na_d)$ are both integers, it's proven by the above. – BeaumontTaz Sep 5 '14 at 14:08
• @Nimda, looking at the parity like Sheheryar did is the same as looking at $a,b\pmod{2}$. It's just a very simple version of modular arithmetic. – BeaumontTaz Sep 5 '14 at 14:13
• It was not $\mod 2$ what I had in mind. – Marc Bogaerts Sep 5 '14 at 14:16
• @Nimda, then can you specify in your question what it was you had in mind? Give as much as you can remember about it. – BeaumontTaz Sep 5 '14 at 14:17

For integers it is easy, if a prime $p$ divides $a$ then it divides $b$ and conversely, so $\frac{a}{b}$ can never be a reduced fraction. For rationals multiply by the denominators to reduce to the integer case.

• To fill in some minor details about why $p|a\implies p|b$. Assuming $p|a$ we know that $a=0\pmod{p}$ and $a^2=0\pmod{p}$ Thus $a^2+b(a-b)=0\pmod{p}$ reduces to $b(a-b)=0\pmod{p}$ which implies either $b=0\pmod{p}$ or $a-b=0\pmod{p}$. The latter is the same as the former. So $p|b$. – BeaumontTaz Sep 5 '14 at 14:26
• better to say $p|a$ and $a(a+b)+b^2=0$ so $p|b^2$ so $p|b$ – Rene Schipperus Sep 5 '14 at 14:28

If there were a rational solution, we could multiply it through by the square of a suitable non-zero integer to get an integer solution, so we may suppose that $a,b \in \mathbb{Z}.$ But now if $c = {\rm gcd}(a,b)$ we can divided through by $c^{2}.$ Hence we may suppose that $a,b \in \mathbb{Z}$ and that ${\rm gcd}(a,b) = 1.$ Now, however, $b^{2} = a(a+b),$ so that $a$ divides $b^{2}$. Hence $a$ divides ${\rm gcd}(a^{2},b^{2}) = 1.$ Thus $a = \pm 1.$ Similarly, $b$ divides $a^{2}$ and $b = \pm 1.$ These two facts together yield a contradiction, as $a^{2} +ab$ is then even and $b^{2}$ is odd.