Absolute value equation problem

What are the solutions to the equation $|x^2−1|+|x^2−4|=ax$ where $a, x$ are integers?

So far I've found two solutions just by guessing, they are $(a,x)=(3,1)$ and $(a,x)=(-3,-1)$. I've thought of using the $(x−y)(x+y)=x^2−y^2$ identity, but that didn't help. I've thought of using the absolute value inequality, $|x|+|y|≥|x+y|$, but I don't know of what use it could be.

For $|x|\ge 2$, we have $$(x^2-1)+(x^2-4)=ax,$$ i.e. $$x(2x-a)=5$$ Since $a,x$ are integers, we see that $x$ has to be a divisor of $5$ with $|x|\ge 2$.

So, we get $x=\pm 5$ to have $(a,x)=(9,5),(-9,-5)$.

For $x=\pm 1$, we have $a=\pm 3$.

For $x=0$, there is no such $a$.

Therefore, $\color{red}{(a,x)=(\pm 9,\pm 5),(\pm 3,\pm 1)}$ are the only solutions.

Since you are dealing with integers, you could proceed as follows.

• Conditions on $a$ such that the cases $x\in\{-1,0,1\}$ provide solutions can be checked trivially.

• Under the assumption that $\lvert x\rvert\ge2$, the equation becomes $$2x^2-ax-5=0$$ the solutions of which are $x=\frac{a-\sqrt{a^2+40}}4\vee x=\frac{a+\sqrt{a^2+40}}4$. These quantities are integers if and only if $a^2+40$ is a perfect square and, respectively, $4\mid a-\sqrt{a^2+40}$ or $4\mid a+\sqrt{a^2+40}$.

Notice that, if $2\lvert a\rvert+1>40$, then $a^2=\lvert a\rvert^2<a^2+40<(\lvert a\rvert+1)^2$. So, in order for $a^2+40$ to be a perfect square, the condition $-19\le a\le 19$ is necessary. These are just thirty-nine (times two) cases to check.