Let $E$ a finite dimensional vector space and $f \in \mathcal{L}(E)$. Show that: $$\operatorname{Ker} f=\operatorname{Im} f \Leftrightarrow (f^2=0) \wedge (\exists h \in \mathcal{L}(E) \mid h \circ f + f \circ h=Id_E)$$
My attempt:
I managed to show the $\Leftarrow$ implication.
For $x \in \operatorname{Im} f$, $x=f(y)$, then $x \in \operatorname{Ker} f$ because $f(x)=f^2(y)=0$ so $\operatorname{Im} f \subset \operatorname{Ker} f$.
For $x \in \operatorname{Ker} f$, we have $h \circ f(x) + f \circ h(x)=f \circ h(x)=x$ which shows that $x \in \operatorname{Im} f$. So $\operatorname{Ker} f \subset \operatorname{Im} f \Rightarrow \operatorname{Ker} f = \operatorname{Im} f$.
Now, assuming $\operatorname{Ker} f = \operatorname{Im} f$, for any $x$, we have $f^2(x)=f(f(x))=0$, hence $f^2=0$. Yet, I can’t figure out the other part of the $\Rightarrow$ implication. I guess we would need to construct explicitly a function $h$ satisfying the equality. Generally in these kind of problems, a trick is to consider the decomposition $E=\operatorname{Ker} f + \operatorname{Im} f$ but it is here clearly not possible. Could anyone give me a hint on how to proceed?