# How to calculate the square root of a density matrix?

We know that a quantum state can be represented by a matrix $$\rho$$, where $$\rho$$ is positive semi-definite and trace is $$1$$.

So, what is the definition of $$\sqrt{\rho}$$ and how can I calculate it?

According to the spectral theorem, every $$d$$-dimensional density operator $$\rho$$ has a unique expression in terms of its eigenvectors and eigenvalues like the following: $$\begin{equation} \rho = \sum_{i=1}^d \lambda_i |\lambda_i\rangle \langle \lambda_i | \tag{1} \end{equation}$$
where $$\lambda_1, \dots, \lambda_d$$ are eigenvalues of $$\rho$$, where for simplicity we just set $$\lambda_k = 0$$ for $$k > \text{rank}(H)$$, and $$\{|\lambda_1\rangle, \dots, |\lambda_d\rangle\}$$ are orthonormal eigenvectors of $$\rho$$. Then, the definition of $$\sqrt{\rho}$$ is given straightforwardly as $$\begin{equation} \rho^{1/2} = \sum_{i=1}^d \lambda_i^{1/2} |\lambda_i\rangle \langle \lambda_i | \tag{2} \end{equation}$$
where $$\sqrt{\lambda_i}$$ is real since a density matrix must be positive semidefinite (nonnegative eigenvalues) by definition. Note that this is just another way of writing a diagonalization of $$\rho$$, for example: \begin{align} \rho &= U \Lambda U^\dagger \tag{3a} \\ \rho^{1/2} &= U \Lambda^{1/2} U^\dagger \tag{3b} \end{align}
where the columns of $$U$$ are the eigenvectors $$|\lambda_i\rangle$$ and $$\Lambda$$ contains the eigenvalues of $$\rho$$ on its diagonal. This means that one way to calculate $$\rho^{1/2}$$ is by finding the eigenvectors and eigenvalues $$\rho$$ and then reconstructing $$\rho^{1/2}$$ using either Eq. 2 or Eq. 3b.