Positive polynomials revisited

The square of a real-valued polynomial is clearly non-negative, and so the sum of the squares of polynomials is non-negative. What about the converse? Is a non-negative polynomial the sum of the squares of polynomials?

For polynomials in one variable, yes. For polynomials in several variables, no.

However, Emil Artin proved nearly a century ago that although a non-negative polynomial cannot in general be written as a sum of squares of polynomials, a non-negative polynomial can be written as a sum of squares of rational functions.

Several years ago I wrote about Motzkin’s polynomial,

M(x,y) = x^4 y^2 + x^2 y^4 + 1 - 3x^2 y^2

an explicit example of a non-negative polynomial in two variables which cannot be written as the sum of the squares of polynomials. Artin’s theorem says it must be possible to write M(x, y) as the sum of the squares of rational functions. And indeed here’s one way:

\begin{align*} M(x,y) &= x^4 y^2 + x^2 y^4 + 1 - 3x^2 y^2 \\ &= \left( \frac{x^2y(x^2 + y^2 - 2)}{x^2 + y^2} \right)^2 + \left( \frac{xy^2(x^2 + y^2 - 2)}{x^2 + y^2} \right)^2 + \\ &\phantom{=} \,\,\, \left( \frac{xy(x^2 + y^2 - 2)}{x^2 + y^2} \right)^2 + \left( \frac{x^2 - y^2}{x^2 + y^2} \right)^2 \end{align*}

Source: Mateusz Michaelek and Bernd Sturmfels. Invitation to Nonlinear Algebra. Graduate Studies in Mathematics 211.

Here’s a little Mathematica code to verify the example above.

m[x_, y_] := x^4 y^2 + x^2 y^4 + 1 - 3 x^2 y^2
a[x_, y_] := (x y (x^2 + y^2 - 2))/(x^2 + y^2)
b[x_, y_] := (x a[x, y])^2 + (y a[x, y])^2 + a[x, y]^2 
             + ((x^2 - y^2)/(x^2 + y^2))^2
Simplify[m[x, y] - b[x, y]]

This returns 0.