# How to use a program to find all elements of a finite matrix group?

I want to find all elements of a finite matrix group. They can be found by "randomly multiplying" the generators in all possible ways. I have had trouble finding solutions to this problem and I am a total newbie with programming. The entries are from the complex numbers, so it's not over a finite field.

One example I am working on is the group generated by the two matrices:

$$A=\frac{1}{\sqrt{2}} \cdot \begin{pmatrix}1&1\\1&-1\end{pmatrix}$$

$$B=\begin{pmatrix}1&0\\0&i\end{pmatrix}$$

The solution should be that the group generated by these two consists of 192 matrices. I want to find a general solution for cases like these. (2x2 matrices with complex entries).

The best way for me to understand this would be if it works in matlab, but other solutions are very appreciated, too.

This code is in the GAP language and relatively straightforward. Remark that only four iterations are necessary. I'm sure that the code can be a lot improve in order to achieve more speed, but I think its a good starting point.

A:=[[1,1],[1,-1]]/Sqrt(2);;
B:=[[1,0],[0,E(4)]];;
GG:=[A, B];;
for x in Cartesian(GG, GG) do y := x[1]* x[2]; if not y in GG then Add(GG,  y); fi; od;
Size(GG);
6
for x in Cartesian(GG, GG) do y := x[1]* x[2]; if not y in GG then Add(GG,  y); fi; od;
Size(GG);
18
for x in Cartesian(GG, GG) do y := x[1]* x[2]; if not y in GG then Add(GG, y); fi; od;
Size(GG);
82
for x in Cartesian(GG, GG) do y := x[1]* x[2]; if not y in GG then Add(GG, y); fi; od;
Size(GG);
192

• Of course GAP has built-in implementations of much more efficient algorithms to enumerate the entire group - see e.g. @JamesMitchell's answer and other discussions at math.stackexchange.com/questions/1705277 – Alexander Konovalov Oct 2 '16 at 22:32
• @Alexander Konovalov I get : Variable: 'PageSource' must have a value. Otherwise it must be nice to have/ – Marc Bogaerts Oct 3 '16 at 9:35
• @Marc, which version of GAP do you use? – Alexander Konovalov Oct 3 '16 at 19:00
• @AlexanderKonovalov GAPInfo.Version; "4.4.12" I know there are newer versions but I like to use ggap and newer versions seem to support this. – Marc Bogaerts Oct 3 '16 at 20:30
• @Marc, 4.4.12 is nearly 8 years and exactly 20 releases ago. New versions have extended functionality, bugfixes etc. I understand that you like some features in GGAP, but you can also have multiple versions of GAP installed on your computer. Also, you may be interested in experimental GAP Jupyter interface which is now upgraded to provide latest GAP 4.8.5 - maybe there you will find some features that you miss without GGAP. – Alexander Konovalov Oct 4 '16 at 9:54