When is the product of $n$ subgroups a subgroup?

It seems your desired theorem would look like this: If $A, B, C$ are subgroups of $G$, then $A B C$ is a subgroup iff $\Phi_1(A,B)\land\Phi_2(B,C)\land\Phi_3(C,A)$ (where the $\Phi_i$ is some predicate in two variables).

Let's have a look at $\Phi_1$ first. Clearly, "$\Phi_1(A,B):\iff AB\mathrm{\ is\ a\ group}$" would be too strong. Hence $\Phi_1(A,B)$ may be true in cases wheer $AB$ is not a group. But how can $A B$ fail to be a group? Either there is $x\in A B$ with $x^{-1}\notin AB$ or there are $x,y\in AB$ with $xy\notin AB$. For $ABC$ to be a group there must exist a $z\in AB$ such that $x^{-1}=z c$ or $x y = z c$ for some $c\in C$, respectively. All composites in $ABAB$, all inverses are in $BA\subseteq ABAB$, hence we need $ABAB\subseteq ABC$. Unless $ABAB\subseteq AB$ (i.e unless $AB$ is a group), this condition clearly depends on $C$.

Therefore such $\Phi_1$ cannot exist.

The same argument applies to $\Phi_2$ and with slight modifications for $\Phi_3$. One could also argue simply that for subgroups $X, Y$ such that $XY$ is not a group, we have that $XYG$, $XGY$ and $GXY$ are groups, hence all $\Phi_i(X,Y)$ must be true. But $XY1$, $X1Y$ and $1XY$ are not groups, hence some $\Phi_i$ with one argument $=1$ must be false. But that can't be because a product where two factors are the trivial group is a group.


One issue you might have is if one of the subgroups is a normal subgroup, then they commute with the others automatically. You probably need a condition that you have at least one condition involving each pair of subgroups. I am not sure if that is actually enough. If you also include something like that you also have conditions that does not include 1,2,3,etc. subgroups, then you can get the desired answer by induction.

Finally, here is a relatively general example to show that in case of $n=3$ you need all three commutations:

Let $N\subset G$ be a normal subgroup and $H\subset G$ a subgroup such that $N\cap H=1$. Now let $A,B\subset H$ be subgroups such that $A\cap B=1$ and $AB\neq BA$, but $H$ is generated by $A$ and $B$ together. Finally assume that $A,B$ and $N$ are finite.

Since $N$ is normal, $NA=AN$ and $NB=BN$. Since they are all finite and pairwise disjoint, $$|NAB|=|N|\cdot |A| \cdot |B|,$$ but since $AB\neq BA$ it is not a subgroup, and hence, $$|A| \cdot |B|\lneq |H|,$$ so $$|NAB| \lneq |N|\cdot |H| = |NH|.$$ However, since $A$ and $B$ generate $H$ it follows that the subgroup generated by $A,B$ and $N$ is $NH$, which has more elements than $NAB$ does and hence $NAB$ cannot be a subgroup.