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!
2) $e_G\in A$ and $e_G\in B$. So $e_G=e_Ge_G\in AB$.
3) If $x,y\in AB$, then $x=a_xb_x$ and $y=a_yb_y$ for some $a_x,a_y\in A$ and $b_x,b_y\in B$; so $xy=a_xb_xa_yb_y$. But $b_xa_y\in BA\subset AB$, so $b_xa_y=ab$ for some $a\in A$, $b\in B$. Then $xy=a_xabb_y\in AB$.
Note: There is a shorter way, generally speaking, to show that a subset $M\subset G$ is a subgroup of a group $G$. It suffices to show that $M\neq\emptyset$ and $xy^{-1}\in M$ for every $x,y\in M$.