If $x^3+3x^2+k=0$ has integer roots then find the number of non zero integral solutions to $k$
I have already solved the problem by sketching a graph of $x^3+3x^2=-k$ and arrived at the answer of $4$, namely $k=-1,-2,-3,-4$. But then I tried to think of an alternative solution, however for some reason I couldn't see it gave me the wrong answer.
Since coefficient of $x$ is zero the product of two roots taken at a time is also $=0$. Thus, if the $3$ roots are $\alpha,\beta,$ and $\gamma$ then $$(\alpha+\beta+\gamma)^2=\alpha^2+\beta^2+\gamma^2$$ $\Rightarrow 9= \alpha^2+\beta^2+\gamma^2$
The only non zero integral solution to this that also satisfies $(\alpha+\beta+\gamma)=-3$, are, without loss of generality,
$\alpha=1$, $\beta=-2$, $\gamma=-2$
So, the product of roots $k=4$ and that's the only solution.
But of course as I said this contradicts the solution we get from sketching the graph. What am I doing wrong here?
Hint: For $k=-1$ the polynomial $x^3+3x^2-1$ certainly has no integer root, because by the rational root theorem, this could only be $x=\pm 1$, which isn't a root. The same holds for $k=-3$. On the other hand, for $k=-4$, $x=1$ is an integer root, and for $k=2$, $x=-1$ is an integer root.
Question: Do we need to have all roots integers? If not, we can just put $x$ an arbitrary integer and set $k=-x^3-3x^2$. Then we have an integer root for this $k$. If yes, we can compare the polynomial with $(x-a)(x-b)(x-c)$ for integers $a,b,c$ and obtain that $a+b+c=0$ and $ -a^2 - ab + 3a - b^2 + 3b=0$ and $k=abc$.