# How to create a group action table with Mathematica?

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.

Question:

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.

• 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? Commented Jan 27, 2012 at 13:51
• @ziyuang - Permuting what ? Commented Jan 27, 2012 at 14:34
• @Szabolcs - I am doing two group action tables in Excel and learning about group actions in GAP. Will post image when done. Probably tomorrow. Commented Jan 27, 2012 at 14:36
• @Szabolcs - Click. I got it about the LaTeX tables now. Commented Jan 27, 2012 at 14:37

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:

Unprotect[NonCommutativeMultiply];

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

Then

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

• I can make another answer - tomorrow - using the Group theory functions in MMA v.8 if you are interested. Commented Jan 27, 2012 at 18:43
• Do you know why is a seemingly inert (and unused by the system) symbol like NonCommutativeMultiply protected? Commented Jan 27, 2012 at 20:12
• One might sometimes prefer Outer[] to Table[] for generating the Cayley table of a binary operation... Commented Jan 28, 2012 at 0:08
• 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. Commented Jan 30, 2012 at 11:35
• 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. Commented 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}]
TableView[
Outer[Sort[#1 #2 //. rules] &, bigG, bigS, 1, 1],

• 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. Commented Jan 27, 2012 at 18:30
• Instead of the undocumented (and here practically unnecessary) TableView, you can consider MatrixForm[ ... , TableDepth -> 2]. Commented Jan 27, 2012 at 22:49
• @b.gatessucks $ab=ba^3$ means non-commutative. Commented Feb 18, 2012 at 21:54