Solving the problem of decomposing a 2×2 non-symmetric matrix as the product of two symmetric matrices led me to the general problem of finding the square root of a matrix, which is well known and whose solution is shown in wikipedia, and comes from a very important mathematical result called the Cayley-Hamilton theorem.

The Characteristic Polynomial

The characteristic polynomial of a square matrix M is given by

\[P_M(\lambda) = det(M-\lambda \mathbb{I})\]

Where det(M) is the determinant of the matrix.  The Cayley-Hamilton theorem states that a matrix polynomial with the same coefficients will have matrix

\[M\]
as its roots, meaning that

 

\[P_M(M) = 0_M\]

where 0M is the null matrix with the same size as M.  Now if you have one matrix S which is the square root of M, so that S2=M, we can start from the Cayley-Hamilton expression for P_S(S) = 0S and separate the odd powers in the left-hand side of the equation, and the even powers on the right-hand side:

\[\sum_{i=0}^{(n-1)/2} c_{2i+1}S^{2i+1} = – \left( \sum_{i=0}^{n/2} c_{2i}S^{2i} \right)\]

where n is the number of rows/columns and ci are the coefficients of the characteristic polynomial of S. We can then take a factor S from the left-hand side, and replace even powers with powers of M:

\[S \left( \sum_{i=0}^{(n-1)/2} c_{2i+1}M^{i} \right) = – \left( \sum_{i=0}^{n/2} c_{2i}M^{i} \right)\]

A Formula for A Square Root of a Matrix

Now, multiplying both sides by the inverse of the matrix sum of the left-hand side, we obtain an expression for

\[S\]
:

\[S =  \left( \sum_{i=0}^{(n-1)/2} c_{2i+1}M^{i} \right)^{-1} \left( \sum_{i=0}^{n/2} c_{2i}M^{i} \right)\]

where the minus sign is taken out because

\[S\]
is a square root, and its sign is irrelevant.

Now, the problem with this expression for

\[S\]
is that it depends of the coefficients
\[\{c_i\}\]
of the characteristic polynomial
\[P_S(\lambda)\]
some of which are unknown, as matrix
\[S\]
is unknown.

The characteristic polynomial can be written as:

\[P_M(\lambda) = \prod_{i=1}{n} (\lambda^{(M)}_i- \lambda)\]

where λi  are the eigenvalues of matrix M.  The eigenvalues of S are square roots of the eigenvalues of M, so

\[(\lambda_i)^2 – \lambda = (\lambda_i – \sqrt{\lambda})(\lambda_i + \sqrt{\lambda})\]

This means that the characteristic polynomials of S and M are related in the following way:

\[P_M(\lambda) = P_S(\sqrt{\lambda})P_S(-\sqrt{\lambda})\]

This means that coefficients for PS(λ) can be found from those in PM(λ) by solving a set of quadratic equations.  Since two of the coefficients are trivial: cn = 1 and c0 = √det(M), this will be a set of (n-1) quadratic equations:

\[

m_0 = (s_0)^2 = det(M) \\

m_1 = (s_1)^2 – 2s_0 s_2 \\

m_2 = (s_2)^2 – 2s_1 s_3 \\

\hspace{2cm} \vdots \\

m_{n-1} = (s_{n-1})^2 – 2s_{n-2}s_n \\

m_n = s_n = 1

\]

where si are the (unknown) coefficients of PS(λ) we need for the square root formula, and mi are the coefficients in PM(λ) computed for the known matrix M.

A Couple of Examples

2×2 Matrices

This is a very simple case, since there is only one variable in the quadratic system. The equations are:

\[

det(M) = s_0^2

tr(M) = (s_1)^2 – 2\sqrt{det(M)}

1 = s_2

\]

where

\[tr(M)\]
is the trace of matrix
\[M\]
. From that, we find that the formula for the square root is simply:

\[

S = \left(tr(M)-2\sqrt{det(M)}\right)^{-1}\left(\sqrt{det(M)}\mathbb{I}_{2\times 2}+ M\right)

\]

3×3 Matrices

In this case, two of the coefficients are also trivial

\[s_0 = \sqrt{det(M)}, s_3 = 1\]
but the quadratic equations for the other two are coupled:

\[

m_1 = (s_1)^2 – 2 s_2 \sqrt{det(M)}

 

m_2 = (s_2)^2 – 2s_1

\]

Substituting a variable obtained from one equation into the other would give an equation of degree 4, for example:

\[

s_2 = \frac{m_1 – (s_1)^2}{2\sqrt{det(M)}}

 

m_2 = (\frac{m_1 – (s_1)^2}{2\sqrt{det(M)}})^2 – 2s_1

\]

These equations are not easy to solve, but can be visualised geometrically as finding the points where two parabolas intersect.  Taking the axes to be

\[x=s_1\]
and
\[y=s_2\]
, the two equations define parables with their curvature pointing horizontally and vertically respectively, which would look like this:

parables_0The solutions to the equations appear as intersections between the curves and there can be 4, as indicated by the equation of degree 4 obtained by substitution.  When the parabolas do not intersect, there will still be 4 solutions, but they will be complex rather than real.

How to Use All This

I have shown that the problem of obtaining the square root of a square matrix amounts to compute the coefficients of a characteristic polinomial, and solving a set of quadratic equations involving those coefficients. The reader experienced in linear algebra might have spotted that there are some conditions that have to be fulfilled, such as certain matrices being invertible.  But apart from that, this procedure can be useful whenever you need the square root of a matrix.  I hope it will be anyway.