TITLE: On the existence of integer square root of a $3 \times 3$ positive definite matrix
QUESTION [5 upvotes]: As far as I know, a real square matrix $M$ has a real square root if $M$ is positive semidefinite, i.e., if all eigenvalues are nonnegative. And, in fact, its square root is unique.
I have read some research papers on how to solve the square root of a $3 \times 3$ positive definite matrix using Cayley-Hamilton, the minimal polynomial, and diagonalization.
However, when does a $3 \times 3$ integer matrix $M$ have an integer square root?
Trivially, $M$ must be positive definite to make sure its square root exists and is real. Also, $\det(M)$ must be a a perfect square. Other than that, I am stuck.
Please help me with this. Or just give me a hint or a lead. Thank you.

REPLY [3 votes]: Besides the fact that $\det M$ needs to be a perfect square, there is an other set of necessary conditions: among the diagonal entries $m_{ii}$ and the principal $2\times2$ minors $m_{ii}m_{jj}-m_{ij}^2$, none of them may be $\equiv7$ mod $8$. Writing $A=\sqrt M$, this is because on the one hand 
$$m_{ii}=a_{i1}^2+a_{i2}^2+a_{i3}^2.$$
And on the other hand
$$m_{ii}m_{jj}-m_{ij}^2=\sum_{k,\ell=1}^3(a_{ij}a_{k\ell}-a_{i\ell}a_{kj})^2.$$