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](https://artofproblemsolving.com/community/c6h219889p1219430) 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. 



Integer positive definite quadratic form as a sum of squares
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).


