# Square root of a matrix with complex elements

How to compute the square root of the matrix

Rho = {{Wxx, Wxy, Wxz}, {Wyx, Wyy, Wyz}, {Wzx, Wzy, Wzz}}


if not all of its elements are real?

Not all matrices have a square root matrix, but you can try:

Rho = {{Wxx, Wxy, Wxz}, {Wyx, Wyy, Wyz}, {Wzx, Wzy, Wzz}};
MatrixPower[Rho, 1/2]


You can achieve the same result through diagonalization of Rho into $$V\Lambda V^{-1}$$ then taking the square root of the eigenvalues to give $$V\Lambda^{1/2} V^{-1}$$:

val = Eigenvalues[Rho];
vec = Eigenvectors[Rho]; (* each vec needs to be a column so use transpose *)
Transpose[vec].Sqrt[DiagonalMatrix[val]].Inverse[Transpose[vec]]

• Simplify will shorten this considerably. May 27 '20 at 21:32
• @flinty Can you please explain this sentence "then taking the square root of the eigenvalues to give..."? May 27 '20 at 21:48
• You put your eigenvalues in a diagonal matrix $$\Lambda=\left( \begin{array}{ccc} \lambda _1 & 0 & 0 \\ 0 & \lambda _2 & 0 \\ 0 & 0 & \lambda _3 \\ \end{array}\right)$$ Then raise that matrix to the power 1/2. It's diagonal, so you just have $$\Lambda^{1/2}=\left(\begin{array}{ccc}\sqrt{\lambda _1} & 0 & 0 \\ 0 & \sqrt{\lambda_2} & 0 \\ 0 & 0 & \sqrt{\lambda _3} \\ \end{array}\right)$$ May 27 '20 at 21:58
• This of course assumes the starting matrix is not defective. Otherwise, you would need to use the Jordan form instead of the eigendecomposition. May 28 '20 at 5:41
• Relevant MathematicsSE answer for taking the power if you have the Jordan form: math.stackexchange.com/questions/910635/… May 28 '20 at 10:27