Prove that $\operatorname{rank} (f) + \operatorname{rank} (g) -\dim W\leq \operatorname{rank}(g\circ f)$, where $f:V\to W$ and $g:W\to X$ with both $f$ and $g$ being linear maps.
My attempt: The inequality is equivalent to proving that $\dim \ker (f)+\dim \ker(g)\geq \dim \ker(g\circ f).$ To prove this we can show that the set $\ker(g\circ f )\subset \ker(f)+\ker(g).$ Let $\ker(f)+\ker(g)=\{v+w:f(v)=0\text{ and } g(w)=0\}.$ So let $x\in V$ be an element of the $\ker(g\circ f).$ Then $g(f(x))=0.$ If $x\in \ker f$ then $f(x)=0_W$ and so we can represent $x$ as $x+0_W\in \ker(f)+\ker(g).$ I am not sure how to proceed further.
I know why this inequality must be true. There are some elements in $W$ not equal to $0$ that are included in the kernel of $g.$ If even one does not have a pre-image in $V$ then we get a strict inequality and if all them have a preimage then we get an inequality. I am just not able to verbalize this in a formal proof. Any insights would be much appreciated.