Product of all elements in finite nonabelian group

Let $G$ be a finite group. By indexing $G = \{g_1,\ldots,g_n\}$ arbitrarily, we can make sense of the product $$\prod_{i = 1}^n g_i.$$ If $G$ is abelian, the result is clearly the product of all elements of order 2, which is $1$ unless there is a unique element of order 2. If $G$ is not abelian, the ordering of the group (or, the product) matters, and there are at least two possible outcomes (just exchange two adjacent non-commuting elements). Can something be said in general about which outcomes are possible?

• Out of curiosity, must there always be two adjacent, non-commuting elements? – Arthur Sep 7 '16 at 20:32
• @Arthur, if the group is non-abelian, then there is an ordering of the elements in which there are always two adjacent, non-commuting elements. Taking that ordering and the one with the elements exchanged gives two different ones. – Mees de Vries Sep 7 '16 at 20:33
• There are no more than $n$ outcomes, but there are $n!$ possible arrangements. Quite interesting. – ajotatxe Sep 7 '16 at 20:35
• Ahh, yes, of course. I was rather thinking about a different question: can you find an ordering so that any two adjacent elements commute? It's possible for some groups (take $S_3\times \Bbb Z_n$ for some large $n$), but is it always possible? – Arthur Sep 7 '16 at 20:38
• The related question Product of all elements in finite group has an answer (by Nicky Heckster) for this one, too. – ypercubeᵀᴹ Sep 7 '16 at 20:59

In addition to all the answers, there is also a very neat answer to the general question What is the set of all different products of all the elements of a finite group $G$? So $G$ not necessarily abelian.

Well, if a $2$-Sylow subgroup of $G$ is trivial or non-cyclic, then this set equals the commutator subgroup $G'$.

If a $2$-Sylow subgroup of $G$ is cyclic, then this set is the coset $xG'$ of the commutator subgroup, with $x$ the unique involution of a $2$-Sylow subgroup.

See also J. Dénes and P. Hermann, `On the product of all elements in a finite group', Ann. Discrete Math. 15 (1982) 105-109. The theorem connects to the theory of Latin Squares and so-called complete maps.