inequality-dimension of kernel

The following problem is an unsolved practice problem from a textbook which is assigned at the end of the chapter. So, I need hints on how to start solving the problem below:

Show that if $U$, $V$, $W$ are finite dimensional vector spaces, and $f\in \mathrm{Hom}\left ( U,V \right )$, $g\in \mathrm{Hom}\left ( V,W \right )$, then: $\dim \mathrm{Ker}\left ( gf \right )\leqslant \dim \mathrm{Ker}(f) + \dim \mathrm{Ker}(g)$

-
Please (i) provide context (is this homework? Self-study? In what context did you find the problem?) (ii) say a few words about what you've tried or what your thoughts are; and (iii) try not to simply write a problem as if you were assigning homework to the group; some of us find that at least mildly rude. The first two points help ensure that you receive answers that are at the appropriate level, and that people don't waste time suggesting things you've already thought about. – Arturo Magidin Jan 20 '12 at 4:06
I think you want to write $g \circ f$. – Dylan Moreland Jan 20 '12 at 4:09
Are your functions written on the right? Otherwise, $fg$ does not make sense. – Arturo Magidin Jan 20 '12 at 4:11
@Arturo Magidin: You're right. The functions are written $gf$ and not $fg$. I have already fixed the original statement. – M.Krov Jan 20 '12 at 4:28
@m_p2009: That's not just information for me: that's information that is relevant to all readers. Please put it in the post, not the comments, and in the future please try to write in the context into the post from the very first. – Arturo Magidin Jan 20 '12 at 4:36

Hint the first: $\mathrm{ker}(f)\subseteq \mathrm{ker}(g\circ f)$.
Hint the second: Let $U' = \{ u\in U\mid f(u)\in\mathrm{ker}(g)\}$. Now use the Rank-Nullity Theorem.
I can prove the first hint. For the second one, In general if $T$ is a linear map from $V$ to $W$, then the rank nullity theorem is given by: $dim Ker T + dim Im T = Dim V$. In your case, how are you applying the rank nullity theorem? and to which spaces? – M.Krov Jan 20 '12 at 4:40
@m_p2009: To the restriction of $f$ to $U'$, which is a linear map from $U'$ to $\mathrm{ker}(g)$; and note that the Rank-Nullity Theorem tells you that $$\dim V = \dim\mathrm{ker}(T) + \dim\mathrm{Im}(T) \leq \dim\mathrm{ker}(T)+\dim(W).$$ – Arturo Magidin Jan 20 '12 at 4:44
Note that $U'$ is precisely the kernel of $gf$. The image is a subspace of the kernel of $g$. The kernel is the kernel of $f$ (by the first hint). – Arturo Magidin Jan 20 '12 at 4:58
This is what I can deduce based on the previous hints $Dim \left ( U^{'}\right )=dim\left ( Ker gf \right )\leqslant dim Ker (f/U^{'})+dim Ker\left ( g \right )$. Can we say that $dim Ker (f/U^{'}) \leqslant dim Ker (f)$? – M.Krov Jan 20 '12 at 5:08
@m_p2009: as the last sentence of my last comment notes, $\mathrm{ker}(f|_{U'}) = \mathrm{ker}(f)\cap U' = \mathrm{ker}(f)$. So you have equality of subspaces, hence of dimensions. – Arturo Magidin Jan 20 '12 at 5:21