I recently stumbled across the following statement:
If $G$ and $H$ are groups and $\phi : H \rightarrow G$ and $\psi : G \rightarrow H$ are homomorphisms with $\psi \circ \phi = Id_{H}$, then $G \approx H \oplus \ker \psi$. I believe I have a proof, but my proof relies on $G$ being Abelian. In the context I encountered this, every group under consideration was Abelian, but this statement was given without specifying that either group was Abelian. My question is whether the Abelian condition is necessary. If not, can someone provide a proof of this more general fact, and if so, can someone provide a counter-example? If I'm correct that $G$ being Abelian is necessary, then does anyone have a cleaner proof than the nastiness I've provided below?
A quick sketch of my proof is included below. Note that I'm a little loose with notation using $+$ for both the operations in $G$ and $H$ and I haven't written out all the details. I hope this is still clear enough to get the idea:
Consider the map $f : H \oplus \ker \psi \rightarrow G$ defined by $f(\left<h, k\right>) = \phi(h) + k$. I claim $f$ is an isomorphism. First, if $\left<h_1, k_1\right>$ and $\left< h_2, k_2 \right>$ are elements of $H \oplus \ker \psi$, then $f(\left<h_1, k_1\right> + \left< h_2, k_2 \right>) = f(\left< h_1 + h_2, k_1 + k_2\right>) = \phi(h_1 + h_2) + k_1 + k_2 = \phi(h_1) + \phi(h_2) + k_1 + k_2$. If $G$ is Abelian, we can continue: $\phi(h_1) + \phi(h_2) + k_1 + k_2 = \phi(h_1) + k_1 + \phi(h_2) + k_2 = f(\left<h_1, k_1\right>) + f(\left<h_2, k_2\right>)$, so $f$ is a homomorphism. Further, $f$ is injective since $\phi(h) + k = 0$ implies $\phi(h) = -k$, so $\psi(\phi(h)) = \psi(-k) = 0 = h$ using that $\psi \circ \phi = Id_{h}$ and $k \in \ker \psi$. Finally, $f$ is surjective by the First Isomorphism Theorem (without writing out the details, the FIT tells us that there is one-to-one correspondence between cosets of $\ker \psi$ and elements of $\psi(G) = H$. Using this we can show that $\phi(H)$ contains one representative from each coset of $\ker \psi$ in $G$ and the result follows).
Thanks for any help!