What does it mean when two groups commute? This is probably an easy question, but I can't find the definition in my book.
Let $G$ be a group, and let $H$ and $N$ be subgroups. What does it mean for $H$ and $N$ to commute?
I have two possibilities that come to mind:

*

*$(\forall h \in H)(\forall n \in N)[hn=nh]$


*$HN=NH$, that is, if we have $hn$, then there exists $h_2,n_2$ such that $hn=n_2h_2$
.
What is the correct definition?
I have this problem because of this exercise:

Let $A$ and $B$ be subgroups of $G$.
a) Show that if either $A$ or $B$ is normal, then $AB=\{ab \mid a\in A, b \in B\}$ is a subgroup. Show by an example that the assumption $A$ or $B$ be normal can not be dropped.
Show that if $A$ and $B$ commute, then $N =\{(x,x^{-1}) \mid x \in A \cap B\}$ is a normal subgroup of the direct product $A \times B$ and that AB is isomorphic to $A\times B /N$.

 A: Hint:
By definition $$HK := \{hk ; h \in H \, \, \text{and}\,\, k \in K\}$$
Naturally, if $y \in KH$ and $KH = HK$ then it means that on one hand $y = hk$, for some $h \in H$ and $k \in K$ and can be written as $y = k'h'$, for some $k'\in K$ and $h' \in H$ not necessarily implying that $h' = h$ and $k' = k$.
Consider the following result.
Proposition 1: Let $H,K$ be subgroups of $G$. Then $$HK \leq G \iff HK = KH \tag {*}$$
And (*) is meant by commute.
Proof:
$(\implies)$ Let $a \in KH$. There exists $h \in H$ and $k \in K$ such that $a = kh$. We have that $a^{-1} = (kh)^{-1} = h^{-1}k^{-1} \in HK$. As $HK \leq G$ then $a \in HK$ then $KH \subseteq HK$. Conversely, take $c \in HK$. We know that $HK$ is subgroup then $c^{-1} \in HK$ thus $c^{-1} = h_2 k_2$, where $h_2 \in H$ and $k_2 \in K$, taking the inverses we have $c = k_2^{-1}h^{-1}_2 \in KH$. Thus $HK= KH$.
Do you think you can take the other direction?
(a) Let $H,K$ be subgroups of $G$. If $H$ or $K$ is normal in $G$ then $HK$ is a subgroup of $G$.
Proof: (idea)
Say $H \triangleleft G$ and $K$ is any subgroup of $G$. Show that $HK= KH$ and use Proposition 1. Again a case of two inclusions to be shown.
As to the example, take $\langle ab \rangle , \langle b\rangle \leq S_3$ and notice that $\langle ab \rangle  \langle b\rangle = \{id, a, b, ab\}$ has order $4$.
