Hilbert's seventeenth problem is one of the 23 Hilbert problems set out in a celebrated list compiled in 1900 by David Hilbert. It concerns the expression of positive definite rational functions as sums of quotients of squares. The original question may be reformulated as:
The formulation of the question takes into account that there are non-negative polynomials, for example
which cannot be represented as a sum of squares of other polynomials. In 1888, Hilbert has shown that every polynomial in n variables and degree 2d can be represented as sum of squares of other polynomials if and only if n = 2, d = 1 or n = 3 and 2d = 4. Hilbert's proof did not exhibit an explicit example: only in 1967 the first explicit example was constructed by Motzkin.
The particular case of n = 2 was already solved by Hilbert in 1893. The general problem was solved in the affirmative, in 1927, by Emil Artin, for positive semidefinite functions over the reals or more generally real-closed fields. An algorithmic solution was found by Charles Delzell in 1984. A result of Albrecht Pfister shows that a positive semidefinite form in n variables can be expressed as a sum of 2n squares.
Dubois showed in 1967 that the answer is negative in general for ordered fields. In this case one can say that a positive polynomial is a sum of weighted squares of rational functions with positive coefficients.
A generalization to the matrix case (matrices with polynomial function entries that are always positive semidefinite can be expressed as sum of squares of symmetric matrices with rational function entries) was given by Gondard, Ribenboim and Procesi, Schacher, with an elementary proof given by Hillar and Nie.