Suppose you have $G$ a group, and $H,K$ both subgroups of $G$. Let $f: H \times K \rightarrow G$ such that $f((h,k))=hk$. Show that $H \times K /\sim_f$ is in bijection with $H \cap K$. Where $\forall (x_1,x_2) \in E^2, (x_1 \sim_f x_2 \iff f(x_1) = f(x_2))$
I have a hard time doing this. I saw there is a similar question but I am unable to comprehend it. My teacher gave me a proof, by trying to find an element such that if $hk = h'k'$ then by putting $t=h^{-1}k'$ you get $h'k' = (hl)(l^{-1}k)=h(ll^{-1})k=hk$, but I can't understand how this proves the bijection.