The example we looked at last time was the symmetry group of the square. We found that this group could be generated by two elements a, b, satisfying the relations:

a^4 = 1

b^2 = 1

a^3 b = b a

This way of thinking about the group is called a group presentation, and the usual notation would be:

<a,b | a^4=1, b^2=1, a^3 b = b a>

In our Haskell code, we represent this as:

`( ['a','b'], [("aaaa",""),("bb",""),("aaab","ba")] )`

We saw how to use the Knuth-Bendix algorithm to turn the relations into a confluent rewrite system:

`> :load Math.Algebra.Group.StringRewriting`

> mapM_ print $ knuthBendix [("aaaa",""),("bb",""),("aaab","ba")]

("bb","")

("bab","aaa")

("baa","aab")

("aba","b")

("aaab","ba")

("aaaa","")

The rewrite system itself isn't particularly informative. Its importance lies in what it enables us to do. Given any word in the generators, we reduce it as follows: wherever we can find the left hand side of one of rules as a subword, we replace it by the right hand side of the rule. If we keep doing this until there are no more matches, then we end up with a normal form for the element - that is, another word in the generators, which represents the same group element, and is the smallest such word relative to the shortlex ordering. Several things follow from this.

First, the ability to find the shortest word is sometimes useful in itself. If we could do this for the Rubik cube group (taking the six face rotations as generators), then we would be able to code "God's algorithm" to find the shortest solution to any given cube position.

Second, any two words that represent the same group element will reduce to the same normal form. Hence, given any two words in the generators, we can tell whether they represent the same element. This is called "solving the word problem" for the group.

Third, this enables us to list (the normal forms of) all the elements of the group - and hence, among other things, to count them.

Fourth, it enables us to do arithmetic in the group:

- To multiply two elements, represented as words w1, w2, just concatenate them to w1++w2, then reduce using the rewrite system

- The identity element of the group is of course the empty word ""

- But what about inverses?

Strings (lists) under concatenation form a monoid, not a group. So what do we do about inverses?

Well, one possibility is to include them as additional symbols. So, suppose that our generators are a,b. Then we should introduce additional symbols a

^{-1}, b

^{-1}, and consider words over the four symbols {a,b,a

^{-1},b

^{-1}}. (For brevity, it is customary to use the symbols A, B for a

^{-1}, b

^{-1}.)

If we take this approach, then we will need to add some new rules too. We will need the rules a a

^{-1}= 1, etc. We will probably also need the "inverses" of the relations in our presentation. For example, if we have a^4 = 1, then we should also have a rule (a

^{-1})^4 = 1.

It's going to be a bit of a pain. (And it's probably going to cause Knuth-Bendix to get indigestion, in some cases at least.) Luckily, for finite groups, we don't really need this. In a finite group, each generator must have finite order: in our example a^4 = 1, b^2 = 1. So the inverse of each generator is itself a power of that generator - a

^{-1}= a^3, b

^{-1}= b. So for a finite group - or in fact any group where the generators are all of finite order - then the inverses are already there, expressible as words in the generators.

So for most purposes, we have no need to introduce the inverses as new symbols. For example, if we want to list the elements of a finite group, or tell whether two words in the generators represent the same element, then we are fine. When it will matter is if we are specifically interested in the length of the words. For example, if we want God's algorithm for solving Rubik's cube, we are interested in the length of words in the generators

*and*their inverses - the clockwise and anti-clockwise face rotations.

^{-1}= g. Such an element is called an

*involution*.

Are there groups which can be generated by involutions alone? Yes, there are. Let's have a look at a couple.

Consider the symmetry group of a regular polygon, say a pentagon. Consider the two reflections shown below. 'a' is the reflection in an axis through a vertex, and 'b' is the reflection in an axis through the midpoint of an adjacent edge. Hence the angle between the axes is pi/5 (or for an n-gon, pi/n).

It should be clear that ab is a 1/5 rotation of the pentagon. It follows that a,b generate the symmetry group of the pentagon, with a^2 = b^2 = (ab)^5 =1.

`> elts (['a','b'], [("aa",""), ("bb",""), ("ababababab","")])`

["","a","b","ab","ba","aba","bab","abab","baba","ababa"]

> length it

10

Next, consider the symmetric group S4 (or in general, Sn). It can be generated by the transpositions s1 = (1 2), s2 = (2 3), and s3 = (3 4), which correspond to the diagrams below:

Now, multiplication in the group corresponds to concatenation of the diagrams, going down the page. For example:

In fact, each of those diagrams represents the identity element - as you can check by following each point along the lines down the page, and checking that it ends up where it started. Hence each diagram represents a relation for S4. The diagrams show that s1^2 = 1, (s1s2)^3=1, and (s1s3)^2 = 1.

In the general case, it's clear that Sn can be generated by n-1 transpositions s

_{i}of the form (i i+1), and that they satisfy the following relations:

si^2 = 1

(si sj)^3 = 1 if |i-j| = 1

(si sj)^2 = 1 if |i-j| > 1

Here's some Haskell code to construct these presentations of Sn. (Did I mention that all of the string rewriting code works on arbitrary lists, not just strings?)

newtype S = S Int deriving (Eq,Ord)
instance Show S where
show (S i) = "s" ++ show i
_S n = (gs, r ++ s ++ t) where
gs = map S [1..n-1]
r = [([S i, S i],[]) | i <- [1..n-1]]
s = [(concat $ replicate 3 [S i, S (i+1)],[]) | i <- [1..n-2]]
t = [([S i, S j, S i, S j],[]) | i <- [1..n-1], j <- [i+2..n-1]]

And just to check:

`> _S 4`

([s1,s2,s3],[([s1,s1],[]),([s2,s2],[]),([s3,s3],[]),([s1,s2,s1,s2,s1,s2],[]),([s2,s3,s2,s3,s2,s3],[]),([s1,s3,s1,s3],[])])

> elts $ _S 4

[[],[s1],[s2],[s3],[s1,s2],[s1,s3],[s2,s1],[s2,s3],[s3,s2],[s1,s2,s1],[s1,s2,s3],[s1,s3,s2],[s2,s1,s3],[s2,s3,s2],[s3,s2,s1],[s1,s2,s1,s3],[s1,s2,s3,s2],[s1,s3,s2,s1],[s2,s1,s3,s2],[s2,s3,s2,s1],[s1,s2,s1,s3,s2],[s1,s2,s3,s2,s1],[s2,s1,s3,s2,s1],[s1,s2,s1,s3,s2,s1]]

> length it

24

Anyway, that's it for now. Where I'm heading with this stuff is finite reflection groups and Coxeter groups, but I might take a couple of detours along the way.