# Working with group rings in Sage

Posted by Jason Polak on 16. January 2018 · Write a comment · Categories: commutative-algebra, ring-theory · Tags:

Let $\Z[\Z/n]$ denote the integral group ring of the cyclic group $\Z/n$. How would you create $\Z[\Z/n]$ in Sage so that you could easily multiply elements?

First, if you’ve already assigned a group to the variable ‘A’, then

will give you the corresponding group ring and store it in the variable ‘R’. The first argument of ‘GroupAlgebra(-,-)’ is the group and the second is the coefficient ring. Sage uses ‘ZZ’ to denote the integers, ‘QQ’ to denote the rationals, etc.

So how do you specify the cyclic group $A$? The first posibility is to use the construction:

where you’d replace ‘n’ by the actual number that you want there. This is useful if you want to work with other permutation groups, because the elements of ‘A’ are stored as permutations:

The output to this snippet is:

In most use cases this probably won’t be ideal because referring to elements of ‘A’ in code is difficult, and only gets more cumbersome as the modulus increases! A far easier approach is to use the ‘AbelianGroup’ constructor. Here is how it works:

This constructs a cyclic group of order 10 with generator ‘y’. Now you can create the group ring with

Here is how you write down elements of R:

We use the constructor ‘R(y)’ to specify that in this expression, ‘y’ is to be considered as an element of the group ring ‘R’ rather than the abelian group ‘A’. In fact, evaluating ‘1 + y’ would just result in an error. You can do arithmetic on this expression. Evaluating

gives

Here is another more interesting example. In the paper ‘Units of Integral Group Rings’, Sudarshan Sehgal claimed that the element

is a unit in $\Z[\Z/10]$. Was he right? He even provided an inverse:

Indeed, evaluating ‘u*v’ in Sage returns ‘1’. Excellent!

Actually, did you know there is a third way of making the group ring $\Z[\Z/10]$ in Sage? It uses finitely presented groups like so:

I would not recommend this method for finitely generated abelian groups though because Sage won’t automatically reduce ‘x^10’ to the group identity, whether you’re working directly with ‘A’ or with a group ring of ‘A’ over some coefficient ring. Therefore, the nice check we did that ‘u’ was actually a unit and its inverse of ‘v’ would not be as straightfoward.