Product of two subgroups the whole group? I think I remember seeing a theorem about this in my Abstract Algebra class, but I cannot seem to find the reference for it anymore. 
Let $G$ be a group and let $H$ and $K$ be non trivial subgroups of $G$. Are there any sufficient conditions on $H, K$ and $G$ such that $G = HK$? (In other words $\forall g \in G$, there exist $h \in H$ and $k \in K$ such that $g = hk$) 
 A: Perhaps you have seen the result

If the indices in the finite group $G$ of the subgroups $H$ and $K$ are coprime, then $G = H K$.

Actually the result holds for any group, not necessarily finite.

Proof
We have $$\lvert G : H \cap K \rvert = \lvert G : H \rvert \cdot \lvert H : H \cap K \rvert = \lvert G : H \rvert \cdot \lvert H K : K \rvert \le  \lvert G : H \rvert \cdot \lvert G : K \rvert.\tag{eq}$$
From (eq) we obtain first that $\lvert G : H \rvert$ divides $\lvert G : H \cap K \rvert$. Similarly $\lvert G : K \rvert$ divides $\lvert G : H \cap K \rvert$. 
Since the two indices are coprime, we have that 
$$\lvert G : H \rvert \cdot \lvert G : K \rvert\quad\text{divides}\quad\lvert G : H \cap K \rvert.$$
But (eq) also yields that 
$$\lvert G : H \cap K \rvert \le  \lvert G : H \rvert \cdot \lvert G : K \rvert.$$
It follows that $$\lvert G : H \rvert \cdot \lvert G : K \rvert = \lvert G : H \cap K \rvert.$$ 
But then
$$
\lvert H K \rvert = \frac{\lvert H \rvert \cdot \lvert K \rvert}{\lvert H \cap K \rvert} = \frac{\lvert G : H \cap K \rvert}{\lvert G : H \rvert \cdot \lvert G : K \rvert } \cdot \lvert G \rvert = \lvert G \rvert,
$$
so $G = H K$.
Please note that we are writing $HK = \{ h k : h \in H, k \in K \} \subseteq G$ without assuming that this is a subgroup.
Addendum
Actually the proof holds for an arbitrary group, which is not necessarily finite. Just replace the final argument by
$$
\lvert H K : H \rvert = {\lvert K : H \cap K \rvert} = \frac{\lvert G : H \cap K \rvert}{\lvert G : K \rvert }  = \lvert G : H\rvert,
$$
which implies $H K = G$.
A: I will consider only the case when the groups are finite.
One situation that occurs with some frequency is when $|G| = |H||K|$, where $|\cdot|$ denotes the order of the group or subgroup, and the intersection $H\cap K = \{e\}$ is trivial.  Then $HK = G$.  To see this, consider the function (not group homomorphism!) $H \times K \to G$ that sends $(h,k) \mapsto hk$.  Since $H\times K$ and $G$ have the same cardinality, this map is a bijection as soon as it is an injection.  So suppose that $h_1k_1 = h_2k_2$.  Then $h_2^{-1}h_1 = k_2k_1^{-1} \in H \cap K$, and so $h_2^{-1}h_1 = k_2k_1^{-1} = e$, so $h_2 = h_1$ and $k_2 = k_1$.
More generally, if $|H\cap K| = n$, then the "multiplication" function $H\times K \to G$ is exactly $n$-to-one.  It follows that $G = HK$ iff $|G||H\cap K| = |H||K|$, since an $n$-to-one function is onto iff the domain has exactly $n$ times as many elements as the codomain.

The case when $G = HK$ and $H\cap K = \{e\}$ is so important, it has its own name: when this happens, $G$ is called the bicrossed product of $H$ and $K$, written $G = H \bowtie K$.  (This generalizes the direct and semidirect products.)  In particular, sometimes you know $H$ and $K$, but not $G$; then you need a little extra data to decide how to put them together.  
For the semidirect product $H \ltimes K$, this extra data is a homomorphism $H \to \operatorname{Aut}(K)$, where $\operatorname{Aut}(K)$ denotes the group of group-automorphisms of $K$.  I.e. you have a right action of $H$ on the set $K$ — I will write the action of $h\in H$ on $k\in K$ as $k\triangleleft h$ — such that $(k_1k_2)\triangleleft h = (k_1\triangleleft h)(k_2\triangleleft h)$ for all $h\in H$ and $k_1,k_2\in K$.  Also $e \triangleleft h = e$ for all $h$.
For the bicrossed product, the extra data are two actions: a right action of $H$ on $K$, which I will write as $\triangleleft$, and a left action of $K$ on $H$, which I will write as $\triangleright$.  So $k \triangleleft h \in K$, and $k\triangleright h \in  H$.  The axioms are:
$$ (k_1k_2) \triangleleft h = (k_1 \triangleleft (k_2 \triangleright h))(k_2 \triangleleft h) \\
k \triangleright (h_1h_2) = (k\triangleright h_1)((k\triangleleft h_1)\triangleright h_2) \\
k \triangleright e = e \\ e \triangleleft h = e$$
for all $h,h_1,h_2\in H$ and all $k,k_1,k_2\in K$.  The semidirect product case is when $k \triangleright h = h$.
