If $H,K \leq G$ a finite group, then $\left\lvert HK \right\rvert = \cdots$ 
If $H,K \leq G$ a finite group, then 
  $$\left\lvert HK \right\rvert = \frac{\left\lvert H \right\rvert \cdot \left\lvert K \right\rvert}{\left\lvert H\cap K \right\rvert}.$$

The first part of the problem asked us to show this when $\left\lvert H\cap K \right\rvert=1$. This was doable and I used a counting argument saying how if we had some $h_ik_j=h_lk_m$ then $h_i=h_l$ and $k_j=k_m$. Then counting the size of the set $HK$ was straightforward.
My attemps for this problem have been saying something like
$$\frac{\left\lvert H \right\rvert \cdot \left\lvert K \right\rvert}{\left\lvert H\cap K \right\rvert}= \frac{\left\lvert H / (H \cap K) \right\rvert \cdot \left\lvert H \cap K \right\rvert^2 \cdot \left\lvert K / (H \cap K ) \right\rvert}{\left\lvert H \cap K \right\rvert}=\left\lvert H \cap K \right\rvert \cdot \left\lvert H / (H \cap K) \right\rvert \cdot \left\lvert K / (H \cap K) \right\rvert$$
$$= \left\lvert H \right\rvert \cdot \left\lvert K / (H \cap K) \right\rvert.$$
Any ideas for ways I could solve this?
 A: Consider firstly the case: $H\cap K=\{e\}$. So we want to show that
$$|HK|=|H|\cdot |K|$$
One should ask: how could this fail to happen?
The answer clearly must be that, if we list all the elements $hk$, with $h\in H,k\in K$, there should be some collapsing, that is some element in the list must appear at least twice. Equivalently, for some $h\neq h_1\in H$, we must have
$$hk=h_1k_1$$
But then
$$h_1^{-1}h=k_1k^{-1}$$
so that
$$h_1^{-1}h\in H\cap K=e$$
leading to the contadiction: $h=h_1$. So no collapsing can occur.
Now the general case. We ask ourselves: how often does a given element $hk$ appear as a product of the list for $HK$. Our claim is that it must appear exactly $|H\cap K|$ times. To see this, we firstly remark that if $h_1\in H\cap K$, then
$$hk=(hh_1)(h_1^{-1}k)$$
thus $hk$ is duplicated in the product at least $|H\cap K|$ times.
However, if $hk=h'k'$, then
$$h^{-1}h'=kk'^{-1}=:u$$
and $u\in H\cap K$, and so $h'=hu$ and $k'=u^{-1}k$
Thus all duplications were accounted for in the previous equation: $hk=(hh_1)(h_1^{-1}k)$. Consequently, $hk$ appears in the list exactly $|H|\cdot |K|$ times. Thus the number of distinct elements in $HK$ is the total number of elements in the list of $HK$, i.e. $|H|\cdot |K|$, divided by the number of times a given elements appear, i.e. $|H\cap K|$, as we claimed.
A: Consider the surjection $H\times K\to HK:(h,k)\mapsto hk$. For any $x\in H\cap K$, $(hx,x^{-1}k)\mapsto hk$, so each element $hk\in HK$ has at least $|H\cap K|$ preimages in $H\times K$. 
For a fixed element of $HK$, I claim for any two preimages $(h,k)$ and $(h',k')$ in $H\times K$ we have $h'=hx$ and $k'=x^{-1}k$ for some $x\in H\cap K$. By assumption $hk=h'k'$, so $h'^{-1}h=k'k^{-1}\in H\cap K$. Let $y$ be this element. Then
$$
h'=h(h^{-1}h')=hy^{-1}$$
and
$$
k'=(k'k^{-1})k=yk.
$$
So each element of $HK$ has $|H\cap K|$ preimages in $H\times K$, so
$$
|HK||H\cap K|=|H\times K|=|H|\cdot |K|
$$
and the conclusion follows.
