Rank of transformation $Y=AX-XA$ 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.
 A: The equation is a special form of a Sylvester equation.
Using vectorization operation, the equation
$$
AX-XA=0
$$ 
is equivalent to
$$
(I\otimes A - A^T\otimes I)vec(X)=0.
$$
Denote the eigenvalues of $A\in \mathbb C^{n,n}$ by $\lambda_1\dots \lambda_n$.
Then the matrix $I\otimes A - A^T\otimes I$ has eigenvalues $\lambda_{ij} = \lambda_i - \lambda_j$, $i,j=1\dots n$.
Thus, the dimension of the null space of $f$ depends on the spectrum of $A$. The dimension of the null space is at least $n$, which appears if the eigenvalues of $A$ are distinct. On the other extreme, the dimension of the null space is $n^2$ if $A$ is a multiple of the identity.
A: 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:


*

*If $Y$ is a $p\times q$ rectangular matrix, then $J_p(\lambda_1)Y=YJ_q(\lambda_2)$ for some $\lambda_1\ne\lambda_2$ if and only if $Y=0$.

*If $Y$ is a $p\times q$ rectangular matrix, then $J_p(\lambda)Y=YJ_q(\lambda)$ if and only if $Y$ has the following form, where $T$ denotes any $\min(p,q)\times\min(p,q)$ upper triangular Toeplitz matrix:
$$
\begin{cases}
Y=T & \text{if } p=q>1,\\
Y=\pmatrix{T\\ 0} & \text{if } p>q>1,\\
Y=\pmatrix{0, T} & \text{if } 1<p<q,\\
\text{the first entry of } Y \text{ is zero} & \text{if } p>q=1,\\
\text{the last entry of } Y \text{ is zero} & \text{if } p=1<q,\\
Y \text{ is any scalar } & \text{if } p=q=1.
\end{cases}
$$


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}$.
A: I just read this file; here the Kronecker product is useless. Indeed $rank(f)=n^2-dim(C(A))$ where $C(A)$ is the commutant of $A$. According to the Jordan decomposition theory, it suffices to obtain $dim(C(A))$ when $A$ is nilpotent. Thus, let $n_0=0,n_k= dim(ker(A^k))$. It is well-known that $dim(C(A))=\sum_{k\geq 0}(n_{k+1}-n_k)^2$. In particular, $dim(C(A))$ is a sum of squares ${m_k}^2$ s.t. $\sum_km_k=n$. Conversely, if we give such a sequence, then there is an associated matrix $A$.
$rank(f)$ has a geometric sense: let $V$ be the algebraic variety of matrices that are similar to $A$; then the elements of $V$ depend on $rank(f)$ free parameters.
