Commutability transformation Suppose that V is a finite dimensional vector space and $f\in {\rm End}\ (V)$ is diagonalizable with ${\rm dim}\ V$ distint eigenvalues. Show for
$Z(f):=\lbrace g\in {\rm End}\ (V)| fg=gf\rbrace$ we have ${\rm dim}\ Z(f)={\rm dim }\ V$
 A: Let $\{\lambda_i\}_{1\leq i \leq n}$ be the eigenvalues of $f$ and $B = \{v_i\}_{1\leq i\leq n}$ be a basis of $V$ with each $v_i$ an eigenvector of $f$ for $\lambda_i$. Now, if $g\in End(V)$, the functions $fg$ and $gf$ will be the same if and only if they coincide in a basis. In particular, we can take $B$. Hence $fg = gf$ if and only if 
$$
fg(v_i) = gf(v_i) = g(f(v_i)) = g(\lambda_i v_i) = \lambda_ig(v_i) \ (\forall i)
$$ 
Therefore, each $g(v_i)$ is an an eigenvector of $f$ for $\lambda_i$, and since each eigenspace has dimension $1$, $g(v_i) = \mu_i v_i$ for some $\mu_1 , \dots , \mu_n$. Therefore, we have the isomorpshism $\Gamma: \mathbb{k}^n \longrightarrow Z(f)$ given by
$$\Gamma(\mu_1,\dots,\mu_n)(v_i) = \mu_iv_i
$$
which concludes the proof.
A: If $fe_i=c_ie_i$, then $$ fge_i=gfe_i=gc_ie_i=c_i(ge_i) $$
Hence if $ge_i \neq 0$, it is eigenvector wrt $c_i$. By an assumption of $f$, $ge_i=d_ie_i$ for some $d_i$. This implies that $g$ is a diagonal matrix.
If $ge_i=0$, then $ge_i=0e_i$ so that we have same conclusion.
A: Assuming for the moment with Lord Shark the Unknown that $f$ is in fact diagonal, we may write
$f = [\phi_i \delta_{ij}], \tag 1$
where the $\phi_i$, $1 \le i \le \dim V$, are the $\dim V$ distinct eigenvalues of $f$.  We may also write
$g = [g_{ij}], \tag 2$
so that
$[fg] = [\phi_i \delta_{ij}][g_{ij}] = [\phi_j g_{ij}], \tag 3$
and
$[gf] = [g_{ij}][\phi_i \delta_{ij}] = [\phi_i g_{ij}]; \tag 4$
that is, the rows of the matrix $[fg]$ are each a row of $g$ multiplied by the corresponding eigenvalue of $f$, as are the columns of $[gf]$; since these two matrices are equal, by virtue of $fg = gf$, we have
$ [\phi_j g_{ij}] = [fg] = [gf] = [\phi_i g_{ij}], \tag 5$
whence
$[(\phi_j - \phi_i)g_{ij}] = [\phi_j g_{ij} - \phi_i g_{ij}] = [\phi_j g_{ij}] - [\phi_i g_{ij}] = 0, \tag 6$
or
$(\phi_j - \phi_i)g_{ij} = 0, \; \forall i,j; \tag 7$
since $\phi_i \ne \phi_j$ for $i \ni j$ we find that the off-diagoal entries of $[g_{ij]$ vanish, thus
$[g_{ij}] = [g_{ii} \delta_{ij}] \tag 8$
must also be a diagonal matrix in whatever basis we are currently using, in which $f$ is diagonal.  Now the vector space of matrices $\{[g_{ii} \delta_{ij}] \}$ is clearly of dimension $\dim V$ over whatever field $F$ forms the set of scalars for $V$.  We have now covered the case in which $f$ is actually diagonal.   
In the event that $f$ is not diagonal but nevertheless diagonalizable, there exists some invertible $m \in \text{End}(V)$ such that
$[mfm^{-1}] = [\phi_i \delta_{ij}] \tag 8$
is a diagonal matrix, and since $fg = gf$ we have
$(mfm^{-1})(mgm^{-1}) = mfgm^{-1} = mgfm^{-1} = (mgm^{-1})(mfm^{-1}); \tag{9}$
it now follows from what we have accomplished above that the space $\{ mgm^{-1} \}$ of all matrices commuting with $mfm^{-1}$ has dimension $\dim V$, and so then must the space of those $g$ commuting with $f$, since the map
$h \to mhm^{-1}$ is an algebra isomrphism of $\text{End}(V)$.
