I read a book about the Lie algebra, but I really don't understand the calculation of $ad(X)$. For example, we have a Lie algebra of bases: $$e_1=\left[\begin{array}{cc}1 & 0\\0 & -1\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]$$
I want to know the format of $ad(e_1)$, $ad(e_2)$ and $ad(e_3)$.
All the authors said that "it is clearly that ad(e1)=...,ad(e2)=... and ad(e3)=...", but how did they find it?
another example: $$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].$$ the adjoint representation is $$ad(e_1)=\left[\begin{array}{cccc}0 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & -1 & 0\\0 & 0 & 0 & 0\end{array}\right].$$ Some one said that it has a relationship to the structure constant $C_{ijk}$, but how to write $ad(e)$ with $C_{ijk}$?
We recall that for any $X \in \mathfrak{sl}_2(\Bbb{C})$, $\text{ad}_{X}$ is the linear operator on the vector space $\mathfrak{sl}_2(\Bbb{C})$ that sends every $Y$ in $\mathfrak{sl}_2(\Bbb{C})$ to $\text{ad}_X(Y) = [X,Y]$. Every linear operator on a finite dimensional space can be represented by a matrix. In this case, we want a matrix in the basis $e_1,e_2,e_3$ as you defined. So if $X = \left(\begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array}\right)$ then we need to calculate $\text{ad}_X(e_1),\text{ad}_X(e_2)$ and $\text{ad}_X(e_3)$. We find:
$$\begin{eqnarray*} \text{ad}_X(e_1) &=& 0\\ \text{ad}_X(e_2) &=& 2e_2 \\ \text{ad}_X(e_3) &=& 2e_3 .\\ \end{eqnarray*}$$
Thus the matrix of $\text{ad}_X$ in the basis $\mathcal{B} = \{e_1,e_2,e_3\}$ is given by:
$$[\text{ad}_X]_{\mathcal{B}} = \left(\begin{array}{ccc} 0 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2\end{array}\right).$$