Two part question.
(i) Consider the function $f(x)=x^3-6kx+k^3+8$. Show that we can write $f(x)$ as $(x+k+2)P(x)$ where $P(x)$ is a quadratic function.
(ii) Show that $2P(x)$ can be written as the sum of three perfect squares and hence solve $f(x)=0$ for all values of $k$.
(i) By long division I have $P(x)=x^2-(k+2)x+k^2-2k+4$. I believe this part to be correct by trying a few cases of $k$ with Wolfram Alpha.
(ii) $2P(x)=2x^2-2kx-4x+2k^2-4k+8$. No idea how to continue.