# Is it possible to have a negative density matrix, and how would you calculate entropy?

I am trying to calculate the Von Neumann Entropy of a quantum state.

Given a state $$| \psi \rangle$$, I am calculating the Von Neumann entropy by doing the following:

$$S = -\mathrm{tr}(\rho \ln(\rho)) = -\mathrm{tr}(|\psi \rangle \langle \psi | (\ln (|\psi \rangle \langle \psi | ))$$

If our original state $$| \psi \rangle$$ have some amplitudes that are negative, the result of the log should be a complex number or undefined. I'm imagining a state that can be as simple as:

$$| \psi \rangle \frac{1}{\sqrt{2}} ( |0 \rangle - | 1 \rangle)$$

Such that we can express the density matrix (in matrix form) as:

$$|\psi \rangle \langle \psi | =\frac{1}{2} \begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix}$$

This gives me the impression that this is not a valid way to calculate entropy, since entropy (to my knowledge) should be real valued, and a log of a negative number can only return a complex number.

So my questions: Is it even physically possible to have a density matrix with negative entries? I was earlier under the impression that the entries in the density matrix should be probabilities (and not probability amplitudes) and therefore should be positive. If it isn't possible, how would one go about calculating the entropy of a quantum state with negative amplitudes?

If our original state $$| \psi \rangle$$ have some amplitudes that are negative, the result of the log should be a complex number or undefined.

Quite simply, that has nothing to do with how the logarithm of a density matrix is calculated; moreover, your understanding of "negative" does not correspond with the correct technical term that's required in this situation.

• The logarithm is calculated in the eigenbasis of the density matrix. Thus, you find the orthonormal basis $$|\varphi_i\rangle$$ in which $$\rho|\varphi_i\rangle = p_i|\varphi_i\rangle$$, and in that basis you have $$\log(\rho) = \sum_i \ln(p_i)|\varphi_i\rangle\langle \varphi_i|$$ so that $$\rho\log(\rho) = \sum_i p_i\ln(p_i)|\varphi_i\rangle\langle \varphi_i|.$$ (Note that if any of the $$p_i$$ are zero, formally $$\ln(p_i)$$ would be $$-\infty$$, but the divergence is slower than linear so you retain $$p_i\ln(p_i)=0$$.) The trace then follows directly from that expression.

• The correct measure for whether $$\rho$$ is "positive" or "negative" is that it needs to be a positive semidefinite operator. This happens:

1. if and only if every eigenvalue $$p_i\geq 0$$ of $$\rho$$ is nonnegative
2. if and only if $$\langle \chi | \rho | \chi \rangle \geq 0$$ for all states $$|\chi\rangle$$

among other ways to characterize that class.

The precise details of the amplitudes of $$|\psi\rangle$$ in any given basis are irrelevant. For your example, for instance, the fact that $$|\psi\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$$ has no bearing on the fact that $$\rho = |\psi\rangle\langle \psi|$$ satisfies criterion (2) above, and therefore also criterion (1).

To expand a bit more:

Is it even physically possible to have a density matrix with negative entries?

Yes, it's perfectly possible; your example is the simplest way to see it. On the other hand, it is important that you go through the math to understand why $$\rho' = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix},$$ despite having only positive entries in this basis, is not a positive semidefinite matrix. (Hint: what can you say about the determinant of positive semidefinite matrices?)

• nice answer. It could help to denote the logarithm of a matrix as $\mathrm{log}$ to differentiate it slightly from the natural logarithm. – fqq Aug 3 at 17:29
• Thanks for the answer! Just for clarity, what does $\rho '$ represent? I definitely want to go through the math for my understanding but I'm not sure what the ' represents! – Jlee523 Aug 3 at 17:35
• @Jlee523 $\rho'$ is just a matrix. I've added the prime to indicate that it is a different object to $\rho$ (and, indeed, it cannot be a density matrix). – Emilio Pisanty Aug 3 at 17:41
• @EmilioPisanty oh I understand what you mean now. Thank you! If I'm understanding correctly, in order to calculate entropy we can computationally do so by diagonalizing the matrix generated by $| \psi \rangle \langle \psi |$? We should then expect that this diagonal matrix has all nonnegative eigenvalues (if it is physical). – Jlee523 Aug 3 at 17:45
• Yes. But the matrix $\rho = |\psi⟩⟨\psi|$ is already in diagonal form, with one eigenvalue equal to $1$ and the rest equal to zero; if you insist on having a full basis then you need to extend $|\psi⟩$ to an orthonormal basis (which is absolutely possible). – Emilio Pisanty Aug 3 at 17:54