I have been reading Schaum's outlines Linear Algebra and this was a motivating result to prove the primary decomposition theorem.
Statement of Theorem 10.8:

I got stuck in the fourth line which says
$g(T_1)=0$ and $h(T_2)=0$ because $U=Ker[g(T)]$ and $W=Ker[h(T)]$
I don't know how this argument works. An explanation would be helpful.

Use that $T_i$ is the restriction of $T$:
If $u\in U=\ker g(T)$, then $g(T_1)u=g(T|_U)u=g(T)u=0$.