# Generating abstract group from direct product of two abstract groups

In group theory one can calculate some abstract groups through the direct product of two other abstract groups. An example for such a generation is the product $A_5\times Z_2$ with order 120, or $Z_4\times Z_2$ with order 8.

Since the abstract group representation in Mathematica is a permutation group one could have the idea to use the outer product with PermutationProduct on the group elements of two multiplied groups to generate the group product as

GroupOrder[
PermutationGroup[Flatten[Outer[PermutationProduct,
GroupElements[grpA],
GroupElements[grpB]
]]]
]


which yields the correct order (120) for grpA = AlternatingGroup[5] and grpB = CyclicGroup[2] but too high an order (24) for grpA = CyclicGroup[4] and grpB = CyclicGroup[2].

One gets the similar result when trying to generate the direct product through using the generators of the two multiplied groups as

GroupOrder[
PermutationGroup[
Join[
GroupGenerators[grpA],
GroupGenerators[grpB]
]
]
]


Any ideas how to solve this issue?

tl;dr: The cycles of group1 and group2 should not involve the same values. The simplest way to obtain a direct product is to use the function FiniteGroupData with the syntax

FiniteGroupData[ { "DirectProduct", { $group_1$, $group_2$, ...} }, "PermutationGroupRepresentation"]

From the examples

The issue can be found by noticing that $Z_2 \times Z_4$ can be represented as AbelianGroup[{2, 4}], and by comparing the group elements

GroupElements@AbelianGroup[{2, 4}]

(* {Cycles[{}], Cycles[{{3, 4, 5, 6}}], Cycles[{{3, 5}, {4, 6}}],
Cycles[{{3, 6, 5, 4}}], Cycles[{{1, 2}}], Cycles[{{1, 2}, {3, 4, 5, 6}}],
Cycles[{{1, 2}, {3, 5}, {4, 6}}], Cycles[{{1, 2}, {3, 6, 5, 4}}]} *)


to those obtained from the PermutationProduct of $Z_2$ and $Z_4$

Flatten@ Outer[PermutationProduct,
GroupElements[CyclicGroup[2]],
GroupElements[CyclicGroup[4]]]

(* {Cycles[{}], Cycles[{{1, 2, 3, 4}}], Cycles[{{1, 3}, {2, 4}}],
Cycles[{{1, 4, 3, 2}}], Cycles[{{1, 2}}], Cycles[{{1, 3, 4}}],
Cycles[{{1, 4, 2, 3}}], Cycles[{{2, 4, 3}}]} *)


To get the correct elements, we can replace GroupElements[CyclicGroup[4]] by GroupElements[CyclicGroup[4]] /. Thread[Range[4] -> Range[3, 6]],

cycles = Flatten@Outer[PermutationProduct,
GroupElements[CyclicGroup[2]],
GroupElements[CyclicGroup[4]] /. Thread[Range[4] -> Range[3, 6]]];

cycles === GroupElements[AbelianGroup[{2, 4}]]

(* True *)


which has the correct group order

GroupOrder[PermutationGroup[cycles]]

(* 8 *)


Generalization

For the direct product of two arbitrary groups, a possible approach could be (see alternative (b) below for a simplest way)

directProduct[group1_, group2_] := With[
{order1 = GroupOrder[group1], order2 = GroupOrder[group2]},

PermutationGroup[Flatten@Outer[PermutationProduct,
GroupElements[group1],
GroupElements[group2] /. Thread[Range[order2] -> (order1 + Range[order2])]]]
]


For $Z_2 \times Z_4$:

directProduct[CyclicGroup[2], CyclicGroup[4]]
% // GroupOrder

(* PermutationGroup[{Cycles[{}], Cycles[{{3, 4, 5, 6}}],
Cycles[{{3, 5}, {4, 6}}], Cycles[{{3, 6, 5, 4}}], Cycles[{{1, 2}}],
Cycles[{{1, 2}, {3, 4, 5, 6}}], Cycles[{{1, 2}, {3, 5}, {4, 6}}],
Cycles[{{1, 2}, {3, 6, 5, 4}}]}] *)

(* 8 *)


Alternatives

(a) A similar workaround can be applied from the GroupGenerators

directProduct2[group1_, group2_] := PermutationGroup[Join[
GroupGenerators[group1],
GroupGenerators[group2] /. Cycles[l_] :> Cycles[l + PermutationMax[group1]]
]]


For $Z_2 \times Z_4$:

directProduct2[CyclicGroup[2], CyclicGroup[4]]
% // GroupOrder

(* PermutationGroup[{Cycles[{{1, 2}}], Cycles[{{3, 4, 5, 6}}]}] *)
(* 8 *)


In both approaches, one should make sure that the cycles of group1 and those of group2 do not involve the same values.

(b) A simpler way to go, equivalent to alternative (a) above in terms of the cycles generated, is to use the function FiniteGroupData

FiniteGroupData[{"DirectProduct",
{{"CyclicGroup", 2}, {"CyclicGroup", 4}}
}, "PermutationGroupRepresentation"]

(* PermutationGroup[{Cycles[{{1, 2}}], Cycles[{{3, 4, 5, 6}}]}] *)

FiniteGroupData[{"DirectProduct",
{{"AlternatingGroup", 5}, {"CyclicGroup", 2}}
}, "PermutationGroupRepresentation"]

(* PermutationGroup[{Cycles[{{6, 7}}], Cycles[{{1, 2, 3}}], Cycles[{{1, 2, 3, 4, 5}}]}] *)

• I was not aware of the DirectProduct Property in Finite GroupData. It seems that this is covering even very high order of abstract groups. If I try it with AlternatingGroup of degree 10 and CyclicGroup of degree 2 I get the correct order of 3628800. I'll try out if I find any combination of abstract groups which is not covered with this, but it seems that FiniteGroupData does the trick, thanks! Mar 13, 2016 at 9:16
• one additional item @Xavier. Where did you find the FiniteGroupData command syntax on the DirectProduct? I checked with the MMA documentation and did not find it there.... Mar 13, 2016 at 9:36
• @Rainer You can find it in the "Details" section of FiniteGroupData, second Table. Three special group specifications are shown: "AbelianGroup", "DirectProduct" and "SemidirectProduct".
– user31159
Mar 13, 2016 at 13:27