# Linear transformation: change to canonical basis

Suppose the operator $L$ has eigenvalues $1,-1$ and $-2$ with eigenvectors $\mathbf{u} = \frac{1}{\sqrt{2}}(1,-1,0)$, $\mathbf{v} = \frac{1}{\sqrt{2}}(1,1,0)$ and $\mathbf{w} = (0,0,1)$, respectively. I found that the matrix corresponding to $L$ in the basis $\{\mathbf{u}, \mathbf{v}, \mathbf{w}\}$ is

$$A = \begin{bmatrix} 1&0&0\\ 0&-1&0\\ 0&0&-2 \end{bmatrix}.$$

I'm asked to find the matrix corresponding to $L$ in the canonical basis.

Here's what I did. I tried to write each $L(\mathbf{x})$ as a linear combination of $\mathbf{e}_1, \mathbf{e}_2, \mathbf{e}_3$. For instance, for $\mathbf{u}$:

$$L(\mathbf{u}) = \frac{1}{\sqrt{2}}(1,-1,0) = \frac{1}{\sqrt{2}}\times\mathbf{e}_1 - \frac{1}{\sqrt{2}}\times\mathbf{e}_2 + 0\times\mathbf{e}_3.$$

Similarly for the other two. With this result, the first column of the matrix representing $L$ in the canonical basis would be $\left(\frac{1}{\sqrt{2}}, -\frac{1}{\sqrt{2}},0 \right)$. But, if I try to find this same matrix using the method $PAP^{-1}$, with the columns of $P$ being the eigenvectors, I obtain as first column $(0,1,0)$.

What am I doing wrong? Moreover: when I have the matrix in the canonical basis representing a linear transformation and I want to find the matrix w.r.t. another basis, what I do is, I apply the transformation to each vector of the new basis and then I find the coordinate vectors, which become the columns of the new matrix. For instance: $$L(\mathbf{v}_1) = 1\times\mathbf{v}_1 -3\times\mathbf{v}_2$$ and therefore the first column would be $(1,-3)$. But in the case I described above, when we have to go from a basis to the canonical one, I have to write the result of $L$ on each vector of the old basis as a linear combination of the canonical one. I expected, instead, something like: $$L(\mathbf{e}_1) = 1\times\mathbf{e}_1 -3\times\mathbf{e}_2.$$

If you want to know the matrix of $L$ with respect to the canonical basis, what you have to compute is $L(\mathbf{e}_1)$, $L(\mathbf{e}_2)$, and $L(\mathbf{e}_3)$. Since $\mathbf{e}_1=\frac1{\sqrt2}(\mathbf{u}+\mathbf{v})$,\begin{align}L(\mathbf{e}_1)&=\frac1{\sqrt2}\bigl(L(\mathbf{u})+L(\mathbf{v})\bigr)\\&=\frac1{\sqrt2}(\mathbf{u}-\mathbf{v})\\&=(0,-1,0)\\&=-\mathbf{e}_2.\end{align}Therefore, the first column of the matrix of $T$ with respect to the canonical basis will be $\left(\begin{smallmatrix}0\\-1\\0\end{smallmatrix}\right)$.
The other method of finding this matrix consists in computing $PAP^{-1}$, with$$P=\begin{pmatrix}\frac1{\sqrt2}&\frac1{\sqrt2}&0\\-\frac1{\sqrt2}&\frac1{\sqrt2}&0\\0&0&1\end{pmatrix}.$$Then$$PAP^{-1}=\begin{pmatrix}0 & -1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & -2\end{pmatrix}.$$So, both approaches lead to the same fist column.