TITLE: Finite groups with co-prime orders
QUESTION [5 upvotes]: $G_1$ and $G_2$ are finite groups and $K \leq G_1 \times G_2$. 
$H_1 = \left\{ g \in G_1 : (g,e) \in K \right\}$
$H_2 = \left\{ g \in G_2 : (e,g) \in K \right\}$

I've already shown that $H_1 \leq G_1$, $H_2 \leq G_2$ and $H_1 \times H_2 \leq K$.

Now suppose that $|G_1|$ and $|G_2|$ are coprime. Show that $K = H_1
 \times H_2$ and finally show that this result need not follow if
  $|G_1|$ and $|G_2|$ are not coprime.

As $|G_1|$ and $|G_2|$ are coprime we must have that $|H_1| \neq |H_2|$ as by Lagrange's theorem $|H_1| \ \mid \ |G_1|$ and $|H_2| \ \mid \ |G_2|$
Also $|G_1|$ and $|G_2|$ are coprime implies that $|H_1|$ and $|H_2|$ are coprime which, in turn, implies that $| H_1 \times H_2 | = |H_1| \cdot |H_2|$
As $H_1 \times H_2 \leq K$ we must have, by Lagrange's theorem, that $| H_1 \times H_2 | = |H_1| \cdot |H_2| \ \mid \ K$
Also as $K \leq G_1 \times G_2$ and $|G_1 \times G_2| = |G_1| \cdot |G_2|$ then $K \ \mid \ |G_1| \cdot |G_2|$
I can't see the connection to make to conclude that $K = H_1 \times H_2$, I'm pretty sure that if $|K| = |H_1 \times H_2| = |H_1| \cdot |H_2|$ it implies the result, but I can't see how to conclude it. Also, in regards to the second part, showing that the result need not follow if $|G_1|$ and $|G_2|$ are not coprime, this is obvious, but is there a 'simple' counter example or can it be argued in a similar fashion to the above?
Thanks!

REPLY [4 votes]: We can always find a counterexample if $|G_1|$ and $|G_2|$ are not coprime. 
Let $p$ be a prime dividing $|G_1|$ and $|G_2|$. By Cauchy's theorem $G_1$ and $G_2$ both contain an element of order $p$, let $x_1 \in G_1$ and $x_2 \in G_2$ have order $p$. Then the subgroup generated by $(x_1, x_2)$ is not of the form $A \times B$, where $A \leq G_1$ and $B \leq G_2$.
(The example given by Jyrki is exactly this. The smallest example is $\mathbb{Z}/2\mathbb{Z} \times \mathbb{Z}/2\mathbb{Z}$)