Given $P(x)=x^{4}-4x^{3}+12x^{2}-24x+24,$ then $P(x)=|P(x)|$ for all real $x$

.In this question, you have to attempt to complete two squares, namely: $$ x^4-4x^3 + 12x^2-24x+24 = x^4 -4x^3+6x^2-4x+1 + 6x^2-20x+23 \\ = (x-1)^4 + 6x^2 -20x+23 $$

Now, as it turns out, we can complete the second square, and: $$ 6x^2-20x+23 = \frac{2}{3}(3x-5)^2 + \frac{19}{3} $$

Hence, we can rewrite the whole expression as: $$ x^4-4x^3 + 12x^2-24x+24 = (x-1)^4 + \frac{2}{3}(3x-5)^2 + \frac{19}{3} $$

It is a sum of positive expressions, hence is always positive, hence $P(x) = |P(x)|$.


Just for fun, observe that $$ P(x) = \begin{bmatrix} x^2 \\ x \\ 1 \end{bmatrix}^\intercal \begin{bmatrix} 1 && -2 && 0 \\ -2 && 12 && -12 \\ 0 && -12 && 24 \end{bmatrix} \begin{bmatrix} x^2 \\ x \\ 1 \end{bmatrix} = 24 - 24x + 12x^2 - 4x^3 + x^4 $$ and since the matrix in the middle is positive semi-definite (This can be determined from determinants of sub-matrices, etc.), it follows immediately $P(x) \geq 0$.


Here is an alternative solution. You can see that $P(x)$ is positive iff $P(x+c)$ is positive for all $x$ (think about why). So you can slightly simplify the polynomial by such substitution, for example

$$P(x+1) = x^4+6 x^2-8x+9$$

Now it's easy since you can check that $6x^2-8x+9$ corresponds to parabola with positive global minimum, hence all its values are positive. Since also $x^4$ is non-negative, you can combine it to see the whole polynomial is positive.

If you want to be a bit more explicit, you can rewrite the parabola on the right to get

$$P(x+1) = x^4 + 6\left(x-\frac{2}{3}\right)^2+\frac{19}{3}$$