Let's say I have a pure state of the form: $$\psi = \sqrt{\frac{3}{9}} \lvert 0 \rangle + \sqrt{\frac{6}{9}} \lvert 1 \rangle$$

Then the density matrix representation would be: $$\rho = \psi \otimes \psi' = \begin{bmatrix}.3333&.4714\\4714&.6667\end{bmatrix}$$

Now, what would be the Von Neumann entropy of this matrix? I saw that the equation is:

$$S(\rho) = -\text{trace}(\rho \log \rho) = 1.3455.$$ But it's supposed to be 0, isn't it?

  • 3
    $\begingroup$ Did you make sure to do log as a matrix not element-wise? If you did it with a program, it often assumes you mean element-wise. $\endgroup$
    – AHusain
    Mar 18, 2019 at 2:45
  • $\begingroup$ Thanks AHusain, that was the issue I see. $\endgroup$ Mar 18, 2019 at 3:46

1 Answer 1


It turns out to be a novice mistake. I was using matlab and this log is elementwise, as @Ahusain pointed out. We must take the matrix logarithm in Matlab which is denoted by $logm$. Then the calculation becomes: $$-\text{trace}(\rho \log m (\rho)) = \text{NaN}.$$ The reason is, we have to define $0 \times \log (0)$ as $0$ instead of $\text{NaN}$ which is the default behavior of Matlab. Another way to calculate it is the following:

As this density matrix is representing a pure state, it would have a diagonalization. I.e. it can be written as:

$$\rho = \sum_{j} \lambda_j \lvert \phi_j \rangle \langle \phi_j \lvert$$

Where, $\lambda_j$ are it's eigenvalues and $\lvert \phi_j \rangle$ are it's distinct eigenvectors. In which case, the von Neumann entropy is simply the shannon entropy of it's eigenvalues:

$$S(\rho) = H(\lambda_1, \lambda_2) = -0 \times \log(0) - 1 \times \log(1) = 0$$Using the above definition of $\log(0) = 0$.

  • 1
    $\begingroup$ You may use \times for the $\times$ multiplication symbol rather than $*$. Alternatively, use a $.$ dot. $\endgroup$ Mar 19, 2019 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.