The Symmetries of the Triangle using GAP

A simple tutorial

Ben Nasmith
Math and Theology
5 min readJan 3, 2020

--

One of my favourite tools to use as a math PhD student is called GAP, which stands for “Groups, Algorithms, Programming — a System for Computational Discrete Algebra.” This is an award winning open-source software project that is developed and maintained by mathematicians around the world, with a thirty year history and updated versions published more than once each year. Using GAP has brought math to life for me in a way that just reading or putting pen to paper never could. These days, when I learn something new in math, I usually try to construct it in GAP to get a tangible feel for it.

I run GAP from the command prompt of the Windows Subsystem for Linux and write and run more complicated scripts using VS Code.

Symmetries of the Triangle

Let’s begin with the symmetries of a triangle.

Photo by Paweł Czerwiński on Unsplash

Let’s label the corners of our triangle 1, 2, and 3. To rotate the triangle, we need to send 1 to 2, 2 to 3, and 3 to 1. This is called a permutation on three points. In GAP we define permutations using the following syntax:

Here sigma is the permutation (1,2,3) which sends 1 to 2, 2 to 3, and 3 back to 1. The permutation sigma is a rotation of the triangle. What about reflections? Let’s define a second permutation tau = (1,2) than sends 1 to 2, 2 to 1 and fixes 3:

If a diagram helps, we can view these two permutations as follows, with sigma on the left and tau on the right.

Source: Wikipedia

It is possible to compose permutations. For instance, what if we first rotate the triangle, sigma , and then reflect it using tau. This gives us a new permutation:

The permutation sigma*tau is a new reflection fixing the point 1. A natural question to ask is this: what are all the possible permutations of the triangle that we can obtain using rotationsigma and reflectiontau?

In GAP it is very easy to answer this question. We construct a group of permutations:

Using the AsList command allows us to view the list of permutations the make up the group generated by our original rotation and reflection, sigma and tau. But what is this group? Does it have a name? A helpful tool in GAP is the command StructureDescription :

This tells us that our group G is the Symmetric Group on three points, labeled S3 . The key to these descriptions is available in the extensive and helpful GAP documentation:

Symmetric Groups

In the example above we’ve been working with the symmetric group on three points, labeled S3 in GAP. We can construct this group directly as follows:

Let’s construct the symmetric group on four points instead:

This structure has 24 permutations instead of the 6 we say previously. In fact, the symmetric group on n points always has n! permutations. Let’s list these numbers up to n = 20 using GAP:

We obtain the same list by computing the sizes of symmetric groups on n points:

Rather than checking that these lists match manually, we can do a comparison at each step of the way:

Or we can filter our list of symmetric groups and look for exceptions:

Of course, the normal way to handle this material is to prove that the size of the symmetric group on n points is n!. But using GAP I can ask simple questions and check several cases without much effort. This can give me a better sense of what might turn out to be provable in the first place, and were to focus my efforts.

I hope this brief tutorial sparks an interest in using GAP. This has been a very basic example, and GAP has much more to offer for those who spend some time with it.

--

--

Ben Nasmith
Math and Theology

Physics teacher, math PhD candidate and seminary graduate. Interested in combinatorics, algebra, Python and GAP programming, theology and philosophy.