Background: I want to explain the Sylow Theorems as detailed as possible, therefore I am rewriting the proof using concrete examples.

Since the answers to my questions ( about Mathematica ) have often, if not always, exceeded my expectations, and I lack the tools to adequately show a table, I start with a compact description of my question. I can elaborate if required, of course.


Is it possible to create a group action table with Mathematica?

For example:

Let $G = \left\{ 1,a,a^2, b, ba, ba^2 \right \}$, where $a^3=b^2=1, ab=ba^2 (D3) $ .

Let $S$ be the set of subsets of size $3$ of $G$: $\left\{ \left\{ 1,a,a^2 \right \}, \left\{1,a,b \right \}, ..., \left\{b,ba,ba^2 \right \} \right \} $ .

Define the map $f: G \times S \rightarrow S \ $ by $(g,s) \mapsto gs$.

The group action table, illustrating the map $f$ would be of size 20 X 6 with each cell containing an element of $S$.

I have ( experience with ) the Mathematica AbstractAlgebra package. I'll accept answers in GAP also.

  • $\begingroup$ Tables work fine in MathJax, but you need to end a line with \\ (double backslash), as I showed you in the answer to your meta question I have removed the MathJax experimentation from your post, as it was not connected to the question. Can you post the table you meant to post? $\endgroup$
    – Szabolcs
    Jan 27, 2012 at 13:51
  • $\begingroup$ @ziyuang - Permuting what ? $\endgroup$ Jan 27, 2012 at 14:34
  • $\begingroup$ @Szabolcs - I am doing two group action tables in Excel and learning about group actions in GAP. Will post image when done. Probably tomorrow. $\endgroup$ Jan 27, 2012 at 14:36
  • $\begingroup$ @Szabolcs - Click. I got it about the LaTeX tables now. $\endgroup$ Jan 27, 2012 at 14:37

2 Answers 2


MMA v.8 provides support for (finite) Group Theory, however this answer will not make use of that functionality.

We shall use the ** (NonCommutativeMultiply) command present in MMA, which allows us to create semigroups quite easily.

In a fresh MMA session:


GroupAction[g_, s_] := (g ** #) & /@ s

1 is the identity:

g_ ** 1 := g

1 ** g_ := g

Elements relations

a ** a ** a := 1

b ** b := 1

b ** a ** a := a ** b


G = {1, a, a ** a, b, b ** a, b ** a ** a}

S = Subsets[G, {3}]

Check some products:

a ** 1 ** b ** q

a ** 1 ** b ** b ** q

a ** 1 ** b ** a ** a ** b ** q

p ** a ** a ** a ** q

(p and q are generic group elemants) as you see MMA uses the associative (Flat) property of NonCommutativeMultiply to parse and simplify the expressions in all possible ways. Now this is your table:

Table[GroupAction[g, s], {s, S}, {g, G}] // MatrixForm

Nicely formatted:

Grid[Prepend[Table[GroupAction[g, s], {s, S}, {g, G}], G], Background -> {None, {Lighter[Blue, .9], {White, Lighter[Blend[{Blue, Green}], .8]}}}]

If you are serious about Group Theory, you might want to check the functionalities offered by MMA v.8

  • 1
    $\begingroup$ I can make another answer - tomorrow - using the Group theory functions in MMA v.8 if you are interested. $\endgroup$
    – magma
    Jan 27, 2012 at 18:43
  • $\begingroup$ Do you know why is a seemingly inert (and unused by the system) symbol like NonCommutativeMultiply protected? $\endgroup$
    – Szabolcs
    Jan 27, 2012 at 20:12
  • $\begingroup$ One might sometimes prefer Outer[] to Table[] for generating the Cayley table of a binary operation... $\endgroup$ Jan 28, 2012 at 0:08
  • $\begingroup$ I know that GAP is the tool for Group Theory, but GAP has quite a learning curve. Although not a cross-poster I asked in the Mathematica section. See: math.stackexchange.com/questions/103220/… This basically works for any group and subset size. - I have invested a lot in learning Mathematica but it can handle very limited functionality in Group Theory. Developing a parser to and from GAP from Mathematica is on my list. They did it for SAGE, it can be done. $\endgroup$ Jan 30, 2012 at 11:35
  • 1
    $\begingroup$ I do not understand -completely- your comment. Anyway: I copied G from your question. MMA will immediately transform it into G = {1, a, a ** a, b, b ** a,a ** b} (using my code), so you may as well start from this directly. The alternative rule a ** b := b ** a ** a is not good since you would replace a short string (a**b) with a longer one. $\endgroup$
    – magma
    Jan 31, 2012 at 13:08

Not very elegant and it requires additional work on the rules :

elem = {1, a, b}
rules = {a^3 -> 1, a^4 -> a, b^2 -> 1, b^3 -> b, b a^2 -> a b, b^4 -> 1}
bigG = Union[Times @@ # & /@ Tuples[elem, {2}]]
bigS = Subsets[bigG, {3}]
   Outer[Sort[#1 #2 //. rules] &, bigG, bigS, 1, 1], 
   TableHeadings -> {bigG, bigS} 

Mathematica graphics

  • $\begingroup$ This does not work correctly, since the multiplication in D3 is not commutative, while Times is commutative. You would get wrong results using this table. $\endgroup$
    – magma
    Jan 27, 2012 at 18:30
  • $\begingroup$ @magma Thanks for the clarification. I am not familiar with this group and it was not specified in the question that the multiplication is non-commutative. $\endgroup$ Jan 27, 2012 at 19:43
  • 1
    $\begingroup$ Instead of the undocumented (and here practically unnecessary) TableView, you can consider MatrixForm[ ... , TableDepth -> 2]. $\endgroup$
    – Szabolcs
    Jan 27, 2012 at 22:49
  • $\begingroup$ @b.gatessucks $ab=ba^3$ means non-commutative. $\endgroup$ Feb 18, 2012 at 21:54
  • $\begingroup$ @ndroock1 Thanks for the clarification. $\endgroup$ Feb 18, 2012 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.