Let $E$, $F$ be two vector spaces on the field $\mathbb K$. We define two linear functions $$f:E\longrightarrow F$$ $$ g:F\longrightarrow E$$ such that . $$f\circ g\circ f=f, \hspace{0.5cm}\text{ and }\hspace{0.5cm} g\circ f \circ g=g.$$ Prove that $$E=\text{Im}(g)\oplus\text{Ker}(f)\hspace{0.5cm}\text{ and }\hspace{0.5cm}F=\text{Im}(f)\oplus\text{Ker}(g).$$ My Attempt
I don't know how to start with this problem. I know that the definition of a direct sum means that first, for every $x\in E$, we have $x=u+v$, where $u\in\text{Im}(g), v\in\text{Ker}(f)$, and $\text{Im}(g)\cap\text{Ker}(f)=\{0_E\}.$
Since $v\in\text{Ker}(f)$, then $f(v)=0$. By using the first property and the linearity of both $f$ and $g$, we get that $$f(g(f(u+v)))=f(g(f(u)+f(v)))=f(g(f(u)))\overset{\Delta}{=}f(u).$$
I also see that somehow, $f$ and $g$ are inverse functions. I'm just confused at what I should do first...
Let's prove $E=\operatorname{Im}(g)\oplus\ker(f)$, the other being similar. We have to show
$1)$ let $v\in\ker(f)\cap Im(g)$, then $f(v)=0$ and there is $w$ so that $v=g(w)$, but now $0=g(0)=g(f(v))=g(f(g(w))=g(w)=v$, so $v=0$ q.e.d.
$2)$ By linearity, from $f(g(f(v)))=f(v)$ we deduce $f(v-g(f(v)))=0$. Therefore forall $v\in E$ we have $v-g(f(v))\in\ker(f)$. Thus $v=v-g(f(v))+g(f(v))$, and setting $u=v-g(f(v))$, $w=g(f(v))$ we have $v=u+w$ as required.