# Numerical eigenbasis for a unitary matrix

Do you know what numerical software computes an eigenvector basis for a unitary matrix?

Say I have a unitary matrix $U$. If its eigenvalues are simple (no multiplicities), then for instance Matlab computes an eigenbasis for $U$. However, if there are some eigenvalues with multiplicities, in the subspace for the eigenvalues with multiplicity the software does not find independent eigenvectors. If a matrix is symmetric or Hermitian, Matlab is programmed to output an eigenbasis (even if there are eigenvalues with multiplicities). No such thing for unitary matrices - as fas as I know.

I found a way to avoid this: if $λ$ is an eigenvalue with multiplicity, then I can form the matrix $B=A−λ⋅1$ and find the nullity of $B$. The only problem is that doing this for each possible eigenvalue is slow. I wonder if there is a better solution.

If that makes a difference, I can assume that my unitary matrix is real.

The question was also asked here https://cstheory.stackexchange.com/q/27874/ and here https://stackoverflow.com/q/27533637/ (no answer).

• Crossposting (especially only 18 hours after you posted on SO!) is frowned upon, I think this question is far better suited to SO or math.SE than physics - because nothing in this question is about physics except that unitary matrices are common in physics.
– ACuriousMind
Dec 18, 2014 at 14:47
• This question appears to be off-topic because it is about numerical methods not specific to physics.
– ACuriousMind
Dec 18, 2014 at 14:48
• If the geometric/algebraic multiplicity of the eigenvalues is the same, then there is an eigenspace of dimension > 1 for eigenvalues with multiplicity > 1, and Matlab will return two linearly independent vectors in this eigenspace. Is that enough? Dec 18, 2014 at 16:23
• The original problem is this: I have a state, and I need to decompose it into each eigenspace. Thus, I think that only two independent eigenvectors in a subspace with dimension let's say 6, are not enough. Dec 18, 2014 at 16:34
• Interesting. Do you have an example matrix? Dec 18, 2014 at 19:31

Say I have a unitary matrix $U$. If its eigenvalues are simple (no multiplicities), then for instance Matlab computes an eigenbasis for $U$. However, if there are some eigenvalues with multiplicities, in the subspace for the eigenvalues with multiplicity the software does not find independent eigenvectors.
Unitary matrices are diagonalizable over the complex numbers, so you should be getting an eigenbasis from eig. Furthermore, the eigenbasis will be a unitary matrix, and all eigenvalues will be on the unit circle.