Determine the set of commuting endomorphisms with a nilpotent endomorphism Let $E$ be an $\mathbb R$-vector space of dimension $n$. We denote $L(E)$ the vector space of endomorphisms of $E$. Let $f\in L(E)$ such that the least integer $k$ such that $f^k=0$ is for $k=n$. I want to show that if $g$ is an endomorphism of $E$ such that $g\circ f=f\circ g$ then there exists reals $a_0,\cdots,a_{n-1}$ such that $g=a_0id+a_1f+\cdots +a_{n-1}f^{n-1}$.
My try: I'm tempted to show that the family of endomorphisms $(id,f,\cdots,f^{n-1}) $ generates the vector subpsace $A$ of $L(E)$ where $A=\{g\in L(E)\,|\, g\circ f=f\circ g\}$.
I think it is possible to prove that this family is linearly independent (using the fact that there exists $x_0\in E$ such that $f^{n-1}(x_0)\not =0$) but how to conclude that it is basis of $A$ unless we know that $A$ is actually a subspace of dimension $n$ but this i'm not sure about. I don't even know the dimension of the vector space $L(E)$ of endomorhphisms of $E$.
 A: Consider the subspaces $V_k:=\ker(f^k)$. Then, by assumption we must have
$$0=V_0\subsetneq V_1\subsetneq V_2 \dots \subsetneq V_{n-1}\subsetneq V_n=E\,,$$
so that $\dim(V_k)=k$. (If dimension increased by more at one inclusion, we would already have $f^{n-1}=0$.)
Now choose a basis according to this chain: first fix any nonzero $v_1\in V_1$ then let $v_2\in V_2$ such that $f(v_2)=v_1$ (actually, with any $w\in V_2$, we have $f^2(w)=0$ hence $f(w)\in V_1$). Then find a $v_3\in V_3$ such that $f(v_3)=v_2$ and show that ${\rm span}(v_1,v_2,v_3)=V_3$, and so on...
Now if $g\circ f=f\circ g$, for all $v_k$ we have
$$g(v_{k-1})=g(f(v_k))=f(g(v_k))\,.$$
This means that the single value $g(v_n)\ \in E$ already determines the whole $g$: we must have $g(v_{n-s})=f^s(g(v_n))$. Consequently, with $A=\{g\in L(E)\,:\,f\circ g=g\circ f\}$, we must have $\dim(A)\le \dim(E)=n$ as the evalutaion map at $v_n$:
$$A\to E,\quad g\mapsto g(v_n)$$
is injective by the above. Together with your original work, that ${\rm id}=f^0,\ f,\ f^2,\dots,\ f^{n-1}$ are linearly independent, we are ready.
