$X$ is a matrix. Find matrix $A, B$ such that $X=AB-BA$ 
Let $X \in \mathbb{R}^{3\times 3}$ be a diagonal matrix whose diagonal elements (from left to right) are $1$, $y$ and $-1$. For what values of $y$ will there exist matrices $A,B \in \mathbb{R}^{3\times 3}$ such that $AB-BA=X$? 

So far using the properties of the trace function, I have deduced that $y$ cannot be non-zero, since $AB-BA=X$ implies $\text{tr}(AB-BA)=\text{tr}(X)$. Since $\text{tr}(AB-BA)=0$, the sum of diagonal elements of $X$ is also $0$. Therefore $1+y+(-1)=0$. How do I show that there exist or does not exist $A,B$ such that $AB-BA=X$, where $y=0$. The usual method of computing the product and difference to find the solution seems to be very tedious. I would be happy if someone can suggest a shorter method. Thanks.
 A: In fact, it is a fact that a matrix $X$ can be expressed in the form $X = AB - BA$ if and only if $X$ has trace zero, as is proven here, for example.
I wouldn't necessarily use the full power of that proof here, though.  Since $X$ has mostly zero, my bet would be that we should try making $A$ and $B$ out of mostly $0$s, possibly out of $0$s and $1$s.  
And, with some experimenting of this kind, you'll find that we indeed have the example
$$
A = \pmatrix{0&0&1\\0&0&0\\0&0&0}, \qquad  B = A^T
$$ 
Verify that $AB - BA$ produces the desired result.
A: (This should probably be a comment, but I do not have enough reputation points to comment.)
Note that you only need produce one solution in the case of $y=0$ to show existence.
If you have a background in physics and specifically quantum mechanics, then you may be able to come up with an example solution. Think "Quantum Harmonic Oscillator".
If not, perhaps you have some experience with representations of Lie algebras. Think "$SL_2(\mathbb{R})$".
