If $\phi$ and $\psi$ are homomorphisms between groups $G$ and $H$ with $\phi \psi = Id_{H}$, then $G \approx H \oplus \ker \psi$ 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!    
 A: A result of this nature is called a spliting lemma and you've shown it is true for abelian groups. It is not true in general, and here is an example that can be found on that page spelled out a bit (which is the simplest example): take the map $S_3 \rightarrow \mathbb{Z}/2\mathbb{Z}$ given by the sign of a permutation. Then the kernel is $A_3$ and the image is $\mathbb{Z}/2\mathbb{Z}$. It is not true that $S_3=A_3\times \mathbb{Z}/2\mathbb{Z}$, which can be shown in many ways, but one is to note that $\{e\}\times \mathbb{Z}/2\mathbb{Z}$ is normal in $A_3\times \mathbb{Z}/2\mathbb{Z}$ but $S_3$ has no normal subgroup isomorphic to $\mathbb{Z}/2\mathbb{Z}$.
A: What is true is that $G$ must be the semidirect product of the kernel of $\phi$ and $\psi(H)$. To prove it, we need to show the intersection of these groups is $\{1\}$ and any element of $G$ is a product of something in the kernel of $\phi$ and something in the image of $\psi$.
The first claim follows from $\phi\circ \psi = \text{id}_H$, since if $\phi(\psi(h)) = 1$, then $h = 1$ and thus $\psi(h) = 1$.
For the second, let $g \in G$ and write $h = \phi(g)$. Then $g\psi(h)^{-1}$ is in the kernel of $\phi$ , so $g = (g\psi(h))^{-1}\psi(h)$ is the product of something in the kernel of $\phi$ and something in the image of $\psi$, as desired.
Now a semidirect product need not be a direct product, but it will be if it is abelian.
