TITLE: Primary decomposition problem
QUESTION [9 upvotes]: Let $T$ be a linear operator on a finite dimensional space $V$, and let $p=p_{1}^{r_{1}} \cdots p_{k}^{r_{k}} $ be the minimal polynomial for $T$, and let $V= W_{1} \oplus\cdots\oplus W_{k}$ be the primary decomposition for $T$, i.e., $W_{j}$ is the null space of $p_{j}(T)^{r_{j}}$. Let $W$ be any subspace of $V$ which is invariant under $T$. Prove that 
$W= (W \cap W_{1})\oplus (W \cap W_{2})\oplus \cdots \oplus (W \cap W_{k})$.

REPLY [4 votes]: To answer the new question in the OP (thus completing EuYu’s answer) :
Notice first that the nullspace $W_i={\sf Ker}(p_i(T)^{r_i})$ can also be written
as a image space $W_i={\sf Im}(q_i(T))$ where $q_i=\prod_{j\neq i}p_j(T)^{r_j}$.
Indeed, the inclusion ${\sf Im}(q_i(T)) \subseteq W_i$ follows from the
Cayley-Hamilton theorem. Conversely, let $w\in W_i$. The polynomial $p_i^{r_i}$ is coprime to $q_i$. We then have a Bezout identity
$$
(p_i^{r_i})A_i+q_iB_i=1 \tag{1}
$$
for some polynomials $A_i,B_i$. It follows that $w=q_i(T)(B_i(T)w)$, showing
$w\in {\sf Im}(q_i(T))$. In fact, this very argument shows that 
$E_iw=q_i(T)(B_i(T)w)$ for any $w\in V$ at all (not just $w\in W_i$), so that
$E_i=q_i(T)B_i(T)$ is a “polynomial” in $T$. So any $T$-invariant subspace
is automatically $E_i$-invariant also.