Pre-multiplying and post-multiplying matrices give the same diagonal elements? 
If 
  $$X = \left[ \begin{array}{ccc}
3 & 4 & 1\\
4 & 1 & 3\\
1 & 3 & 4\end{array} \right]$$
find the possible matrix $Y$ such that:
  $$XY - YX = I$$

The method my professor gave us was that if we observe the diagonal elements of $XY$, they will always be equal to the diagonal elements of $YX$. 
$\therefore Trace(XY - YX)$
$=Trace(XY) - Trace(YX)$
$=0$
If $XY - YX = I$,
$\implies Trace(XY - YX) = Trace(I)$  
The trace of an Identity matrix of the same order would be $1+1+1=3$. 
$\because 0 \neq 3 \implies Y$ doesn't exist.
But, I decided to cross-check. I multiplied 3 pairs of matrices and none of their diagonal elements were same as their commutative counter-parts. 
I'm confused. Is what my professor said correct? And did I mess up my calculations? Or does what he said not hold? If not, what would be the method to solve this problem, because I'm stumped. (assuming a matrix Y and solving it to get 9 equations isn't the way, I'm guessing).
 A: What your professor said, what he used, and what is true, is that the sum of the diagonal entries of $XY$ is the same as that of $YX$. 
If you pay attention to the argument you wrote, you are never using the single entries of $XY$ and $YX$, but only the sum of their diagonals. 
A: Define the matrices 
$$
A =
\begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn} 
\end{bmatrix}
\qquad
B =
\begin{bmatrix}
b_{11} & b_{12} & \cdots & b_{1m}\\
b_{21} & b_{22} & \cdots & b_{2m}\\
\vdots & \vdots & \ddots & \vdots\\
b_{n1} & b_{n2} & \cdots & b_{nm} 
\end{bmatrix} 
$$
The $j^{th}$ diagonal entry of $AB$ is given by
$$
\sum_{i=1}^n a_{ji}b_{ij}
$$
Thus, the trace of $AB$ (the sum of all such diagonal entries) is given by
$$
\sum_{j=1}^m \left[\sum_{i=1}^n a_{ji}b_{ij}\right]
$$
Similarly, we may find the trace of $BA$ as
$$
\sum_{i=1}^n \left[\sum_{j=1}^m a_{ji}b_{ij} \right]
$$
Since these summations are equal (why?), we find $\operatorname{trace}(AB)=\operatorname{trace}(BA)$
