Every element of $HK$ is of the form $hk$, where $h\in H$ and $k\in K$; further, there are $o(H) o(K)$ such representations. However, these representations are not necessarily unique. If $hk = h'k'$ for some $h,h'\in H$ and $k,k'\in K$, then $(h')^{-1}h = k'k^{-1}$. Since $H$ is a subgroup of $G$, $(h')^{-1}h\in H$; since $K$ is a subgroup of $G$, $k'k^{-1}\in K$. Therefore, if $x = (h')^{-1}h = k'k^{-1} $, then $x \in H\cap K$, $h = h'x$ and $k' = xk$. It follows that the number of repetitions of given element $hk \in HK$ is $o(H\cap K)$. Thus $o(HK)o(H\cap K) = o(H)o(K)$, or $o(HK) = o(H)o(K)/o(H\cap K)$.