# Eigenvalues of same operator expressed in two different orthonormal basis are coming out different

I have an operator $$H$$. I express $$H$$ as a matrix in the orthonormalized $$\{ |e > \}$$ basis. Then I diagonalize it to obtain eigenvalues, let's say for example $$H$$ is $$6 \times 6$$ and the eigenvalues are $$1, 5, 7, 9, 3, 8$$. Now I express $$H$$ as a matrix in a different orthonormalized $$\{ |f > \}$$ basis obtained through unitary transformation of the $$\{ |e > \}$$ basis. Now I diagonalize this matrix. In principle, I should get same result $$1, 5, 7, 9, 3, 8$$. But when I run the code, only four eigenvalues are matching - let's say I get $$1, 5, 7, 9, -4, 15$$. Notice that the last two eigenvalues don't match, but peculiarly their sum is same as before, i.e., $$3 + 8 = -4 + 15 = 11$$. I am using $${numpy.linalg.eig}$$ . Please enlighten me.

• Can you show the code? Feb 18 at 19:50
• The sum being the same makes sense because the trace of the matrix should be invariant to unitary transformations. However the product of the eigenvalues, which is the determinant of the matrix, should also be invariant, but isn't for the values you have shown. So something clearer went wrong either with the diagonalization process or more likely the conversion you used between bases. Feb 19 at 1:11
• Isolate a minimal example that demonstrates the bug (possibly with a simpler operator) and show us the code. I suspect a human error, since this shouldn't happen (unless in very special cases with highly non-normal matrices that make the eigenvalue problem ill-conditioned, but in my experience when a physicist says "operator" usually they mean "symmetric matrix"). Feb 19 at 14:30
• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Mar 1 at 8:11