When does 'positive' imply 'sum of squares'? Does anyone have examples of when an object is positive, then it has (or does not have)  a square root? Or more generally, can be written as a sum of squares?
Example. A positive integer does not have a square root, but is the sum of at most 4 squares. (Lagrange Theorem). However, a real positive number has a square root.
Another Example. A real quadratic form that is postive definite (or semi-definite) is, after a change of coordinates, a sum of squares. How about rational or integral quadratic forms?
Last Example. A positive definite (or semidefinite) real or complex matrix has a square root. How about rational or integral matrices?
Do you have other examples?
 A: There is Fejér-Riesz Theorem: a nonnegative trigonometric polynomial can be expressed as the square of the norm of a complex polynomial.
Fejér-Riesz Theorem generalizes from trigonometric polynomials to integrable functions as Szegö’s Theorem.
A: Let $f:(a,b)\rightarrow{\mathbb R}$ be a function. If $f(x)=g(x)^2$, then $f$ is non-negative and inherits the regularity of $g$. Conversely, let us assume that $f\ge0$ and $f\in{\mathcal C}^k$. What can be said about a square root $g$ ?
If $f$ is ${\mathcal C}^2$, then $f$ admits a ${\mathcal C}^1$ square root (T. Mandai, 1985). If $f$ is ${\mathcal C}^4$, then $f$ admits a twice differentiable square root $g$ (Alekseevskiĭ et al., 1988). However, $g$ might not be ${\mathcal C}^2$ (Bony et al., 2006).
A: As has been pointed out in Tony Carbery's answer, a positive polynomial over $\mathbb{R}$ in two or more variables need not be a sum of squares.  However, Bill Helton showed in 2002 that this does hold for polynomials in noncommuting variables!
Helton, J. William.  "Positive'' noncommutative polynomials are sums of squares. Ann. of Math. (2) 156 (2002), no. 2, 675–694.  http://www.jstor.org/stable/3597203.
A: For many examples of this kind, see Olga Taussky, "Sums of squares", Amer. Math. Monthly 77 (1970) 805-830.
A: The existence of the $[r, s, n]$ sum of square formula:
$(x_1^2+ \ldots +x_r^2) \cdot (y_1^2+ \ldots +y_s^2) = (z_1^2+ \ldots +z_n^2)$
is related to the existence of an axial map of projective spaces:
$P^{r - 1} \times P^{s-1} \to P^{n-1}$
There is a recent work extending this formula to some fields of non-zero characteristic:
http://www.uoregon.edu/~ddugger/ksum.pdf
A: One other case that seems to be missing from the comments above (but most likely not from the references in there) is the 1888 result of Hilbert that all nonnegative ternary quartic forms (and  bivariate quartic polynomials) are sums of squares of polynomials.
Of the same flavor of the type of questions you have raised, it is an open problem to determine if a polynomial with rational coefficients that is a sum of squares of polynomials (with possibly real coefficients) can also be written as a sum of squares of polynomials with rational coefficients. See e.g. Section 3 of
http://www.msri.org/people/members/chillar/files/rationallmisos.pdf
A: An element of $\mathbb{R}[x]$ is a sum of two squares if it is nonnegative as a function on $\mathbb{R}$.  This can be seen by noting that its real roots have even multiplicity, its irreducible quadratic factors are of the form $(x-a)^2+b^2$, a product of sums of two squares is a sum of two squares, and a square times a sum of two squares is a sum of two squares.
See Qiaochu's question on Hilbert's 17th problem for what happens in more than one variable.
A: A very nice example, due to Motzkin, found I think after the publication of Taussky's American Math. Monthly paper referred to in the answer by Michael Lugo, is
$$x^2y^4 + x^4y^2 +1 - 3 x^2y^2$$
which can be written as a sum of four (even three) rational squares
$$ \frac{x^2y^2(x^2 + y^2 -2)^2(x^2 + y^2 +1) +(x^2 - y^2)^2}
{(x^2 + y^2)^2},$$
yet is not a sum of squares of polynomials. (I learnt this example in a talk by K. Schmudgen.)
A: I think your question lives most naturally in the category of ordered rings.
Here is one example: a field can be ordered iff it is formally real: i.e., iff -1 is not a sum of squares.  However, more is true: if x is any element of a field K of characteristic different from 2 which is not a sum of squares, then there exists an ordering < on K in which x is negative.  Thus any field which admits more than one ordering will have positive elements which are not sums of squares.  For example, in Q(\sqrt{2}), with the usual convention, \sqrt{2} is positive, but it is not a sum of squares, because in a different ordering (here, an adjustment of the given ordering by a field automorphism!) it is negative.
Another Example: No, a positive definite rational or integral quadratic form need not be equivalent to a sum of squares.  For instance the quadratic forms x^2 + y^2 and x^2 + 2y^2 
are not equivalent over Q.  For one thing, the discriminant of the quadratic form (= the product of the coefficients, for a diagonal quadratic form) is well-determined up to a square in the ground field.  So it comes back to the fact that in R, every positive number is a square, but not in Q.  
For matrices: look at the 1x1 case!  
As was alluded to before, another case of this is Hilbert's 17th problem: let K be an ordered field with real closure R.  (For simplicity just take K = R = real numbers!)  Let f in K(x_1,..,x_n) be a rational function such that for all (a_1,...,a_n) in R^n at which f is defined, f(a_1,...,a_n) >= 0.  Then there are rational functions g_1,l..,g_m in 
K(x_1,...,x_n) such that f = g_1^2 + ... + g_m^2.  
A: I believe another recent question contains an answer: 

Hilbert's 17th problem asked if a nonnegative real polynomial is the sum of squares of rational functions. It was answered affirmative by Artin in around 1920. 

A: For $x$ a self adjoint element of a $C^*$ algebra it is equivalent:


*

*$x$ has non negative spectrum

*$x$ has a self adjoint square root $x=y^2$

*$x$ is a finite sum of squares $x=\sum {a_i}^*a_i$


in this case $x$ is indeed called positive.
A: For an example of positive elements which are not a sum of squares, consider any positive $\delta$-number ordinal in the Grothendieck ring of the ordinals; none of them have square roots, nor are they a sum of squares. (this remains true even if we pass to the field of fractions)
