# Finding an unitary matrix, $P$, and diagonal matrix, $D$, such that $P^{-1}AP = D$.

Let $A = \begin{pmatrix} 0 & i \\ i & 0 \end{pmatrix}$. I need to find an unitary matrix, $P$ and diagonal matrix $D$, such that $P^{-1}AP = D$ (Or determine why those can't be found)

Now, for this to happen, $A$ must be a normal matrix, and this is true iff there's an orthonormal basis for $V$ composed by eigenvectors of $T$.

How do I do this in practice? Do I have to find the eigenvectors of $A$ and then apply on them Gram-Schmidt process?

Or should I first check that $A$ has $n$ different eigenvalues, since $D$ must be $D=\text{Diag}(\lambda_1, \ldots, \lambda_n)$

Step 1: Find the eigenvalues of $A$. In this case, they are $\{i,-i\}$.

Step 2: Find the corresponding eigenvectors (up to scalar multiplication). They are $(1,1)$ and $(1,-1)$. (In general, if an eigenvalue is repeated, find linearly independent and pairwise orthogonal eigenvectors corresponding to it, if possible—see the comment by @Omnomnomnom below.)

Step 3: Normalize the eigenvectors so that each has unit norm: $(2^{-1/2},2^{-1/2})$ and $(2^{-1/2},-2^{-1/2})$.

Step 4: Form a matrix $P$ having the eigenvectors as columns: $$P=\left(\begin{array}{cc}\dfrac{1}{\sqrt{2}}&\dfrac{1}{\sqrt{2}}\\\dfrac{1}{\sqrt{2}}&-\dfrac{1}{\sqrt{2}}\end{array}\right).$$ You can check that $P$ is unitary.

Step 5: Now let $D$ be the matrix having the eigenvalues in the diagonal: $$D=\left(\begin{array}{cc}i&0\\0&-i\end{array}\right).$$

Step 6: Check that $A=PDP^{-1}$.

• Do I have to check it in the end? (Step #6) – AlonAlon Jan 11 '15 at 14:15
• When do the process can get failed? (My guess is that there are less than $n$ eigenvalues, right?) – AlonAlon Jan 11 '15 at 14:15
• Note: this process is sufficient when $A$ has no repeated eigenvalues, but may otherwise fail. – Omnomnomnom Jan 11 '15 at 14:17
• The process may work even if there are less than $n$ distinct eigenvalues. The process fails when an eigenvalue of multiplicity $k\geq2$ has less than $k$ linearly independent eigenvectors. – triple_sec Jan 11 '15 at 14:19
• @triple_sec it is not sufficient to have them be linearly independent; they must also be mutually orthogonal. For example, with the identity matrix, we must disallow choosing $(1,0),(1,1)$, since the resulting $P$ will not be unitary. Alternatively, once the linearly independent eigenvectors are selected, apply the Gram-Schmidt process (we can do this either to all eigenvectors simultaneously or within each eigenspace separately and achieve the same result.) – Omnomnomnom Jan 11 '15 at 18:33