I remember learning some years ago of a theorem to the effect that if a polynomial $p(x\_1, ... x\_n)$ with real coefficients is non-negative on $\mathbb{R}^n$, then it is a sum of squares of polynomials in the variables $x\_i$. Unfortunately, I'm not sure if I'm remembering correctly. (The context in which I saw this theorem was someone asking whether there was a sum-of-squares proof of the AM-GM inequality in $n$ variables, so I'm not 100% certain if the quoted theorem was specific to that case.)


So: does anyone know a reference for the correct statement of this theorem, if in fact something like it is true? (Feel free to retag if you don't think it's appropriate, by the way.)



Are all polynomial inequalities deducible from the trivial inequality?
One interpretation of the question is [Hilbert's seventeenth problem](https://en.wikipedia.org/wiki/Hilbert%27s_seventeenth_problem), to characterize the polynomials on $\mathbb{R}^n$ that take non-negative values. The problem is motivated by the nice result, which is not very hard, that a non-negative polynomial in $\mathbb{R}[x]$ (one variable) is a sum of two squares. What is fun about this result is that it establishes an analogy between $\mathbb{C}[x]$, viewed as a quadratic extension by $i$ of the Euclidean domain $\mathbb{R}[x]$; and $\mathbb{Z}[i]$ (the Gaussian integers), viewed as a quadratic extension by $i$ of the Euclidean domain $\mathbb{Z}$. In this analogy, a real linear polynomial is like a prime that is 3 mod 4 that remains a Gaussian prime, while a quadratic irreducible polynomial is like a prime that is not 3 mod 4, which is then not a Gaussian prime. A non-zero integer $n \in \mathbb{Z}$ is a sum of two squares if and only if it is positive and each prime that is 3 mod 4 occurs evenly. Analogously, a polynomial $p \in \mathbb{R}[x]$ is a sum of two squares if and only if some value is positive and each real linear factor occurs evenly. And that is a way of saying that $p$ takes non-negative values.


In dimension 2 and higher, the result does not hold for sums of squares of polynomials. But as the Wikipedia page says, Artin showed that a non-negative polynomial (or rational function) in any number of variables is at least a sum of squares of rational functions.


In general, if $R[i]$ and $R$ are both unique factorization domains, then some of the primes in $R$ have two conjugate (or conjugate and associate) factors in $R[i]$, while other primes in $R$ are still primes in $R[i]$. This always leads to a characterization of elements of $R$ that are sums of two squares. This part actually does apply to the multivariate polynomial ring $R = \mathbb{R}[\vec{x}]$. What no longer holds is the inference that if $p \in R$ has non-negative values, then the non-splitting factors occur evenly. For instance, $x^2+y^2+1$ is a positive polynomial that remains irreducible over $\mathbb{C}$. It is a sum of 3 squares rather than 2 squares; of course you have to work harder to find a polynomial that is not a sum of squares at all.


