Proving that a polynomial is positive A Finnish mathematics competition asked to prove that for all $x$ we have $x^8-x^7+2x^6-2x^5+3x^4-3x^3+4x^2-4x+\frac{5}{2}\geq 0$ for all real $x$. I heard that it follows from Hilbert's problem that one can prove this by writing the polynomial as sum of squares. How can I find such a representation? I managed to prove the inequality by considering cases $x\leq 0$, $0<x<1$ and $x\geq 1$ separately but I was unable to find a solution based on sum of squares.
 A: I'm not sure if this is what you're looking for, but it works and is quite elementary.
We can take the highest three powers and do this:
$$
x^8-x^7+x^6 = x^6(x^2-x+1) = x^6\left[\left(x-\dfrac{1}{2}\right)^2+\dfrac{3}{4}\right]
= x^6 \left(x-\dfrac{1}{2}\right)^2 + \dfrac{3}{4} x^6,
$$
which gives us the expression
$$
x^6 \left(x-\dfrac{1}{2}\right)^2 + \dfrac{3}{4} x^6 + −2x^5+3x^4−3x^3+4x^2−4x + \dfrac{5}{2}.
$$
Doing this three more times results in
$$
x^6 \left(x-\dfrac{1}{2}\right)^2 + \dfrac{3}{4}x^4\left(x-\dfrac{4}{3}\right)^2 + \dfrac{5}{3}x^2\left(x-\dfrac{9}{10}\right)^2 + \dfrac{53}{20}\left(x-\dfrac{40}{53}\right)^2 + \dfrac{105}{106} \geq 0.
$$
A: Dane commented "One observation: your polynomial is equal to $x(x-1)(x^6+2x^4+3x^2+4)+2.5$. I'm not sure if this is the path to take, though."
Yes it is. Notice that when x(x-1)>= 0,  the polynomial is positive. If x(x-1) < 0, then 0 -1/4, and 0 < x^6 + 2x^4 + 3x^2 + 4 < 10. The polynomial > -1/4*10 + 2.5=0.
I guess this is the "official" answer.
