Let $\displaystyle f:{M}\rightarrow{N}$ and $\displaystyle g:{N}\rightarrow{K}$ be two differentiable functions and $\displaystyle M$,$\displaystyle N$ and $\displaystyle K$ be manifolds. If the rank of $\displaystyle g$ at $\displaystyle f(P)$ is equal to the dimension of $\displaystyle N$, show that $\displaystyle f$ and $\displaystyle g\circ f$ have the same rank at $\displaystyle P$.

Something tells me that I have to use the fundemental equation of dimension, but I can't work it out.