# 3x3 integer matrix

As far as I know, a real matrix $$M$$ has a real square root if $$M$$ is positive semidefinite, that is, if all eigenvalues are nonnegative. In fact, its square root is unique.

I have read some research papers on how to solve for the square root of a $$3 \times 3$$ positive definite matrix using the Cayley-Hamilton theorem, the minimal polynomial, and diagonalization.

When does $$3 \times 3$$ matrix $$M$$ with integer entries have a square root with integer entries?

Trivially, $$M$$ must be positive definite to make sure its square root exists and is real. And $$\det(M)$$ must be a a perfect square. Other than that, I'm stuck.

• When you say "positive semidefinite", does that include symmetric? – Arthur Oct 1 '18 at 9:08
• Yes . As long as its positive semidefinite – user593805 Oct 1 '18 at 11:20
• The first statement isn't quite right---if $M$ is positive semidefinite, its roots are not necessarily unique (if $S$ is a square root of $M$ so is $-S$), but (if $M$ is symmetric) it does have a unique positive semidefinite root. – Travis Oct 1 '18 at 16:33
• Every reflection of the plane is a square root of $I_2$. – amd Oct 1 '18 at 22:11
• X-posted: mathoverflow.net/q/311792/91764 – Rodrigo de Azevedo Oct 12 '18 at 7:12

This is only a partial answer, and in particular it leads to new necessary conditions for existence of a square root with integer entries.

You've observed that if $$S$$ is a square root of $$M$$, then $$\det M = \det (S^2) = (\det S^2)$$, and so if $$S$$ has integer entries, $$\det M$$ must be a perfect square. We can generalize this observation to produce a Diophantine system. If $$S$$ has integer entries, then so do all of the coefficients of the characteristic polynomial $$p_S(t)$$ of $$S$$: $$p_S(t) = t^3 - \operatorname{tr}(S) t^2 + \sigma_2(S) t - \det t .$$ Here, $$\sigma_2(S)$$ is the second symmetric polynomial $$\lambda_2 \lambda_3 + \lambda_3 \lambda_1 + \lambda_1 \lambda_2$$ in the eigenvalues $$\lambda_k$$ of $$S$$. In terms of the entries $$s_{ij}$$ of $$S$$, $$\sigma_2(S) = (s_{22} s_{33} - s_{23} s_{32}) + (s_{33} s_{11} - s_{31} s_{13}) + (s_{11} s_{22} - s_{12} s_{21}) .$$

So, as you did for $$\det M$$ we can derive new conditions on the invariants $$\operatorname{tr} M$$, $$\sigma_2(M)$$ of $$M$$ by expressing them in terms of the above invariants of $$S$$. The eigenvalues of $$M$$ are $$\lambda_k^2$$, so, for example, $$\operatorname{tr} M = \lambda_1^2 + \lambda_2^2 + \lambda_3^2 = (\lambda_1 + \lambda_2 + \lambda_3)^2 - 2 (\lambda_2 \lambda_3 + \lambda_3 \lambda_1 + \lambda_1 \lambda_2) = (\operatorname{tr} S)^2 - 2 \sigma_2(S) ,$$ and similarly we get $$\sigma_2(M) = \sigma_2(S)^2 - 2 \operatorname{tr}(S) \det(S) .$$ Putting this altogether, a necessary condition for the existence of a square root of $$M$$ with integer matrices is existence of a nonnegative integer solution $$(\delta, \sigma, \tau)$$ of the system \begin{align*} \det M &= \delta^2 \\ \sigma_2(M) &= \sigma^2 - 2 \tau \delta \\ \operatorname{tr}(M) &= \tau^2 - 2 \sigma \end{align*} We can see immediately that in any solution $$\delta, \sigma, \tau$$ must have the same parity as $$\det M, \sigma_2(M), \operatorname{tr}(M)$$, respectively.

If $$\det M$$ is a square, we know $$\delta$$ and can regard the system as a pair of quadratic equations in $$\sigma, \tau$$, and eliminating $$\sigma$$ gives that $$\tau$$ satisfies $$\tau^4 - 2 \operatorname{tr}(M) \tau^2 - 8 \delta \tau + [(\operatorname{tr}(M))^2 - 4 \sigma_2(M)] = 0,$$ and rearranging the last equation in the above system gives $$\sigma = \tfrac{1}{2}[\tau^2 - \operatorname{tr}(M)].$$

Since in any solution $$\tau$$ must be an integer and any rational root of a monic integer polynomial is an integer, the Rational Root Theorem gives us a finite algorithm for reducing the space of possible solutions:

For each nonegative factor $$\tau$$ of the constant term $$(\operatorname{tr}(M))^2 - 4 \sigma_2(M)$$ of the same parity as $$\operatorname{tr}(M)$$, check whether it is a root of the above quartic polynomial. If none are roots, $$M$$ does not have an integer square root. In the case that the constant term is zero, either the trace is zero, which (since they are nonnegative) forces all three eigenvalues to be zero, or it is not, and we instead look at the positive factors of the next-lowest term, $$8 \delta$$.

This test is more sensitive than using the determinant alone. For example, the diagonal matrix $$D := \operatorname{diag(2, 2, 1)}$$ has determinant $$4$$, which is square, but $$(\operatorname{tr}(D))^2 - 4 \sigma_2(D) = -7,$$ and its positive integer factors, $$1, 7$$, are not roots of the quartic in $$\tau$$, so $$D$$ has no square root with integer entries.

• Omg .Thank u very much.! – Diggie Cruz Oct 8 '18 at 13:30
• You're welcome. – Travis Oct 8 '18 at 14:17