When is the set of commutators of a Lie Algebra not equal to its derived Lie Algebra? Consider a finite dimensional Lie Algebra L. Its derived Lie Algebra is formed by the linear span of all the commutators of the Lie Algebra, and it is itself an ideal of L. Taking the linear span in the definition is necessary because the set of commutators of L may not be a subspace of L; the sum of two commutators is not guaranteed to be a commutator. However, in all the relevant Lie Algebras that I know the set of the commutators seems to be a subspace, and therefore identical with the derived Lie Algebra of L. Can anybody provide an example of a Lie algebra for which the set of the commutators is not a subspace, and therefore not the same as the derived Lie Algebra?
 A: For $n\ge 4$, consider the free 2-step nilpotent Lie algebra $\mathfrak{f}_n$ on $n$ generators. Namely, it has the basis $e_i$, $1\le i\le n$, $f_{i,j}$, $1\le i<j\le n$ with nonzero brackets $[e_i,e_j]=f_{i,j}$. 
The derived subalgebra $\mathfrak{z}$ is generated by the $f_{i,j}$, hence has dimension $n(n-1)/2$. But the set of commutators, being the image of $(\mathfrak{f}_n/\mathfrak{z})^2$, has dimension $\le 2n$. So if $n(n-1)/2>2n$ then there are non-commutators in $\mathfrak{z}$, and this holds if $n\ge 6$. Actually since $[x,y]=[tx,t^{-1}y]$, the image of the commutator map has dimension $\le 2n-1$ and thus for $n=5$ the argument also works. But actually it also works for $n=4$, looking a little more carefully: here's an argument for all $n\ge 4$: it is easy to see that the $GL_n$-action on the set of nonzero commutators is transitive. Now one directly computes that the stabilizer of $[e_1,e_2]$ has dimension $3+2(n-2)+(n-2)^2$, so has codimension $2n-3$ in $GL_n$, hence the set of commutators in $\mathfrak{f}_n$ has dimension $2n-3$, and $2n-3<n(n-1)/2=\dim(\mathfrak{z})$ as soon as $n\ge 4$.
With a little more effort, one can produce a perfect Lie algebra in which there are non-commutators. Namely, it is enough to find a perfect Lie algebra with dimension $m$ and center of codimension $\le m/2$. I omit the construction since the previous construction is enough to answer the question.
On the other hand, in a semisimple complex Lie algebra, every element is a commutator, see Dietrich Burde's answer to this MathSE question.
