# Operations on Elements

The operations in this section can be applied to elements of either a group algebra or of a group algebra subalgebra of type `AlgGrpSub`. Only those operations are listed, which are additional to those available for general algebras.

## `a + r: AlgGrpElt, RngElt -> AlgGrpElt`

## `r + a: RngElt, AlgGrpElt -> AlgGrpElt`

The sum of the group algebra element $a \in R[G]$ and the scalar $r \in R$.

## `a + g: AlgGrpElt, GrpElt -> AlgGrpElt`

## `g + a: GrpElt, AlgGrpElt -> AlgGrpElt`

The sum of the group algebra element $a \in R[G]$ and the group element $g \in G$.

## `a - r: AlgGrpElt, RngElt -> AlgGrpElt`

## `r - a: RngElt, AlgGrpElt -> AlgGrpElt`

The difference of the group algebra element $a \in R[G]$ and the scalar $r \in R$.

## `a - g: AlgGrpElt, GrpElt -> AlgGrpElt`

## `g - a: GrpElt, AlgGrpElt -> AlgGrpElt`

The difference of the group algebra element $a \in R[G]$ and the group element $g \in G$.

## `a * r: AlgGrpElt, RngElt -> AlgGrpElt`

## `r * a: RngElt, AlgGrpElt -> AlgGrpElt`

The product of the group algebra element $a \in R[G]$ and the scalar $r \in R$.

## `g * a: GrpElt, AlgGrpElt -> AlgGrpElt`

## `a * g: AlgGrpElt, GrpElt -> AlgGrpElt`

The product of the group algebra element $a \in R[G]$ and the group element $g \in G$.

## `Support(a): AlgGrpElt -> SeqEnum`

The support of $a$; that is, the sequence of group elements whose coefficients in $a$ are non-zero.

## `Trace(a): AlgGrpElt -> RngElt`

The trace of $a$; that is, the coefficient of $1_G$ in $a$.

## `Augmentation(a): AlgGrpElt -> RngElt`

The augmentation of the group algebra element $a$; that is, $\sum_{g \in G} r_g$ where $a = \sum_{g \in G} r_g * g$.

## `Involution(a): AlgGrpElt -> AlgGrpElt`

If $a = \sum_{g \in G} r_g * g$, returns $\sum_{g \in G} r_g * g^{-1}$.

## `Coefficient(a, g): AlgGrpElt, GrpElt -> RngElt`

## `a[g]: AlgGrpElt, GrpElt -> RngElt`

The coefficient of $g \in G$ in $a \in R[G]$.

## `ElementToSequence(a): AlgGrpElt -> SeqEnum`

## `Eltseq(a): AlgGrpElt -> SeqEnum`

If $a$ is an element from a group algebra $A$ given in vector representation, this returns the sequence of coefficients with respect to the fixed basis of $A$. If $A$ is given in terms representation, this returns a sequence of tuples, where the second entry is a group element and the first is the coefficient of that group element in $a$.

## `Coefficients(a): AlgGrpElt -> SeqEnum`

For an element $a$ from a group algebra $A$ given in vector representation, this returns the sequence of coefficients with respect to the fixed basis of $A$.

## `Centraliser(a): AlgGrpElt -> AlgGrpSub`

## `Centralizer(a): AlgGrpElt -> AlgGrpSub`

The centralizer in the group algebra $A$ of the element $a$ of $A$.

## `Centraliser(S, a): AlgGrpSub, AlgGrpElt -> AlgGrpSub`

## `Centralizer(S, a): AlgGrpSub, AlgGrpElt -> AlgGrpSub`

The centralizer of the element $a$ (of a group algebra $A$) in the subalgebra $S$ of $A$.

## `Example: powering (ex-76435e)`

We use the group algebra to determine the diameter of the Cayley graph of a group.

```magma
> G := Alt(6);
> QG := GroupAlgebra( Rationals(), G );
> e := QG!1 + &+[ QG!g : g in Generators(G) ];
> e;
Id(G) + (1, 2)(3, 4, 5, 6) + (1, 2, 3)

```

The group elements that can be expressed as words of length at most $n$ in the generators of $G$ have non-zero coefficient in $e^n$. The following function returns for a group algebra element $e$ a sequence with the cardinalities of the supports of $e^n$ and breaks when the group order is reached.

```magma
> wordcount := function(e)
>     f := e;
>     count := [ #Support(f) ];
>     while count[#count] lt #Group(Parent(e)) do
>         f *:= e;
>         Append(~count, #Support(f));
>     end while;
>     return count;
> end function;

```

Now apply this function to the above defined element:

```magma
> wordcount( e );
[ 3, 7, 14, 26, 47, 83, 140, 219, 293, 345, 360 ]

```

Thus, every element in $A_6$ can be expressed as a word of length at most 11 in the generators $(1,2)(3,4,5,6)$ and $(1,2,3)$. A better 2-generator set is for example $(1,2,3,4,5)$ and $(1,5,3,6,4)$, where all elements can be expressed as words of length at most 10 and this is in fact optimal. A worst 2-generator set is given by $(1,2)(3,4)$ and $(1,5,3,2)(4,6)$.

```magma
> wordcount( QG!1 + G!(1,2,3,4,5) + G!(1,5,3,6,4) );
[ 3, 7, 15, 31, 60, 109, 183, 274, 350, 360 ]
> wordcount( QG!1 + G!(1,2)(3,4) + G!(1,5,3,2)(4,6) );
[ 3, 6, 11, 18, 28, 43, 63, 88, 119, 158, 206, 255, 297, 329, 352, 360 ]

```

## `Example: average (ex-1a2ff9)`

The group algebra can also be used to investigate the random distribution of words of a certain length in the generators of the group.

```magma
> M11 := sub< Sym(11) | (1,11,9,10,4,3,7,2,6,5,8), (1,5,6,3,4,2,7,11,9,10,8) >;
> A := GroupAlgebra(RealField(16), M11 : Rep := "Vector");
> A;
Group algebra with vector representation
Coefficient ring: Real Field of precision 16
Group: Permutation group M11 acting on a set of cardinality 11
    Order = 7920 = 2^4 * 3^2 * 5 * 11
        (1, 11, 9, 10, 4, 3, 7, 2, 6, 5, 8)
        (1, 5, 6, 3, 4, 2, 7, 11, 9, 10, 8)
> e := (A!M11.1 + A!M11.2) / 2.0;
> eta := Eta(A) / #M11;

```

For growing $n$, the words of length $n$ in the generators of `M11` converge towards a random distribution iff `e`$^n$ converges towards `eta`. We look at the quadratic differences of the coefficients of `e^n-eta` for $n = 10,20,30,40,50$.

```magma
> e10 := e^10;
> f := A!1;
> for i in [1..5] do
>     f *:= e10;
>     print &+[ c^2 : c in Eltseq(f - eta) ];
> end for;
0.0012050667195213
1.289719354694155e-5
5.9390965208879e-7
3.394099291966e-8
2.19432454574986e-9

```
