It's well known that $|g_1 g_2| = |g_1||g_2|$ whenever $g_1$ and $g_2$ are commuting elements of a group with $\gcd(|g_1|, |g_2|) = 1$. So, for example, $\gcd(|g_1|, |g_2|) = 1$ always implies that $|g_1 g_2| = |g_1||g_2|$ in an abelian group.
I am interested in classifying finite groups where the above condition holds for every pair of elements when we drop the hypothesis that they must commute. More precisely, my question is the following.
Question: Can we classify all finite groups $G$ in which $|g_1 g_2| = |g_1| |g_2|$ for every $g_1, g_2$ in $G$ with $\gcd(|g_1|, |g_2|) = 1$? If so, how?
Of course, by "classify" I mean up to isomorphism. I have managed to prove that every finite nilpotent group works by using the fact that every finite nilpotent group is a product of $p$-groups and by proving that the condition holds for all such products. I've included my proof of this at the end of the post.
I can't come up with any other examples of groups that work. Since nilpotent groups are "close to abelian," I wouldn't be surprised if these are the only ones. We could try to use the fact that a finite group is nilpotent if and only if two elements with coprime orders commute. This seems more plausible since this condition seems similar to the one here, but I don't really see how to do it.
Am I on the right track here? I imagine we might be able to proceed a bit more directly using Sylow's theorems, but I'm not sure how. If we can prove that every Sylow subgroup of $G$ is normal, then it will follow that $G$ is nilpotent. (To be honest, I really don't know how to proceed. Any feedback or nudges would be very appreciated.)
Here's my proof that finite products of finite $p$-groups work.
Let $G = G_1 \times \cdots \times G_n$, where each $G_i$ is a finite group of order $p_i^{n_i}$ for some prime $p_i$ and some positive integer $n_i$. Assume that the primes $p_1, \dots, p_n$ are distinct. Let's take two elements $g = (g_1, \dots, g_n)$ and $h = (h_1, \dots, h_n)$ of $G$ and assume that their orders are coprime. Each $g_i$ and $h_i$ is an element of a group of order $p_i^{n_i}$, so they have orders $p_i^{a_i}$ and $p_i^{b_i}$, respectively, for some non-negative integers $a_i,b_i$. The order of $g$ is
$$
|g| = \operatorname{lcm}(|g_1|, \dots, |g_n|) = \operatorname{lcm}(p_1^{a_1},\dots,p_n^{a_n}) = p_1^{a_1} \cdots p_n^{a_n},
$$
where the last equality uses the fact that the primes are distinct. It follows that $|g|$ and $|h|$ are coprime if and only if, for each $i$, one of $a_i$ or $b_i$ is zero. Let's reorder the indices so that $a_1 = \cdots = a_j = b_{j+1} = \cdots = b_n = 0$. Then $g_1, \dots, g_j, h_{j+1}, \dots, h_n$ are the identity elements of their respective groups, and it follows that
$$
gh = (h_1,\dots,h_j,g_{j+1},\dots,g_n).
$$
This implies that
$$
|gh| = \operatorname{lcm}(p_1^{b_1}, \dots, p_j^{b_j}, p_{j+1}^{a_{j+1}}, \dots, p_n^{a_n}) = p_1^{b_1} \cdots p_j^{b_j} \cdot p_{j+1}^{a_{j+1}} \cdots p_n^{a_n} = |g| |h|,
$$
and we are done.
Best Answer
As you have shown, your condition is satisfied whenever $G$ is nilpotent by the decomposition of nilpotent groups as the product of their Sylow $p$-subgroups. We will show that this is also a necessary condition. Let the prime factors of $|G|$ be equal to $p_1, \ldots,p_n$. For each $1 \leqslant i \leqslant n$, choose any Sylow $p_i$-subgroup $P_i$. We will prove the following lemma:
Proof of Lemma: Say $w_1w_2\cdots w_n = w_1'w_2'\cdots w_n'$. If $w_1 \neq w_1'$, then $w_2\cdots w_n = (w_1^{-1}w_1')w_2'\cdots w_n'$. This contradicts the order hypothesis since the left side must have order relatively prime to $p_1$ while the right side must have order divisible by $p_1$. Thus, $w_1 = w_1'$ and $w_2\cdots w_n = w_2'\cdots w_n'$. Repeat this procedure to prove that $w_i = w_i'$ for each $1 \leqslant i \leqslant n$. Thus, the map is injective. Surjectivity follows from the domain and codomain of the function having equal cardinality.
Proof of Claim: By the lemma, every element of $G$ can be uniquely written as $w_1\cdots w_n$. Furthermore, by the order hypothesis, the order of such an element is $\prod |w_i|$. It immediately follows that any element of order a power of $p_i$ must be in $P_i$, so each Sylow-$p_i$ subgroup is normal. We thus conclude that $G$ is nilpotent.