<s>[INST] Generalise a function, $f\left(x\right)=x^4+ax^3+bx^2$ such that $f$ and $f'$ only has integer roots. 
Consider a function, $f:\mathbb{R}\rightarrow \mathbb{R},\:f\left(x\right)=x^4+ax^3+bx^2$ where $a,b\in \mathbb{Z}\setminus \left\{0\right\}$ and $b\ne \left(\frac{a}{2}\right)^2$ with three distinct real roots whose roots and stationary points have integer $x$ coordinates. Generalise such a function, $f(x)$.

My initial thoughts were to factorise to enforce integer requirement such that $f\left(x\right)=x^2\left(x^2+ax+b\right)$ and finding $x^2+ax+b=\left(x-c\right)\left(x-d\right)$ for some $c,d\in \mathbb{Z}$ but that leads to complications when trying to enforce an integer requirement for $f'(x)$
Any help would be greatly appreciated.
 [/INST] Since $$f(x)=x^2(x^2+ax+b),\qquad f'(x)=x(4x^2+3ax+2b)$$
it is necessary that there are integers $c,d$ such that
$$a^2-4b=c^2,\qquad 9a^2-32b=d^2$$
Eliminating $b$ gives
$$a^2+2(2c)^2=d^2$$
which is of the form $x^2+2y^2=z^2$, so
$$a= \pm k|B^2-2A^2|,\quad 2c=\pm 2ABk,\quad d=\pm k(B^2+2A^2)$$
(where $A,B$ are positive integers and $k$ is a non-negative integer) giving
$$b=\frac{a^2-c^2}{4}=\frac{k^2(B^2-A^2)(B^2-4A^2)}{4}$$
Now, for $a=k(B^2-2A^2)$, we have
$$x^2+ax+b=0\implies x=A^2k-\frac{kB^2}{2}\pm\frac{kAB}{2}$$
$$4x^2+3ax+2b=0\implies x=A^2k-\frac{kB^2}{4},-\frac{kB^2}{2}+\frac{kA^2}{2}$$
For $a=-k(B^2-2A^2)$, we have
$$x^2+ax+b=0\implies x=-\bigg(A^2k-\frac{kB^2}{2}\pm\frac{kAB}{2}\bigg)$$
$$4x^2+3ax+2b=0\implies x=-\bigg(A^2k-\frac{kB^2}{4}\bigg),-\bigg(-\frac{kB^2}{2}+\frac{kA^2}{2}\bigg)$$
Therefore, in conclusion,
$$\color{red}{a=\pm k|B^2-2A^2|,\qquad b=\frac{k^2(B^2-A^2)(B^2-4A^2)}{4}}$$
where $k,A,B$ are positive integers satisfying
$$(B-A)(B-2A)\not=0,$$
$$\frac{kB^2}{4},\frac{kA}{2}\in\mathbb Z$$
</s>