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

-
In general it is hard to find such a representation, but for a competition problem you could always try a hopeful guess. Let $f(x) = 2x^8 - 2x^7 + 4x^6 - 4x^5 +6x^4 - 6x^3 + 8 x^2 - 8x + 5$ $= (x^4+ax^3+bx^2+cx + 1)^2 + (x^4+dx^3+ex^2+fx + 2)^2$ and try to solve for $a,b,c,d,e.$ –  Ragib Zaman Nov 19 '11 at 16:11
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. –  David Mitra Nov 19 '11 at 16:39
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.$$
I'm not sure if this is general. I think you can find a polynomial of the form $x^4+ax^3+bx^2$ with suitable coefficients such that it gets the smallest value $x_0<0$. But then $x^4+ax^3+bx^2+x_0+1$ is always positive. But sum of its three highest terms is not always positive. E.g. $x^4-10x^3-2x^2-x+1200>0$ but $x^4-10x^3-2x^2$ gets some negative values too. –  Student Nov 19 '11 at 17:50