How does one compute the dimension of the algebra of derivations on a Lie algebra? For a finite dimensional Lie algebra $\mathfrak{g}$ of dimension $n$ over $\mathbb{C}$, how exactly would I go about computing the dimension of $Der(\mathfrak{g})$, the space of derivations of $\mathfrak{g}$?
 A: Fix a basis $\{e_i\}_{i=1}^n$ of $\mathfrak{g}$, then the Lie bracket is completely determined by the constants $c_{ij}^k$ (called the structure constants of $\mathfrak{g}$) in
$$[e_i,e_j] = \sum_{k=1}^nc_{ij}^ke_k\ .$$
Since $\mathfrak{g}$ is finite dimensional, a map $d:\mathfrak{g}\to\mathfrak{g}$ can be written as
$$d=\sum_{i,j}d_j^ie_i\otimes e_j^*\ ,$$
where $\{e_i^*\}_{i=1}^n$ is the dual basis. Then the condition of being a derivation becomes a system of linear equations in the $d^i_j$, of which you can compute the dimension of the space of solutions.
A: Writing down the derivation $D$ as a linear map, the condition for $D$ to be a derivation gives a system of linear equations in the entries of $D$ as unknowns. So we can just solve this system of linear equations. One should do an easy example, to see how this works. Let $L$ be the Heisenberg Lie algebra, with basis $(x,y,z)$ and Lie bracket $[x,y]=z$. Then all derivations $D$ are given by
$$
D=\begin{pmatrix} d_1 & d_4 & 0\cr
d_2 & d_5 & 0\cr
d_3 & d_6 & d_1+d_5\cr
\end{pmatrix}.
$$
Reference: Examples of derivation of Lie algebras
