# Todd–Coxeter algorithm

In group theory, the Todd–Coxeter algorithm, created by J. A. Todd and H. S. M. Coxeter in 1936, is an algorithm for solving the coset enumeration problem. Given a presentation of a group G by generators and relations and a subgroup H of G, the algorithm enumerates the cosets of H on G and describes the permutation representation of G on the space of the cosets (given by the left multiplication action). If the order of a group G is relatively small and the subgroup H is known to be uncomplicated (for example, a cyclic group), then the algorithm can be carried out by hand and gives a reasonable description of the group G. Using their algorithm, Coxeter and Todd showed that certain systems of relations between generators of known groups are complete, i.e. constitute systems of defining relations.
The Todd–Coxeter algorithm can be applied to infinite groups and is known to terminate in a finite number of steps, provided that the index of H in G is finite. On the other hand, for a general pair consisting of a group presentation and a subgroup, its running time is not bounded by any computable function of the index of the subgroup and the size of the input data.

## Description of the algorithm

One implementation of the algorithm proceeds as follows. Suppose that $G=\langle X\mid R\rangle$, where $X$ is a set of generators and $R$ is a set of relations and denote by $X'$ the set of generators $X$ and their inverses. Let $H=\langle h_{1},h_{2},\ldots ,h_{s}\rangle$ where the $h_{i}$ are words of elements of $X'$. There are three types of tables that will be used: a coset table, a relation table for each relation in $R$, and a subgroup table for each generator $h_{i}$ of $H$. Information is gradually added to these tables, and once they are filled in, all cosets have been enumerated and the algorithm terminates.
The coset table is used to store the relationships between the known cosets when multiplying by a generator. It has rows representing cosets of $H$ and a column for each element of $X'$. Let $C_{i}$ denote the coset of the ith row of the coset table, and let $g_{j}\in X'$ denote generator of the jth column. The entry of the coset table in row i, column j is defined to be (if known) k, where k is such that $C_{k}=C_{i}g_{j}$.
The relation tables are used to detect when some of the cosets we have found are actually equivalent. One relation table for each relation in $R$ is maintained. Let $1=g_{n_{1}}g_{n_{2}}\cdots g_{n_{t}}$ be a relation in $R$, where $g_{n_{i}}\in X'$. The relation table has rows representing the cosets of $H$, as in the coset table. It has t columns, and the entry in the ith row and jth column is defined to be (if known) k, where $C_{k}=C_{i}g_{n_{1}}g_{n_{2}}\cdots g_{n_{j}}$. In particular, the $(i,t)$'th entry is initially i, since $g_{n_{1}}g_{n_{2}}\cdots g_{n_{t}}=1$.
Finally, the subgroup tables are similar to the relation tables, except that they keep track of possible relations of the generators of $H$. For each generator $h_{n}=g_{n_{1}}g_{n_{2}}\cdots g_{n_{t}}$ of $H$, with $g_{n_{i}}\in X'$, we create a subgroup table. It has only one row, corresponding to the coset of $H$ itself. It has t columns, and the entry in the jth column is defined (if known) to be k, where $C_{k}=Hg_{n_{1}}g_{n_{2}}\cdots g_{n_{j}}$. In particular, the last entry is H, since $Hg_{n_{1}}g_{n_{2}}\cdots g_{n_{t}}=Hh_{n}=H$.
When a row of a relation or subgroup table is completed, a new piece of information $C_{i}=C_{j}g$, $g\in X'$, is found. This is known as a deduction. From the deduction, we may be able to fill in additional entries of the relation and subgroup tables, resulting in possible additional deductions. We can fill in the entries of the coset table corresponding to the equations $C_{i}=C_{j}g$ and $C_{j}=C_{i}g^{-1}$.
However, when filling in the coset table, it is possible that we may already have an entry for the equation, but the entry has a different value. In this case, we have discovered that two of our cosets are actually the same, known as a coincidence. Suppose $C_{i}=C_{j}$, with $i<j$. We replace all instances of j in the tables with i. Then, we fill in all possible entries of the tables, possibly leading to more deductions and coincidences.
If there are empty entries in the table after all deductions and coincidences have been taken care of, add a new coset to the tables and repeat the process. We make sure that when adding cosets, if Hx is a known coset, then Hxg will be added at some point for all $g\in X'$. (This is needed to guarantee that the algorithm will terminate provided $|G:H|$ is finite.)
When all the tables are filled, the algorithm terminates. We then have all needed information on the action of $G$ on the cosets of $H$.