Find the sum of the real roots of the polynomial
$$P(x) = \left(x^2+2x+4\right)^2 + 2\left(x^3-8\right)+(x-2)^2$$
If we write the polynomial as $$P(x)=(x^2+2x+4)^2+2(x-2)(x^2+2x+4)+(x-2)^2,$$ I think it's clear that $$P(x)=(x^2+2x+4+x-2)^2=(x^2+3x+2)^2=0,$$ which gives the quadratic $x^2+3x+2=0$ with sum of real roots $-\dfrac{3}{1}=-3$. (Note that $D=1>0$ which means that the equation has two real roots). So I thought that this was the answer, but the authors say it's $-6$. So does Wolfram Alpha. Why is the sum $-6$ and why do we have to consider the multiplicity of the roots?
$$\mathrm p(x) =(x^2+3x+2)^2 = (x+1)(x+1)(x+2)(x+2)$$
The biquadratic equation has four roots, where two distinct roots are repeated. Hence, the sum is $-6$. The mistake you did is that you have calculated the sum of roots of the quadratic expression which is positive square root of the original expression and hence both expressions are different. This should be more clear as $p(x)$ and the quadratic expressions have different graphs.