Integer positive definite quadratic form as a sum of squares Let $A$ be a symmetric $d\times d$ matrix with integer entries such that the quadratic form $Q(x)=\langle Ax,x\rangle, x\in \mathbb{R}^d$, is non-negative definite. For which $d$ does it imply that $Q$ is a sum of finitely many squares of linear forms with integer coefficients
$$
Q(x)=\sum_{i=1}^N (\ell_i(x))^2\quad \text{for some}\, N?
$$
For $d=2$ this is true, I know it from the problem proposed by Sweden to IMO in 1995, but probably all this stuff is known for a longer time. 
I think, I may prove it for some other small dimensions, although not so elementary (using Minkowski theorem on lattice points in convex bodies: if $Q$ is positive definite, we may find a linear form $\ell(x)$ such that $Q-\ell^2$ is still non-negative definite, this is equivalent to finding an integer point in an ellipsoid), but for large $d$ this argument fails. 
 A: This is a well-known problem, called the Waring's problem of integral quadratic forms.  Every semi-positive definite quadratic form in $n \leq 5$ variables is a sum of $n + 3$ squares of linear forms.  This was proved by Chao Ko, but this can be explained by the fact that the quadratic form of sum of $n + 3$ squares has class number 1 if $n \leq 5$. 
There are positive definite quadratic forms in $n \geq 6$ variables which cannot be written as sums of squares of integral linear forms.  The smallest example is the quadratic form corresponding to the root system $E_6$.  
So, one should look at the set of positive definite quadratic forms in $n$ variables that can be written as sums of squares of linear forms.  Then there exists an integer $g(n)$ such that all these quadratic forms can be written as a sum of $g(n)$ squares of integral linear forms.  The magnitude of $g(n)$ is not known.  The best upper bound is $O(e^{k\sqrt{n}})$ for some explicit $k$.  This is obtained recently by Beli-Chan-Icaza-Liu (appeared in TAMS).
A: Such problems were investigated by L. J. Mordell in the 1930s. Two related papers of Mordell are as follows:


*

*L. J. Mordell, A new Warings problem with squares of linear forms, Quarterly J. (Oxford series) 1 (1930), 276–288. 

*L. J. Mordell, On binary quadratic forms expressable as a sum of three linear squares with integer coeﬃcients,  J. Reine Angew. Math. 167 (1932), 12–19. 
For an introduction to Mordell's results on sums of squares of linear forms, see Section  2 of D. W. Hoffmann's recent preprint Sums of integers and sums of their squares where the author applied Mordell's results to study sums of squares with certain linear restrictions.
A: I should add that there have been many results on this problem since the 1990s.  The existence of the number $g(n)$ was established by Maria Icaza in her Ohio State 1992 thesis.  You should check out her papers.  A bit later Myung Kwan Kim and Byeong Kweon Oh published a few papers.  They showed that $g(6) = 10$ (not 9 as Mordell and Ko thought in the 1930s) and this is the last known exact value of the function $g(n)$.  
