Projector of $\mathbb{R}^{n}$ of rank $p$

Let $f \in \mathcal{L}(\mathbb{R}^{n},\mathbb{R}^{p})$ and $g \in \mathcal{L}(\mathbb{R}^{p},\mathbb{R}^{n})$. We assume that $g \circ f$ is a projector ($g \circ f$ satisfies : $\big( g \circ f \big)^{2} = g \circ f$) of $\mathbb{R}^{n}$ of rank $p$. I would like to prove that $f \circ g = \mathrm{Id}_{\mathbb{R}^{p}}$ .

I have noticed that $\mathrm{Im}(g \circ f) \subset \mathrm{Im}(g)$, which ensures that $\mathrm{rg}(g) \geq \mathrm{rg}(g \circ f) = p$. By the rank-nullity theorem for $g$ : $p = \dim \mathrm{ker}(g) + \mathrm{rg}(g)$. It follows that $\dim \mathrm{ker}(g) = 0$. Therefore, $\mathrm{ker}(g) = \lbrace 0 \rbrace$. But from that, I don't see how I could conclude that $f \circ g = \mathrm{Id}_{\mathbb{R}^{p}}$. I would like to prove that $\mathrm{ker}(f \circ g) = \lbrace 0 \rbrace$, but I can't make a link with $g \circ f$.

If you prove $Ker(f\circ g)=\{0\}$. Then by rank-nullity thm $f\circ g$ is an isomorphism. Now $(f\circ g)^3=(f\circ g)^2$ hence $f\circ g =id$, As$[g \circ f \circ g \circ f=g \circ f \Rightarrow f\circ g \circ f\circ g \circ f\circ g = f\circ g \circ f\circ g]$

You have established that $g$ is injective, and has as image the subspace $V=\operatorname{Im}(g\circ f)$. The fact that $(g\circ f)^2=g\circ f$ means that $(g\circ f)(v)=v$ for all $v\in V$, so the restriction $(g\circ f)|_V$ equals $\def\I{\operatorname{Id}}\I_V$. But then $g$ gives an isomorphism $\Bbb R^p\to V$ since $\dim(V)=p$, and $f|_V:V\to\Bbb R^p$ is its inverse. It follows that $f\circ g=f|_V\circ g=\I_{\Bbb R^p}$, QED.