# How to find a matrix square root with all real entries (if it exists)

Let $X$ be a $n\times n$ matrix.

Assume there exists a square root $Y$ of $X$ ($YY=X$) such that all entries of $Y$ are real.

How to find all such $Y$'s?

• Do you mean $X = YY$? That way it makes more sense to me. – kyticka Apr 1 '13 at 8:19
• There is no general formula (I think) but you can notice that $X$ and $Y$ commute which should greatly reduce the number of candidates. – xavierm02 Apr 1 '13 at 11:28

Since $X,Y$ can cause confusion with indeterminates, I will consider finding $B\in M_n(\Bbb R)$ such that $B^2=A$, for given $A\in M_n(\Bbb R)$. First some preliminary remarks.

Finding all solutions in general is probably overly ambitious, as there can be infinitely many of them, and the solution set can have a complicated structure. For instance $$\begin{pmatrix}x&-\tfrac{1+x^2}y\\y&-x\end{pmatrix}^2=\begin{pmatrix}-1&0\\0&-1\end{pmatrix} \qquad\text{for all x and y\neq0.}$$ Also one cannot expect general solution methods that are numerically stable even when $X$ has repeated eigenvalues, as can be seen by considering $$A=\begin{pmatrix}-1&\varepsilon\\0&-1\end{pmatrix}$$ which does not have any real square root at all when $\varepsilon\neq0$.

A general reduction of the problem is possible according to the factorisation of the characteristic polynomial $\chi_A$ of $A$. If $\chi_A$ is a product of factors $P_i^{m_i}$ for distinct irreducible factors $P_i\in k[X]$ (with multiplicity $m_i$), then the vector space decomposes into a direct sum of subspaces $\ker(P_i^{m_i}[X:=A])$ (the polynomial $P_i^{m_i}$ of the matrix $A$), and since any solution $B$ must commute with $P_i^{m_i}[X:=A]$, it must stabilise the summands of this direct sum decomposition, and the problem reduces to finding the square roots of the restrictions to each of these summands. So we may assume that $\chi_A$ is a power of an irreducible polynomial; when working over $k=\Bbb C$ this means it is of the form $(X-\lambda)^n$, and the direct sum decomposition of the space is the one into generalised eigenspaces for $A$. However for $k=\Bbb R$ one must also deal with powers of quadratic polynomials with negative discriminant.

The question for real matrix solutions $B$ to $A=B^2$ is harder than for complex matrices. For complex matrices the situation is described in this answer, which can be summarised as follows. If $A$ is invertible then a square root always exists, and for the case that we have reduced to where $A$ has a single (nonzero) eigenvalue, a square root can be given by an explicit formula. Remains the case of nilpotent matrices (the restriction to the generalised eigenspace for the eigenvalue $0$); whether a complex square root exists depends on the partition of $n$ given by the sizes of the Jordan blocks, and is a somewhat curious combinatorial condition: if there exist $0<k<l$ such that neither $k$ not $l$ occur as size of a Jordan block, and the number of blocks with size $i$ for some $k<i<l$ is odd, then no square root exists; if there is no such obstruction then solutions do exist.

For the real case, there are more possible obstructions to the existence of solutions than for the complex case. Clearly $\det A\geq0$ is a necessary condition, but it is certainly not sufficient. For any solution $B$, the polynomial $\chi_A$ can be obtained from $\chi_B$ by squaring all its roots. Doing this individually for the irreducible factors, one sees that an irreducible quadratic factor $X^2-2aX+(a^2+b^2)$ of $\chi_B$ (with $b\neq0$, and one can take $b>0$) becomes a factor $X^2-2(a^2-b^2)X+(a^2+b^2)^2$ of $\chi_A$; this polynomial remains irreducible unless $a=0$, in which case it factors as $(X+b^2)^2$. As a consequence, a necessary condition for the existence of a square root is that every negative real root of $\chi_A$ must have even multiplicity. This condition is still not sufficient, as the example $A$ above with $\chi_A=(X+1)^2$ shows. The problem there is that $\ker(A+I_2)$ has dimension $1$ and must be $B$-stable for any $B$ commuting with $A$, but the problem of finding a square root for this restriction has no solution. So I believe that for a sufficient condition, one must repeat the given condition for the characteristic polynomial of every restriction of $A$ to a subspace that is the kernel of some polynomial in $A$ (since we reduced to $\chi_A=P^m$ for irreducible $P$, the kernels $\ker(P^k[X:=A])$ for $0<k<m$ are the relevant subspaces).

To be continued...

• Thanks! A very detail discussion! Is it unfinished? – Rein Apr 4 '13 at 13:12
• @Rein Yes, there is some work to do for the case of repeated factors in the characteristic polynomial, and I meant to show that the condition given is actually sufficient for the existence of square roots. – Marc van Leeuwen Apr 4 '13 at 13:17
• As another example: there is an entire family of matrices, the involutory matrices, whose defining property is that they give the identity after squaring. – J. M. is a poor mathematician Apr 13 '13 at 18:29

Questions about square roots of matrices come up quite often on math.stackexchange. This is not an answer, but an inventory of questions that deal with some form of the question. Since searching on M.SE is not easy, I've certainly overlooked many questions, feel free to extend this list.

For complex matrices

For symmetric unitary matrices

For positive definite symmetric matrices (where a decomposition $X=Y^{\!T}\,Y$ is sought)

General real matrices