## Section 9.5 Sage

Sage has limited support for actually creating isomorphisms, though it is possible. However, there is excellent support for determining if two permutation groups are isomorphic. This will allow us to begin a little project to locate *all* of the groups of order less than \(16\) in Sage's permutation groups.

### Subsection Isomorphism Testing

If `G`

and `H`

are two permutation groups, then the command `G.is_isomorphic(H)`

will return `True`

or `False`

as the two groups are, or are not, isomorphic. Since “isomorpic to” is an equivalence relation by Theorem 9.10, it does not matter which group plays the role of `G`

and which plays the role of `H`

.

So we have a few more examples to work with, let us introduce the Sage command that creates an external direct product. If `G`

and `H`

are two permutation groups, then the command `direct_product_permgroups([G,H])`

will return the external direct product as a new permutation group. Notice that this is a function (not a method) and the input is a list. Rather than just combining two groups in the list, any number of groups can be supplied. We illustrate isomorphism testing and direct products in the context of Theorem 9.21, which is an equivalence, so tells us *exactly* when we have isomorphic groups. We use cyclic permutation groups as stand-ins for \({\mathbb Z}_n\) by Theorem 9.8.

First, two isomorphic groups.

Now, two non-isomorphic groups.

Notice how the simple computation of a greatest common divisor predicts the incredibly complicated computation of determining if two groups are isomorphic. This is a nice illustration of the power of mathematics, replacing a difficult problem (group isomorphism) by a simple one (factoring and divisibility of integers). Let us build one more direct product of cyclic groups, but with three groups, each with orders that are pairwise relatively prime.

If you try the following with larger parameters you may get an error (`database_gap`

).

### Subsection Classifying Finite Groups

Once we understand isomorphic groups as being the “same”, or “fundamentally no different,” or “structurally identical,” then it is natural to ask how many “really different” finite groups there are. Corollary 9.9 gives a partial answer: for each prime there is just one finite group, with \({\mathbb Z}_p\) as a concrete manifestation.

Let us embark on a quest to find all the groups of order less than \(16\) in Sage as permutation groups. For prime orders \(1,2,3,5,7,11\) and \(13\) we know there is really just one group each, and we can realize them all:

So now our smallest unknown case is order \(4\text{.}\) Sage knows at least three such groups, and we can use Sage to check if any pair is isomorphic. Notice that since “isomorphic to” is an equivalence relation, and hence a transitive relation, the two tests below are sufficient.

So we have at least two different groups: \({\mathbb Z}_4\) and \({\mathbb Z}_2\times{\mathbb Z}_2\text{,}\) with the latter also known as the Klein 4-group. Sage will not be able to tell us if we have a *complete* list — this will always require theoretical results like Theorem 9.10. We will shortly have a more general result that handles the case of order \(4\text{,}\) but right now, a careful analysis (by hand) of the possibilities for the Cayley table of a group of order \(4\) should lead you to the two possibilities above as the only possibilities. Try to deduce what the Cayley table of an order \(4\) group should look like, since you know about identity elements, inverses and cancellation.

We have seen at least two groups of order \(6\) (next on our list of non-prime orders). One is abelian and one is not, so we do not need Sage to tell us they are structurally different. But let us do it anyway.

Is that all? There is \({\mathbb Z}_3\times{\mathbb Z}_2\text{,}\) but that is just \({\mathbb Z}_6\) since \(2\) and \(3\) are relatively prime. The dihedral group, \(D_3\text{,}\) all symmetries of a triangle, is just \(S_3\text{,}\) the symmetric group on \(3\) symbols.

Exercise 9.4.55 from this section classifies all groups of order \(2p\text{,}\) where \(p\) is a prime. Such a group is either cyclic or a dihedral group. So the two groups above, \({\mathbb Z}_6\) and \(D_3\text{,}\) are the complete list of groups of order \(6\text{.}\)

By this general result, in addition to order \(6\text{,}\) we also know the complete lists of groups of orders \(10\) and \(14\text{.}\) To Be Continued.

### Subsection Internal Direct Products

An internal direct product is a statement about subgroups of a single group, together with a theorem that links them to an external direct product. We will work an example here that will illustrate the nature of an internal direct product.

Given an integer \(n\text{,}\) the set of positive integers less than \(n\text{,}\) and relatively prime to \(n\) forms a group under multiplication mod \(n\text{.}\) We will work in the set `Integers(n)`

where we can add *and* multiply, but we want to stay strictly with multiplication only.

First we build the subgroup itself. Notice how we must convert `x`

into an integer (an element of `ZZ`

) so that the greatest common divisor computation performs correctly.

So we have a group of order \(12\text{.}\) We are going to try to find a subgroup of order \(6\) and a subgroup of order \(2\) to form the internal direct product, and we will restrict our search initially to cyclic subgroups of order \(6\text{.}\) Sage has a method that will give the order of each of these elements, relative to multiplication, so let us examine those next.

We have many choices for generators of a cyclic subgroup of order \(6\) and for a cyclic subgroup of order \(2\text{.}\) Of course, some of the choices for a generator of the subgroup of order \(6\) will generate the same subgroup. Can you tell, just by counting, how many subgroups of order \(6\) there are? We are going to pick the first element of order \(6\text{,}\) and the last element of order \(2\text{,}\) for no particular reason. After your work through this once, we encourage you to try other choices to understand why some choices lead to an internal direct product and some do not. Notice that we choose the elements from the list `U`

so that they are sure to be elements of `Z36`

and behave properly when multiplied.

So `A`

and `B`

are two cyclic subgroups. Notice that their intersection is the identity element, one of our requirements for an internal direct product. So this is a good start.

`Z36`

is an abelian group, thus the condition on all products commuting will hold, but we illustrate the Sage commands that will check this in a non-abelian situation.

Finally, we need to check that by forming products with elements from `A`

and `B`

we create the entire group. Sorting the resulting list will make a check easier for us visually, and is required if we want Sage to do the check.

That's it. We now condense all this information into the statement that “`U`

is the internal direct product of `A`

and `B`

.” By Theorem 9.27, we see that `U`

is isomorphic to a product of a cyclic group of order \(6\) and a cyclic group of order \(2\text{.}\) So in a very real sense, `U`

is no more or less complicated than \({\mathbb Z}_6\times{\mathbb Z}_2\text{,}\) which is in turn isomorphic to \({\mathbb Z}_3\times{\mathbb Z}_2\times{\mathbb Z}_2\text{.}\) So we totally understand the “structure” of `U`

. For example, we can see that `U`

is not cyclic, since when written as a product of cyclic groups, the two orders are not relatively prime. The final expression of `U`

suggests you could find three cyclic subgroups of `U`

, with orders \(3\text{,}\) \(2\) and \(2\text{,}\) so that `U`

is an internal direct product of the three subgroups.