Consider vector space $V$ consist all $n \times n$ matrix (real or complex).
What is the rank of the linear transformation $f(X)=AX-XA$ ($A\in V$)? ($A$ is a given matrix, which means we can have information about it)
I have tried to consider the basis of $V$ but it doesn't work.
EDITED:
$\operatorname{rank} f = n^2 - \operatorname{dim}N(f)$, which means we just need to find the demension of $N(f)$, which I think is much easier.
It turns out that it's not that easier.
EDIT 2: In the first answer it has been shown that the matrix version of the transformation has at least $n$ zero roots in the characteristic polynomial, however it's not true that these roots are accompanied with eigenvectors (Consider a nilpotent matrix of degree $n$ always have $n$ zero roots but may have only $1$ eigenvector). Therefore unless $A$ is diagonalisable, I think the problem is not solved yet.
Whether the underlying field is $\mathbb R$ or $\mathbb C$ makes no difference. The rank of $f$ is equal to the rank of its matrix representation $M=I\otimes A-A^T\otimes I$, but the rank of a real matrix over $\mathbb R$ is equal to its rank over $\mathbb C$. So, we may simply assume that the ground field is complex.
By a change of basis, we may further assume that $A$ is already in its Jordan form (in the sequel, if the Jordan form contains a submatrix of the form $\lambda_k I_{m_k}$, this submatrix will be viewed as a direct sum of $m_k$ trivial Jordan blocks). By the rank-nullity theorem, the problem boils down to finding all centralisers of a Jordan form $A$. Denote a Jordan block with eigenvalue $\lambda$ and size $p$ by $J_p(\lambda)$. If we impose a block structure on $X$ that conforms to the block structure of $A$, we can inspect the equation $AX=XA$ blockwise. Now, it is a technically straightforward but very dull exercise to show that:
It follows that if $A$ is decomposed into a direct sum of Jordan blocks $A = \bigoplus_{i=1}^m J_{p_i}(\lambda_i)$, the nullity of $f$ is given by $\sum_{i=1}^m\sum_{j=1}^m r(i,j)$, where $$ r(i,j)= \begin{cases} 0 & \text{if } \lambda_i\ne \lambda_j,\\ \min(p_i,p_j) & \text{if } \lambda_i=\lambda_j \text{ and } \min(p_i,p_j)>1,\\ \max(p_i,p_j)-1 & \text{if } \lambda_i=\lambda_j \text{ and } \max(p_i,p_j)>\min(p_i,p_j)=1,\\ 1 & \text{if } \lambda_i=\lambda_j \text{ and } p=q=1 \end{cases} $$ and $\operatorname{rank}(f)=n^2-\sum_{i=1}^m\sum_{j=1}^m r(i,j)$. In the special case where $A$ is diagonalisable (so that $m=n$ and $p_i=1$ for all $i$), this reduces to $\operatorname{rank}(f)=n^2-\sum_{i=1}^n\sum_{j=1}^n 1_{\lambda_i=\lambda_j}=\sum_{i=1}^n\sum_{j=1}^n 1_{\lambda_i\ne\lambda_j}$.