The definition of the complementary of a subgroup is symmetrical Let $G$ be a group and $H,K$ be its subgroups. Neither of them has to be normal.
If
$$G = HK = \{ hk : h\in H, k\in K\} \text{ and } H\cap K = \{e\},$$
then we say $K$ is complementary to $H$. Wikipedia says this definition is symmetrical, namely we can also write $G=KH$.
I understand that $HK=G=KH$ when one of them is normal. But why is it true in general here?
 A: It follows from the following standard exercise:
Theorem. Let $G$ be a group, and let $H$ and $K$ be subgroups. Then $HK=\{hk\mid h\in H, k\in K\}$ is a subgroup of $G$ if and only if $HK=KH$ as sets.
Proof. If $HK$ is a subgroup, then since $H,K\subseteq HK$, if $k\in K$ and $h\in H$, then $kh\in HK$; hence $KH\subseteq HK$. And if $hk\in HK$, then $(hk)^{-1}=k^{-1}h^{-1}\in HK$, so there exist $h’\in H$ and $k’\in K$ such that $k^{-1}h^{-1}=h’k’$. Taking inverses on both sides we get $hk = (k’)^{-1}(h’)^{-1}\in KH$, so $HK\subseteq KH$, giving equality.
Conversely, if $HK=KH$ as sets, since $HK$ is clearly nonempty it is enough to show that if $hk,h’k’\in HK$, then $(hk)(h’k’)^{-1}\in HK$. Now, $\Bigl(k{k’}^{-1}\Bigr)h’^{-1}\in KH=HK$, so there exist $h’’\in H$, $k’’\in K$ such that $k(k’)^{-1}(h’)^{-1} = h’’k’’$. Then
$$(hk)(h’k’)^{-1} =hk(k’)^{-1}(h’)^{-1} = hh’’k’’ = (hh’’)k’’\in HK,$$
proving that $HK$ is a subgroup. $\Box$
Note that normality is not required. If either $H$ or $K$ are normal (or more generally, if $H\subseteq N_G(K)$ or $K\subseteq N_G(H)$), then we will get $HK=KH$, and therefore that $HK$ is a subgroup. But you can have $HK=KH$ without either subgroup normalizing the other.
Example where $HK=KH$ but neither subgroup normalizes the other. In $G=S_4$, take $H=\langle (1234)\rangle$ and $K$ the subgroup of all permutations that fix $4$. It is clear that $H$ does not normalize $K$, while $K$ does not normalize $H$ since for example $(12)(1234)(12)=(2134)\notin H$. However, $|HK|=|H||K|/|H\cap K| = (4)(6)=24=|S_4|$, so $HK=S_4=KH$. More generally, if $G=S_n$, $n\geq 4$, $H=\langle(12\cdots n)\rangle$, and $K$ is the subgroup of permutations that fix $n$ (so $K\cong S_{n-1}$), then $|HK|=n!$, so $HK=S_n$, but neither normalizes the other (since we are requiring $n\geq 4$).
A: Given any subgroups $H$ and $K$ of a group $G,$ we have that $HK$ is a subgroup of $G$ if and only if $HK = KH.$ Considering that $G = HK$ is a group (and hence a subgroup), it follows that $HK = KH.$
We will establish that if $HK$ is a subgroup of $G,$ then $HK = KH$ (as we do not need the converse immediately). Given any element $hk \in HK,$ we have that $h^{-1} k^{-1}$ is in $HK$ (because $H$ and $K$ are both subgroups of $G$). Considering that $hkh^{-1} k^{-1}$ is in $HK$ by hypothesis that $HK$ is a subgroup of $G,$ we find that $hkh^{-1} k^{-1} = h_1 k_1$ so that $h_1^{-1} hk = k_1 kh.$ We claim that the map $\ell_{h_1^{-1}} : H \to H$ defined by $\ell_{h_1^{-1}}(h) = h_1^{-1} h$ is surjective, from which it follows that $HK \subseteq KH.$ Conversely, given any element $kh \in KH,$ we have that $h = h e_G \in HK$ and $k = e_G k \in HK$ so that $kh = (e_G k)(h e_G) \in HK$ by assumption that $HK$ is a subgroup of $G.$ We conclude that $HK = KH.$
