The dimension of centralizer of a Matrix.
Solution 1:
I don't think there's an easy way to do this. I agree with the above comment that you should play with different matrices yourself. I'm adding this mostly so you have a reference. See: Nilpotent Orbits in Semisimple Lie Algebras by Collingwood, McGovern, Theorem 6.1.3. The statement is:
Let $A$ be a nilpotent matrix, i.e. eigenvalues are all zero. Its Jordan normal form is given by a partition of $n$, say $d_1 + \cdots + d_k$. Then, one has that the dimension of the centralizer is $$\sum s_i^2$$ where $s_i = |\{j \mid d_j \geq i\}|$. You can generalize this formula now to a general matrix $A$ in Jordan normal form (the blocks with different eigenvalues don't interact -- you can check quickly if you think of $A$ as acting by column/row operations), to get $$\sum_\lambda \sum_i s_{i, \lambda}^2$$ where $\lambda$ ranges over all eigenvalues (generalized) and $s_{i, \lambda}$ as above.
Edit for experts: Okay, so, the way I would do this in general, is for a nilpotent element $x$, find $h$ such that $[h, x] = 2x$. One can do this separately for each Jordan block; if $x$ is a Jordan block, then $h = diag(k, k-2, k-4, \ldots, 4-k, 2-k, -k)$. One can complete this to an $\mathfrak{sl}_2$ triple by taking $y = x^t$, i.e. $(x, y, h)$ is a copy of $\mathfrak{sl}_2$. Then, we can decompose $\mathfrak{g}$ into into eigenspaces for $ad(h)$, and note that in fact these are eigenspaces for various $\mathfrak{sl}_2$-representations, and the highest weights are killed by $x$ (i.e. in the centralizers). So, we want to count representations, which one can do with some combinatorics (yielding the above formula) or just directly. For example, in the above (or below) answer, $h = diag(1,-1,1,-1)$, and one has $$\left(\begin{array}{cccc}0&2&0&2\\-2&0&-2&0\\0&2&0&2\\-2&0&-2&0\end{array}\right)$$ where the number is the $h$-weight of that eigenspace. We count 4 weight 2 eigenspaces, 4 weight -2 eigenspaces, and 8 weight 0 eigenspaces, giving us a total of $4 + (8-4) = 8$ representations. Explicitly, one has the decomposition $\mathfrak{g} = V(2)^{\oplus 4} \oplus V(0)^{\oplus 4}$ as $\mathfrak{sl}_2$ representations.
Solution 2:
And, in case you were wondering, here's the case for two Jordan blocks of sizes $3$ and $2$. The centralizer of $$ \left[ \begin {array}{ccccc} \lambda&1&0&0&0\\0&\lambda&1&0&0 \\ 0&0&\lambda&0&0\\ 0&0&0&\lambda&1 \\ 0&0&0&0&\lambda\end {array} \right] $$ consists of matrices of the form $$ \left[ \begin {array}{ccccc} b_{{3,3}}&b_{{2,3}}&b_{{1,3}}&b_{{2,5}}& b_{{1,5}}\\ 0&b_{{3,3}}&b_{{2,3}}&0&b_{{2,5}} \\ 0&0&b_{{3,3}}&0&0\\0&b_{{5,3}} &b_{{4,3}}&b_{{5,5}}&b_{{4,5}}\\0&0&b_{{5,3}}&0&b_{ {5,5}}\end {array} \right] $$ More generally, if you have Jordan blocks with the same eigenvalue for indices $i, \ldots, j$ and $k, \ldots, l$, for a matrix in the centralizer the block formed by rows $i,\ldots, j$ and columns $k, \ldots, l$ will be "upper triangular" (i.e. $0$ for $row - column > \min(i-k, j-l)$) and constant on diagonals. The dimension for this block is then $\min(l-k+1,j-i+1)$, and you have to add this up for all blocks.