It seems that Mathematica only has group functionality for permutation groups? Then there is a step to transform the abstract finite one to a permutation one. As an example, consider the following problem Suppose $G= $, try to compute $ab^2ab^2a$. It can proceed by viewing the elements of group just as a string, and the rule of group can be view as a rule of string replace. Any way, I would like to use NonCommutativeMultiply instead: Firstly, let us define the rule, basically, we only need to define the rule for $ab$ and $ba$, since whenever we know how to commute these two generators, then we can use the fact $a^2=1=b^3$ to simplify our expression. It is not hard to compute $ab=b^2a$, $ba=ab^2$: rel = {c___ ** a ** a ** d___ :> c ** i ** d, c___ ** b ** b ** b ** d___ :> c ** i ** d, c___ ** a ** b ** d___ :> c ** b ** b ** a ** d, c___ ** b ** a ** d___ :> c ** a ** b ** b ** d , a___ ** i :> a, i ** a___ :> a} Now, let us define the set of group elements