Prove that $HK$ is a subgroup iff $HK=KH$. Let $H$ and $K$ be subgroups of a group $G$, and let $HK=\{hk: h
\in H, k \in K\}$, $KH=\{kh: k \in K, h \in H\}$. How can we prove that $HK$ is a subgroup iff $HK=KH$?

"$\Leftarrow$" Clearly $e\in HK$ since $e\in H\cap K$. Let $hk, h'k'\in HK$. Then for $HK$ to be a group, we need $(hk)(h'k')\in HK$. This follows from $HK=KH$, since $$(hk)(h'k') = h(kh')k'=h(h''k'')k' = (hh'')(k''k')\in HK $$
(where $h''\in H$, $k''\in K$). You can similarly show that $HK=KH$ implies that $HK$ is closed with respect to inverses.
