Let $G_1$ and $G_2$ be finite groups and let $K \le G_1 \times G_2$
(i) Set $H_1 = \{ g \in G_1 : (g,e) \in K \}$ and $H_2 = \{ g \in G_2 : (e,g) \in K \}$. Show that: $$H_1 \le G_1; \quad H_2 \le G_2; \quad H_1 \times H_2 \le K.$$
(ii) Suppose that $|G_1|$ and $|G_2|$ are coprime. Show that $K = H_1 \times H_2$.
(iii) Show that this result need not follow if $|G_1|$ and $|G_2|$ are not coprime.
I have done part (i). I was doing part (ii) and got stuck:
Since from above I showed that $H_1 \times H_2 \subseteq K$, now I only need to show that $H_1 \times H_2 \supseteq K$.
Let $(g_1,g_2) \in K$ where $g_1 \in G_1$ and $g_2 \in G_2$. Since $K \leq G_1 \times G_2$, we have $(g_1,e) \in K$ and $(e,g_2) \in K$. Hence $g_1 \in H_1$ and $g_2 \in H_2$.
Finally we have $(g_1, g_2) \in H_1 \times H_2$
As I haven't used the fact that order of $G_1$ and $G_2$ are coprime, there must be something fundamentally wrong with my proof.