TITLE: $ G/H \cong K $ and $ G/K \cong H\implies G \cong H \times K $
QUESTION [5 upvotes]: Let $ (G, *) $ be a group.
Say, $ H, K \lhd G $ such that $ G/H \cong K $ and $ G/K \cong H $
Example:$\ G = Z_{4}, \ H = \{ 0, 2\}, \ K = \{ 0, 2\}  \ $ satisfies the above condition, but $ G \not\cong \{(0,0),(0,2),(2,0)(2,2) \} = H \times K$,
Here we observe that $H \cap K \not= \{(0,0)\}$
Example: $ \ G = GL(n,R), H = SL(n,R), K = Z(G)$ also satisfies the above condition, and $G = H \times K$,
Here we observe that $H \cap K = \{I_{n \times n}\}$
So, intutively I can feel that
$ \ \ G \cong H \times K \iff H \cap K = \{ e \} $
Can anyone prove or counter it?
(In case the statement is wrong, please provide an iff condition for $ G \cong H \times K$ where $ H, K \lhd G $ such that $ G/H \cong K $ and $ G/K \cong H $)

REPLY [4 votes]: I think I have a counterexample. Let $D = \langle a,b \mid b^2=(ab)^2 = 1 \rangle$ be the infinite dihedral group, and let $X = \langle a_1,b_1 \rangle \times \langle a_1,b_2 \rangle$ be the direct product of two copies of $D$.
Now let $G = \langle a_1^2,b_1,a_2^2,b_2,a_1a_2 \rangle \le X$, and note that $|X:G| = 2$.
Let $H = \langle a_1^2,b_1 \rangle$ and $K = \langle a_2^2,b_2 \rangle$. Then $H \cong K \cong D$, and $H \times K \le G$ with $|G:(H \times K)| = 2$.
Now $G/H$ is generated by the images in $H$ of $a_1a_2$, $a_2^2$ and $b_2$, but $(a_1a_2)^2H = a_2^2H$ and $(a_1a_2b_2)^2H = H$, so $G/H \cong D \cong K$ and similarly $G/K \cong H$.
Now, since $[b_1,a_1a_2] = [b_1,a_1] = a_1^2$ and $[b_2,a_1a_2] = a_2^2$, we see that $G/[G,G]$ is a $3$-generator group (of order 8) generated by the images of $b_2$, $b_2$ and $a_1a_2$.
But  the  abelanization of $H \times K$ is a $4$-generator group of order $16$, so $G \not\cong H \times K$.