# How do I compute the Relative Entropy between pure and mixed states?

Let

$$\rho = \begin{bmatrix} .7738 & -.0556 \\ -.0556 & .0040 \end{bmatrix} , \sigma = \begin{bmatrix} .9454 & -.2273 \\ -.2273 & .0546 \end{bmatrix} \\$$

As you can see $$\rho$$ is an operator of mixed states and $$\sigma$$ is a density operator from a pure state. I can calculate entropy of them individually. But can I calculate the relative entropy between them? I am not sure about what it would mean. Anyways, considering the definition of relative entropy:

$$S(\rho || \sigma) = \mathrm{tr}(\rho \log (\rho)) - \mathrm{tr}(\rho \log ( \sigma))$$

I know that I can calculate the entropy of $$\sigma$$ from it's eigenvalues. But here I can't use the eigenvalue approach, can I? I have to take the logarithm I think. But there is no logarithm for $$\sigma$$ in matlab. What can I do in this sort of cases?

• In matlab, use "logm". – Norbert Schuch Sep 28 at 11:43

As @NorbertSchuch said in a comment, matlab has a function for taking the logarithm of a matrix: logm. In general, there is a standard method for calculating the function $$f(\sigma)$$ of a matrix $$\sigma$$. You first diagonalise the matrix: $$\sigma=UDU^\dagger,$$ where $$U$$ is a unitary and $$D$$ is diagonal. We then say $$f(\sigma)=Uf(D)U^\dagger,$$ where $$f(D)$$ simply involves calculating the function $$f$$ on just the diagonal elements of the matrix.
Note this means that in your particular case, since $$\sigma=|\psi\rangle\langle\psi|$$ corresponds to a pure state, one of the eigenvalues is 0, so unless $$\rho$$ is an identical pure state, the answer you get will be $$\infty$$.
You are running into problems because $$\rho$$ is not a density operator. A mixed state density operator has $$\text{tr}(\rho^2) < 1$$, but even a mixed state density operator must have $$\text{tr}(\rho)=1$$. This is necessary because $$\text{tr} (\rho) = \sum \limits_i p_i \, \text{tr}\left(\vert \psi_i \rangle \langle \psi_i \vert \right) = \sum \limits_i p_i = 1$$.
• Entropy in this context measures deviation from a pure state so the entropy of $\sigma$ is zero. The lack of disorder in a pure state density matrix manifests as idempotence, $\sigma^2 = \sigma$. – ChainedSymmetry Sep 28 at 1:22