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