# Defining an Arbitrary Group

I learned today, while doing my homework, that Mathematica can understand group theory. Combing through the documentation though just gave the examples of permutation groups. I would like to know how to define an arbitrary group, some set and a binary operation on that set. Ideally, this would allow the use of the other built-in functions such as those for finding the order of a group or element, etc.

• Define the multiplication table. Feb 13, 2018 at 5:52
• It is the Cayley's theorem that every finite group can be represented as a group of permutations. Feb 13, 2018 at 8:30
• @BrandonMyers In group theory, Cayley's theorem, named in honour of Arthur Cayley, states that every group G is isomorphic to a subgroup of the symmetric group acting on G. All groups are included. Note though that it also says: Nevertheless, Alperin and Bell note that "in general the fact that finite groups are imbedded in symmetric groups has not influenced the methods used to study finite groups" Note, too, while representing a group is trivial, doing things with it isn't. If you have a specific target it will be easier to help. Feb 14, 2018 at 7:54
• Your question about infinite groups goes beyond the scope of this site. MA has no build-in capabilities to deal with them. However, it is possible to study infinite group families, e.g. cyclic groups and their direct products. Concerning your original question about defining the multiplication table for a set of elements---the binary operation. It is pretty inefficient way to define the group. Rather, one should consider a set of generators and relations among them: mathematica.stackexchange.com/questions/96111/… Feb 14, 2018 at 9:09
• Create a matrix the describes the multiplication table for the group. Feb 14, 2018 at 16:58

We assume you've already read about Cayley's theorem which others also mentioned in their comments. Let's pick up a group, for example Klein 4-group, $$K_4$$, and to be consistent with each other let's pick up the table of multiplication that is represented in its wikipedia page (https://en.wikipedia.org/wiki/Klein_four-group). I also prefer to replace the wikipedia's notation in this way "e->1, a->2, b->3, c->4". So I'm calling elements of my group by 1, 2, 3 and 4 which 1 is the identity element. Anyway, I inject my group to $$S_4$$ by sending each element of $$K_4$$ like $$g$$ to the permutation of $$K_4$$ under multiplication by $$g$$. So for example the new representation of 2 will be $$\begin{pmatrix}1 & 2 & 3 & 4\\ 2 & 1 & 4 & 3\end{pmatrix}$$. Since the first row of the representation of permutations is always the same $$\begin{pmatrix}1 & 2 & 3 & 4\end{pmatrix}$$, let's save space and only show a permutation by its second row and keeping in mind that we are not confusing it by the cyclic permutations! This way, each element of the group in fact is represented by its row in the multiplication table of the group. Now you can ask Mathematica to consider the subgroup of the symmetric group (remember this injection/map is an isomorphism and that's why its image is a subgroup of the target group). To do this use the command PermutationGroup[] and give the list of lists which the inner lists are rows of the multiplication table. Now you can apply the Mathematica commands of group theory on this object. For example in below you see the two commands you already mentioned yourself; GroupOrder and GroupElements.

group=PermutationGroup[{{1,2,3,4},{2,1,4,3},{3,4,1,2},{4,3,2,1}}]
GroupOrder[group]
GroupElements[group]


In the following image you can see the result of these lines when you run them in Mathematica. However be careful. Not every Mathematica's command will be happy of this object. For example if you apply CayleyGraph command on this group object, you will get the following problem. How to solve it? Redefine your group-object by giving the Cycles representation of your group-elements. You don't need to find the Cycles representation (decomposition of the permutation representation of your elements into product of disjoint cycles) yourself, just use the GroupElements command on group and put it inside the PermutationGroup again, haha sounds a kind of funny, but anyway then CayleyGraph will work fine and the result for this group is the following beautiful image. One more thing to be careful about is that you can ask Mathematica to compare two groups, for example you ask Mathematica to check if your group is equal to the cyclic group of order 4, which is not and Mathematica happily gives you False as the output. You should be careful that it is not checking isomorphism, it is only about equality with the representation of elements that Mathematica has chosen. $$K_4$$ for sure is not isomorphic with $$C_4$$, however it is isomorphic with $$C_2\times C_2$$, which in Mathematica can be defined by AbelianGroup[{2,2}]. If you ask Mathematica about "$$K_4=C_2\times C_2$$?", you will see False. You can ask Mathematica to show you representation of elements of $$C_2\times C_2$$ that he has chosen, then you get why he said False :) 