I was trying to solve this question:
Let $G$ be a group and $A,B$ subgroups of $G.$ Define $AB$ as the set of all products $ab,$ where $a \in A$ and $b \in B.$ Prove that $AB$ is a subgroup of $G$ iff $BA \subseteq AB.$
Assume that $G$ is a group and $A,B$ subgroups of $G.$
$\Rightarrow$
Assume that $AB$ is a subgroup of $G,$ we want to show that $BA \subseteq AB.$ Let $x \in BA,$ then $x = ba $ where $b \in B$ and $a \in A.$ But then, $x = ba = ((ba)^{-1})^{-1} = (a^{-1} b^{-1})^{-1}$ which is in $AB$ as $a^{-1} b^{-1} \in AB$ as each of $A$ and $B$ are subgroups and because $AB$ is a subgroup by hypothesis then the inverse of each element in it is contained in it $i.e., (a^{-1} b^{-1} )^{-1} \in AB.$
$\Leftarrow$
Assume that $BA \subseteq AB.$ We want to show that $AB$ is a subgroup of $G.$ First assume that $x,y \in AB,$ we want to show that:
1- $\forall x \in AB, x^{-1} \in AB.$
2- $e_G \in AB.$
3- $\forall x,y \in AB, xy \in AB.$
I was able to prove the first one as follows:
Let $x \in AB,$ then $x = ab$ for some $a \in A$ and $b \in B.$ But then $x^{-1} = (ab)^{-1} = b^{-1}a^{-1} \in BA$ as each of $A,B$ is a subgroup of $G.$ But $BA \subseteq AB$ by assumption, then $x^{-1} \in AB$ as required.
But then I do not know how to show $2$ and $3.$ any help will be greatly appreciated!