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

Solution 1:

.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)|$.

Solution 2:

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$.