TITLE: Do matrices of the form $A^\ast A$ where $A$ has entries in $R\subset\Bbb C$ account for all positive semidefinite matrices with entries in $R$?
QUESTION [10 upvotes]: Let $R$ be a subring of $\Bbb C$ closed under complex conjugation and let $P$ be an $n\times n$ positive semidefinite matrix with entries in $R$. I'm curious if it is always possible to factor $P$ as $P=A^\ast A$ where $A$ is $m\times n$ with entries in $R$. 
If $P$ is $1\times 1$ and $R=\Bbb Z$, then Lagrange's four-square theorem says $P=A^\ast A$ where $A$ is $4\times 1$. Is there anything known beyond this observation?

REPLY [5 votes]: $\def\ZZ{\mathbb{Z}}\def\QQ{\mathbb{Q}}\def\RR{\mathbb{R}}\def\CC{\mathbb{C}}$I did some searching and thinking, and this is what I have come up with. Disclaimer: I couldn't actually find full copies of the papers I'm going to cite by Mordell and Ko, so this is based on reading summaries of them in other papers.

The case $R = \ZZ$ was considered by Mordell in "A new Waring’s problem with squares of linear forms", Quarterly Journal of Mathematics 1 (1930), 276–288 and "On the representation of a binary quadratic form as a sum of squares of linear forms", Mathematische Zeitschrift 35 (1932), 1–15. To see the connection, note that, if the $B = A^T A$ and the columns of $A$ are $a_1$, $a_2$, ..., $a_m$, then $x^T B x = \sum \langle a_i, x_i \rangle^2$. So Mordell thought about this problem as expressing a given quadratic form as a sum of squares of linear forms. Mordell showed that this is always possible for quadratic forms in $2$ variables, and that $5$ squares suffice. Without the bound $5$, this appeared on the 1995 IMO shortlist. (solution) 
Chao Ko showed in "On the representation of a quadratic form as a sum of squares of linear forms" The Quarterly Journal of Mathematics, Volume os-8, Issue 1, (1937), Pages 81–98 that, for $3$, $4$ or $5$ variables, $6$, $7$ or $8$ squares suffice.
However, it was already noted by Mordell that the $E_6$ Cartan matrix (below) is not a sum of any number of squares!
$$E_6 = \left[ \begin{smallmatrix} 
2&-1&0&0&0 &0\\
-1&2&-1&0&0 &0 \\
0&-1&2&-1&0 &-1 \\
0&0&-1&2&-1 &0 \\
0&0&0&-1&2 &0 \\
0&0&-1&0&0 &2 \\
\end{smallmatrix} \right].$$
To see that this can be proved by a finite search, note that $\mathrm{Tr}(B) = \sum A_{ij}^2$, so in this case we would have $\sum A_{ij}^2 = 12$ and so the matrix $A$ can have at most $12$ nonzero entries. If you think a bit harder, it isn't too hard to get this down to a number of cases that can be done by a pencil and paper search; Hint: First show that, after reordering columns and switching their signs, we can assume that the first five rows of $A$ are $(e_2-e_1, e_3-e_2, e_4-e_3, e_5-e_4, e_6-e_5)$.
Since then, the main people thinking about this seem to be Myung-Hwan Kim and Byeong-Kweon Oh. They've produced a series of papers on this sort of question over the last 20 years. Their paper "Bounds for quadratic Waring's problem",  Acta Arith. 104 (2002), no. 2, 155–164 is pretty readable and seemed like a good starting point.
I couldn't find many papers on the Hermitian variant, but I did find "On a Waring's problem for integral quadratic and hermitian forms" which also has many good references in it.
Based on this, I would suspect that there is no simple answer for $\ZZ$, and thus no simple answer for subrings of $\CC$ more complicated than $\ZZ$. What that leaves are the subfields of $\CC$, so I'll turn to those next.

If $K$ is a field of characteristic not $2$, and $B$ is a symmetric matrix with entries in $K$, then there is an invertible matrix $S$ such that $SBS^T$ is diagonal (see, for example, here.) I claim that a diagonal matrix $D$ is a sum of squares if and only if each diagonal entry of $D$ is a sum of squares. If each entry of $D$ is a sum of squares, the claim is clear; conversely, if $D = A^T A$ then $D_{jj} = \sum_i A_{ij}^2$. So we are reduced to the question of which elements of $K$ are sums of squares.
Similarly, let $L$ be a field of characteristic not $2$ and let $\sigma : L \to L$ be an involution. For a matrix $A$, define $A^{\dagger}$ to be the matrix with $A^{\dagger}_{ij}= \sigma(A_{ji})$. A very similar argument shows that, if $B$ is a matrix with $B^{\dagger} = B$, then there is an invertible matrix $S$ such that $SBS^T$ is diagonal. So, as above, we are reduced to the case of diagonal matrices. Let $K$ be the fixed field of $L$, so a diagonal matrix obeys $D^{\dagger} = D$ if and only if its entries are in $K$. An argument as above shows that a diagonal matrix is of the form $A^{\dagger} A$ if and only if its diagonal entries are sums of norms from $L$ to $K$. The extension $L/K$ is quadratic; if $L = K(\sqrt{-1})$ then we can simply say that a diagonal matrix is of the form $A^{\dagger} A$ if and only if each entry is a sum of squares.
Now, let $L$ be a subfield of $\CC$ and let $\sigma$ be complex conjugation, so $K = L \cap \RR$ and $L = K(\sqrt{-1})$. So the above argument reduces the question of which Hermitian matrices are of the form $A^{\dagger} A$ to the question of which elements of $K$ are sums of squares. 
In a number field $K$, an element is a sum of squares if and only if it is nonnegative for every embedding $K \to \RR$. I think I could also say something for finitely generated subfields of $\CC$, but this seems like it might be pretty far from the OP's interest.