Given an $n \times n$ matrix $X \in M_n(\mathbb{C})$, how can we classify the space V=$\{Y \in M_n(\mathbb{C}) \mid XY = YX\}$?
My attempts:
If $X$ is diagonalizable, the problem becomes straightforward:
$$X = P \Lambda P^{-1},$$ where $\Lambda$ is a diagonal matrix containing $k_1$ occurrences of $\lambda_1$, $k_2$ occurrences of $\lambda_2$, and so on, up to $k_j$ occurrences of $\lambda_j$.
Then, $Y = P M P^{-1}$, where $M$ is a block diagonal matrix with block sizes corresponding to $k_1, k_2, \cdots, k_j$. Then $\dim_{\mathbb{C}}V = k_1^2 + \cdots + k_j^2$.
My questions:
What happens when $X$ is not diagonalizable? In this case, $X$ can be written in Jordan canonical form. However, I am unsure how to proceed from there.
How can we classify the space $V = \{Y \in M_n(\mathbb{R}) \mid XY = YX\}$ when $X$ is an $n \times n$ matrix in $M_n(\mathbb{R})$?
Many real matrices are diagonalizable in the complex space but not in the real space. For example, consider a rotation matrix.