Let $A$ be a matrix of an endomorphism $f$ of $E$. then if $F_1$
and $F_2$ are two supplementary sub-space in $E$ (that is
$E=F_1\oplus F_2$), and are stable under $f$ then by a choice of
bases in $F_1$ and in $F_2$, the matrix of $f$ in the base
obtened of $E$ (meeting of two preceding bases) is a diagonal
block matrix with two block, and $f$ is diagonalized iff the
restriction of $f$ to each $F_i$ is diagonalized.
Let $A$ and $B$ two diagonalizable matrix such that $AB = BA$,
and $E =\oplus_{\lambda\in spect(A)} E_\lambda$ where $E_\lambda$
is the eigenvector space of $A$ relatively to eigenvalue
$\lambda$. so for each $\lambda\in spect(A)$, if $v\in E_\lambda$
then $AB(v)=B(A(v))=B(\lambda v)=\lambda B(v)$ this means that
each $E_\lambda $ is stable by $B$ so we can diagonalize the
restriction of $B$ to each $E_\lambda$, so we get base of $E$
constituted by eigenvectors of both $A$ and $B$.