---
title: "Operations on Elements"
canonical: "https://docs.magma-maths.org/v2.30-1/Algebras/GroupAlgebras/elt-ops.html"
source: "https://docs.magma-maths.org/v2.30-1/Algebras/GroupAlgebras/elt-ops.md"
part: "Algebras"
chapter: "Group Algebras"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/index-algebras.md"}
  - {"title": "Group Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/GroupAlgebras/index-group-algebras.md"}
prev: {"title": "Operations on Group Algebras and their Subalgebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/GroupAlgebras/grp-alg-ops.md"}
next: {"title": "Basic Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/BasicAlgebras/index-basic-algebras.md"}
intrinsics:
  - {"name": "+", "signature": "a + r: AlgGrpElt, RngElt -> AlgGrpElt"}
  - {"name": "+", "signature": "r + a: RngElt, AlgGrpElt -> AlgGrpElt"}
  - {"name": "+", "signature": "a + g: AlgGrpElt, GrpElt -> AlgGrpElt"}
  - {"name": "+", "signature": "g + a: GrpElt, AlgGrpElt -> AlgGrpElt"}
  - {"name": "-", "signature": "a - r: AlgGrpElt, RngElt -> AlgGrpElt"}
  - {"name": "-", "signature": "r - a: RngElt, AlgGrpElt -> AlgGrpElt"}
  - {"name": "-", "signature": "a - g: AlgGrpElt, GrpElt -> AlgGrpElt"}
  - {"name": "-", "signature": "g - a: GrpElt, AlgGrpElt -> AlgGrpElt"}
  - {"name": "*", "signature": "a * r: AlgGrpElt, RngElt -> AlgGrpElt"}
  - {"name": "*", "signature": "r * a: RngElt, AlgGrpElt -> AlgGrpElt"}
  - {"name": "*", "signature": "g * a: GrpElt, AlgGrpElt -> AlgGrpElt"}
  - {"name": "*", "signature": "a * g: AlgGrpElt, GrpElt -> AlgGrpElt"}
  - {"name": "Support", "signature": "Support(a): AlgGrpElt -> SeqEnum"}
  - {"name": "Trace", "signature": "Trace(a): AlgGrpElt -> RngElt"}
  - {"name": "Augmentation", "signature": "Augmentation(a): AlgGrpElt -> RngElt"}
  - {"name": "Involution", "signature": "Involution(a): AlgGrpElt -> AlgGrpElt"}
  - {"name": "Coefficient", "signature": "Coefficient(a, g): AlgGrpElt, GrpElt -> RngElt"}
  - {"name": "a", "signature": "a[g]: AlgGrpElt, GrpElt -> RngElt"}
  - {"name": "ElementToSequence", "signature": "ElementToSequence(a): AlgGrpElt -> SeqEnum"}
  - {"name": "Eltseq", "signature": "Eltseq(a): AlgGrpElt -> SeqEnum"}
  - {"name": "Coefficients", "signature": "Coefficients(a): AlgGrpElt -> SeqEnum"}
  - {"name": "Centraliser", "signature": "Centraliser(a): AlgGrpElt -> AlgGrpSub"}
  - {"name": "Centralizer", "signature": "Centralizer(a): AlgGrpElt -> AlgGrpSub"}
  - {"name": "Centraliser", "signature": "Centraliser(S, a): AlgGrpSub, AlgGrpElt -> AlgGrpSub"}
  - {"name": "Centralizer", "signature": "Centralizer(S, a): AlgGrpSub, AlgGrpElt -> AlgGrpSub"}
examples:
  - "ex-76435e"
  - "ex-1a2ff9"
---

# 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 id="operation-op-plus-alggrpelt-rngelt"></a>
## `a + r: AlgGrpElt, RngElt -> AlgGrpElt`

<a id="operation-op-plus-rngelt-alggrpelt"></a>
## `r + a: RngElt, AlgGrpElt -> AlgGrpElt`

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

<a id="operation-op-plus-alggrpelt-grpelt"></a>
## `a + g: AlgGrpElt, GrpElt -> AlgGrpElt`

<a id="operation-op-plus-grpelt-alggrpelt"></a>
## `g + a: GrpElt, AlgGrpElt -> AlgGrpElt`

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

<a id="operation-op-minus-alggrpelt-rngelt"></a>
## `a - r: AlgGrpElt, RngElt -> AlgGrpElt`

<a id="operation-op-minus-rngelt-alggrpelt"></a>
## `r - a: RngElt, AlgGrpElt -> AlgGrpElt`

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

<a id="operation-op-minus-alggrpelt-grpelt"></a>
## `a - g: AlgGrpElt, GrpElt -> AlgGrpElt`

<a id="operation-op-minus-grpelt-alggrpelt"></a>
## `g - a: GrpElt, AlgGrpElt -> AlgGrpElt`

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

<a id="operation-op-times-alggrpelt-rngelt"></a>
## `a * r: AlgGrpElt, RngElt -> AlgGrpElt`

<a id="operation-op-times-rngelt-alggrpelt"></a>
## `r * a: RngElt, AlgGrpElt -> AlgGrpElt`

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

<a id="operation-op-times-grpelt-alggrpelt"></a>
## `g * a: GrpElt, AlgGrpElt -> AlgGrpElt`

<a id="operation-op-times-alggrpelt-grpelt"></a>
## `a * g: AlgGrpElt, GrpElt -> AlgGrpElt`

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

<a id="function-support-alggrpelt"></a>
## `Support(a): AlgGrpElt -> SeqEnum`

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

<a id="function-trace-alggrpelt"></a>
## `Trace(a): AlgGrpElt -> RngElt`

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

<a id="function-augmentation-alggrpelt"></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$.

<a id="function-involution-alggrpelt"></a>
## `Involution(a): AlgGrpElt -> AlgGrpElt`

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

<a id="function-coefficient-alggrpelt-grpelt"></a>
## `Coefficient(a, g): AlgGrpElt, GrpElt -> RngElt`

<a id="indexed-indexed-a-alggrpelt-grpelt-rngelt"></a>
## `a[g]: AlgGrpElt, GrpElt -> RngElt`

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

<a id="function-elementtosequence-alggrpelt"></a>
## `ElementToSequence(a): AlgGrpElt -> SeqEnum`

<a id="function-eltseq-alggrpelt"></a>
## `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$.

<a id="function-coefficients-alggrpelt"></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$.

<a id="function-centraliser-alggrpelt"></a>
## `Centraliser(a): AlgGrpElt -> AlgGrpSub`

<a id="function-centralizer-alggrpelt"></a>
## `Centralizer(a): AlgGrpElt -> AlgGrpSub`

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

<a id="function-centraliser-alggrpsub-alggrpelt"></a>
## `Centraliser(S, a): AlgGrpSub, AlgGrpElt -> AlgGrpSub`

<a id="function-centralizer-alggrpsub-alggrpelt"></a>
## `Centralizer(S, a): AlgGrpSub, AlgGrpElt -> AlgGrpSub`

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

<a id="example-ex-76435e"></a>
## `Example: Diameter of a Cayley Graph (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 ]
```

<a id="example-ex-1a2ff9"></a>
## `Example: Random Distribution of Words (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
```
