I have some matrix lie algebra $\mathfrak{g}$ and I want to compute the matrix of the adjoint action of $x\in\mathfrak{g}$, $\mathrm{ad}_x:\mathfrak{g}\rightarrow\mathfrak{g}$ given by $y\mapsto[x,y]$. How can I proceed?
I have been told that it should be $\mathrm{ad}_x = x\otimes\mathrm{id} - \mathrm{id}\otimes x$, so I tried to compute it by fixing a basis of $\mathfrak{g}$, computing the tensor of the matrices $x$ and $\mathrm{id}$ and multiplying by the vector representation of some $y\in\mathfrak{g}$. This works fine until I use the canonical basis
$$e_1 = \left(\begin{array}{cc}1 & 0\\0 & 0\end{array}\right),\ \ e_2 = \left(\begin{array}{cc}0 & 1\\0 & 0\end{array}\right),\ \ e_3 = \left(\begin{array}{cc}0 & 0\\1 & 0\end{array}\right),\ \ e_4 = \left(\begin{array}{cc}0 & 0\\0 & 1\end{array}\right)$$
but when I try with a different basis it doesn't work anymore.