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$?
 A: It is usually helpful to recall that $ L$ is a subgroup if and only if $ L^ 2=L $, $ L^{- 1}=  L $ and $  L\neq \varnothing$. 
If $HK$ is a subgroup, then $HK=(HK)^{-1}=K^{ -1}H^{-1}=KH$. Hence the condition is met. Conversely, 
$$ \begin{align}(HK)^{ -1} &= K^{ -1}H^{-1}\\&=KH =HK\text{, }\\(HK)(HK)=H(KH)K&=\\H( HK)K&=  H^2K^ 2=   HK\end{align} $$ and of course $ HK\neq \varnothing$. We made repeated use of the fact $ H $ and $ K $ are subgroups and $ H K = KH $.
A: Suppose that $HK$ is a subgroup. Then for every $x\in HK$ there exists $h\in H, k\in K$ such as $x=hk$. But $x^{-1}$ is in $HK$ too, and $x^{-1}=(hk)^{-1}=k^{-1}h^{-1}\in KH$, therefore $HK\subseteq KH$. Conversely, for $k\in K$ and $h\in H$ we have $k\in HK$ and $h\in HK$. Since $HK$ is a subgroup we get $kh\in HK$, so $KH\subseteq HK$.
Now suppose $HK=KH$.
1° $e\in H, e\in K$ so $e\in HK$.
2° For $x,y\in HK$ there exists $h_x,h_y\in H$ and $k_x,k_y\in K$ such that $x=h_xk_x$ and $y=h_yk_y$, so $xy=h_xk_xh_yk_y$, but $KH=HK$ so you can find $h\in H, k\in K$ such as $k_xh_y=hk$ and therefore $xy=h_xhkk_y\in HK$.
3° Let $x=hk$. Then $x^{-1}=k^{-1}h^{-1}\in KH$, but since $KH=HK$, $x^{-1}\in HK$.
So $HK$ is a subgroup.
A: "$\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.
A: HK is a group iff each hk has an inverse in HK iff  each k^-1 h^-1 is in HK  iff each kh is in HK (and similarly each hk is in KH) iff HK and KH are identical.  
