Primary Decomposition of $\mathbb{R^n}$ under T I have a question related to the Primary Decomposition Theorem for a vector space under a linear transformation.  The following question is a direct corollary of this theorem.  However, I wish to prove it without calling upon theorem.  I am currently studying for a comprehensive exam and ran across this question.  I never really felt comfortable with the proof I saw of the Primary Decomposition Theorem so I hoping with your help with this problem I will understand this particular problem and better understand that proof as I believe their proofs will be essentially the same techniques. 
Question:  Suppose we have a linear transformation $T: \mathbb{R^n}\to \mathbb{R^n}$ with minimal polynomial $m(x)=f(x)g(x)$ and $f(x),g(x)$ are relatively prime.  Show that we can write $\mathbb{R^n}=M\oplus N$ where $M$ and $N$ are $T$-invariant subspaces s.t $f(x)$ is the minimal polynomial for $T|_M$ and $g(x)$ is the minimal polynomial for $T|_N$. 
So I know that I want to use $M=ker(f(T))$ and $N=ker(g(T))$ but after that I really don't have much.  Since this isn't a homework problem for a class I am essentially looking for someone to present me a proof of this simpler question and walk me through their logic so that I can hopefully understand the general theorem and its proof.  Thanks in advance for the help!
 A: The theorem you want to use is the following :

Let $E$ be a real vector space and $P,Q$ two polynomials relatively prime. Let $u \in \mathrm{End}(E)$. Then, we have :
$$ \mathrm{ker}((PQ)(u)) = \mathrm{ker}(P(u)) \oplus \mathrm{ker}(Q(u)) $$

Here, consider the linear transformation $T \in \mathrm{End}(\mathbb{R}^{n})$. Its minimal polynomial is $m=fg$, with $f$ and $g$ two polynomials relatively prime. You can apply the previous theorem with $P =f$, $Q=g$ and $u=T$. It gives :
$$ \mathrm{ker}(m(T)) = \mathrm{ker}(f(T)) \oplus \mathrm{ker}(g(T)) $$
Since $m$ is the minimal polynomial of $T$, by definition, we have $m(T) = O_{\mathrm{End}(\mathbb{R}^{n})}$. From that, we get : $\mathrm{ker}(m(T)) = \mathbb{R}^{n}$. Eventually, we have :
$$ \mathbb{R}^{n} = \mathrm{ker}(f(T)) \oplus \mathrm{ker}(g(T)) $$
It is clear that $\mathrm{ker}(f(T))$ and $\mathrm{ker}(g(T))$ are invariant under $T$. Next thing you want to prove is that $f$ is the minimal polynomial of $T\vert_{N}$. 
Let $N = \mathrm{ker}(f(T))$ and $m(T\vert_{N})$ the minimal polynomial of $T\vert_{N}$. For all $x \in N$, we have $f(T)(x) = 0$. Which also writes $f(T\vert_{N})=0$. By definition of the minimal polynomial, $m(T\vert_{N})$ must devide $f$.
By definition,we have $m(T)=(fg)(T)=0$. This implies that $\mathrm{Im}(g(T)) \subset \mathrm{ker}(f(T)) = \mathrm{ker}\left( m(T\vert_{N})(T) \right)$. It follows that $(m(T\vert_{N})g)(T)=0$. So, $m = fg$ must devide $m(T\vert_{N})g$. From that, we conclude that $f$ must devide $m(T\vert_{N})$.
Edit : (proof of the theorem)

The main idea of the proof is to use the hypothesis we have on $P$ and $Q$, which is that these two polynomials are relatively prime. This should ring a bell and remind you of the Bezout identity. It states that there exists two polynomials $U$ and $V$ in $\mathbb{R}[X]$ such that 
$$ UP + VQ = 1 $$
(it also writes $(UP)(X) + (VQ)(X) = 1$). If you substitute $T$ to $X$ in the previous equality, you get :
$$ \tag{$\star$} (UP)(T) + (VQ)(T) = \mathrm{Id}_{\mathbb{R}^{n}} $$
Let $x \in \mathrm{ker}((PQ)(T))$. From $(\star)$, we get :
$$ \tag{$\star \star$} x = (UP)(T)(x) + (VQ)(T)(x) $$
Let $N = \mathrm{ker}(P(T))$ and $M=\mathrm{ker}(Q(T))$. Let's prove that $(UP)(T)(x) \in M$ (this is the part which may be tricky). We want to prove that $Q(T) \bigg[ (UP)(T)(x) \bigg] = 0$.
$$
\begin{eqnarray*}
Q(T) \bigg[ (UP)(T)(x) \bigg] & = & \bigg[ Q(T) \circ (UP)(T) \bigg](x) \\
 & = & \bigg[ \left( Q \times UP \right)(T) \bigg](x) \\
 & = & \left( QUP \right)(T)(x) \\
 & = & U(T) \bigg[ (PQ)(T)(x) \bigg] \\
\end{eqnarray*}
$$
But out hypothesis is that $x$ belongs to $\mathrm{ker}((PQ)(T))$. We get :
$$ Q(T) \bigg[ (UP)(T)(x) \bigg] = U(T)(0) = 0 $$
So, $(UP)(T)(x) \in M$. (It is the same to prove that $(VQ)(T)(x) \in N$). Eventually, we have :
$$ x = \underbrace{(UP)(T)(x)}_{\in M} + \underbrace{(VQ)(T)(x)}_{\in N} $$
This proves that $\mathrm{ker}((PQ)(T)) = \mathrm{ker}(P(T)) + \mathrm{ker}(Q(T))$. 
It remains to prove that $\mathrm{ker}(P(T)) \cap \mathrm{ker}(Q(T)) = \lbrace 0 \rbrace$. From $(\star \star)$, it follows that :
$$
\begin{eqnarray*}
x & = & (UP)(T)(x) + (VQ)(T)(x) \\
 & = & U(T) \bigg[ P(T)(x) \bigg] + V(T) \bigg[ Q(T)(x) \bigg] \\
 & = & 0 \\
\end{eqnarray*}
$$
So, $\mathrm{ker}(P(T)) \cap \mathrm{ker}(Q(T)) = \lbrace 0 \rbrace $.
Finally, $$\boxed{\mathrm{ker}((PQ)(T)) = \mathrm{ker}(P(T)) \oplus \mathrm{ker}(Q(T))}$$

