Dimension of a subspace of $M_n(\mathbb C)$. What is the dimension of the subspace of $M_n(\mathbb C)$ consisting of matrices $B$ such that $AB = BA$, for some fixed matrix $A$ in $M_n(\mathbb C)$?

It depends on the Jordan canonical form of $A$.  For example, suppose 
$$ 
A = \pmatrix{\lambda & 1 & 0 & 0 & 0\cr 0 & \lambda & 1 & 0 & 0\cr
0 & 0 & \lambda & 0 & 0\cr
0 & 0 & 0 & \lambda & 1\cr
0 & 0 & 0 & 0 & \lambda\cr}$$ 
Then in order to commute with $A$, $B$ must be of the form
$$ \left( \begin {array}{ccccc} a&b&c&d&e\\ 0&a&b&0&d
\\ 0&0&a&0&0\\ 0&f&g&h&i
\\ 0&0&f&0&h\end {array} \right) 
$$
 In this case there are $9$ free parameters, so the space is $9$-dimensional.
In general, suppose $A$ has $m$ Jordan blocks of sizes $s_i$, $i= 1.. m$, and
let $e(i,j) = 1$ if blocks $i$ and $j$ have the same eigenvalue, $0$ otherwise.
Then the dimension is 
$$\sum_{i=1}^m \sum_{j=1}^m e(i,j) \min(s_i,s_j)$$
