Let $V$ be a finite-dimensional vector space and $S$, $T$ $\in \mathcal{L}(V)$ be operators such that $ST=TS$. It is rather straightforward to show that both $\newcommand{\im}{\operatorname{range }} \im{S}$ (respectively $\newcommand{\im}{\operatorname{range }} \im{T}$) and $\ker{S}$ (respectively $\ker{T}$) are invariant under $T$ (respectively $S$).
- Let $s \in \ker{S}$. Then $0 = T(0) = TS(s) = ST(s) \implies T(S) \in \ker{S}$
- Let $v \in V$. Then $TS(v)=ST(v) \in \newcommand{\im}{\operatorname{range }} \im{S}$
Is the converse true? Namely if $S \in \mathcal{L}(V)$ and $T \in \mathcal{L}(V)$ are operators such that $\newcommand{\im}{\operatorname{range }} \im{S}$ is invariant under $T$, $\newcommand{\im}{\operatorname{range }} \im{T}$ is invariant under $S$, $\ker{S}$ is invariant under $T$ ad $\ker{T}$ is invariant under $S$, does it follow $ST=TS$? If not, what about a counterexample?
Let $T\in\mathcal L(\mathbb R^2)$ be represented by the matrix $\pmatrix{1&2\\0&1}$ and $S$ by $\pmatrix{1&0\\2&1}$. Then the kernel of both $T$ and $S$ is $\{0\}$ and the range is $\mathbb R^2$. But $T$ and $S$ do not commute.
Hope this helps.