square root of a real matrix I want to compute the square root of a real symmetric positive definite matrix $S\in \mathcal{M}_{m,m}$ such that $S^{1/2}S^{1/2}=S$ and it's well known that this decomposition is unique.
My question is if I have $S$ a real matrix will its square root be real too or it could be a complex matrix. In case that it could be complex then $S$ could have infinitely many square roots.
Any comments?  
 A: A real matrix $S$ can possess infinitely many real or nonreal square roots. For example,
$$
S=I=\begin{pmatrix}1&t\\0&-1\end{pmatrix}^2
$$
for every $t\in\mathbb{C}$. Note that $S=I$ is real and positive definite.
A: If $S$ is real, symmetric and positive definite, consider its eigenvalue / eigenvector decomposition $S = X \Lambda X^T$ where $\Lambda$ is diagonal and $X$ is orthogonal. Because $S$ is positive definite, $\Lambda_{ii} > 0$ for all $i$. The unique symmetric and positive definite square root of $S$ is given by $S^{1/2} = X \Lambda^{1/2} X^T$, where $\Lambda^{1/2}$ is the diagonal matrix with the $\sqrt{\Lambda_{ii}}$ on its diagonal. Indeed,
$$
S^{1/2} S^{1/2} = X \Lambda^{1/2} X^T X \Lambda^{1/2} X^T = X \Lambda X^T = S,
$$
because $X^T X = I$. So $S^{1/2}$ is indeed real.
A: This is a very late answer, but I think that especially Dominique's answer is not very satisfying. So, if $S$ is real, symmetric and positive definite, it is trivially self-adjoint (i.e., $A^* = A$). The square root of $S$ is then usually defined to be the unique positive definite self-adjoint matrix $S^{1/2}$ which satisfies $(S^{1/2})^2 = S$. However, it does not follow immediately that $S^{1/2}$ is real. But this is in fact the case:
We have $S = XDX^{*}$ with $D$ diagonal (eigenvalues on the diagonal) and the columns of $X$ being the particular normalized eigenvectors of $S$. These can be chosen to be real, since if $x$ is an eigenvector of $S$, then also $\overline x$ (each entry being the complex conjugate of the correspoding entry in $x$) is an eigenvector (corresponding to the same eigenvalue), so $x+\overline x$ is. Thus, $X$ can be chosen to be real*. Now, $S^{1/2} = XD^{1/2}X^T$ (square roots of the (positive) eigenvalues on the diagonal) and so $S^{1/2}$ is real.
*) In case of an eigenspace $\ker(S-\lambda)$ whose dimension is greater than one, one has to work a little more. Choose an eigenvector $u_1$ and define $x_1 := u_1 + \overline{u_1}$. Then $x_1=0$ iff $u_1$ is completely imaginary. In this case, also $iu_1$ is an eigenvector. Choose this one for $x_1$. Now, consider $x_1^\perp$ in $\ker(S-\lambda)$. Choose any $z$ in this space which is not purely imaginary and put $x_2 := z+\overline z$. Now, consider $\{x_1,x_2\}^\perp$ in $\ker(S-\lambda)$ and proceed as before. In the end, and after normalization of $x_1,x_2,\ldots$ we obtain an orthonormal basis of $\ker(S-\lambda)$ with real vectors only.
