---
title: "Operations on Algebras and their Elements"
canonical: "https://docs.magma-maths.org/v2.30-1/Algebras/AssociativeAlgebras/ops.html"
source: "https://docs.magma-maths.org/v2.30-1/Algebras/AssociativeAlgebras/ops.md"
part: "Algebras"
chapter: "Associative 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": "Associative Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/AssociativeAlgebras/index-associative-algebras.md"}
prev: {"title": "Construction of Associative Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/AssociativeAlgebras/creation.md"}
next: {"title": "Orders", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/AssociativeAlgebras/alg_ass_ord.md"}
intrinsics:
  - {"name": "Centre", "signature": "Centre(A): AlgAss -> AlgAss"}
  - {"name": "Centralizer", "signature": "Centralizer(A, S): AlgAss, AlgAss -> AlgAss"}
  - {"name": "Centraliser", "signature": "Centraliser(A, S): AlgAss, AlgAss -> AlgAss"}
  - {"name": "Idealizer", "signature": "Idealizer(A, B: parameters): AlgAss, AlgAss -> AlgAss"}
  - {"name": "Idealiser", "signature": "Idealiser(A, B: parameters): AlgAss, AlgAss -> AlgAss"}
  - {"name": "LieAlgebra", "signature": "LieAlgebra(A): AlgAss -> AlgGen, Map"}
  - {"name": "CommutatorModule", "signature": "CommutatorModule(A, B): AlgAss, AlgAss -> ModTupRng"}
  - {"name": "CommutatorIdeal", "signature": "CommutatorIdeal(A, B): AlgAss, AlgAss -> AlgAss"}
  - {"name": "LeftAnnihilator", "signature": "LeftAnnihilator(A, B): AlgAss, AlgAss -> AlgAss, AlgAss"}
  - {"name": "RightAnnihilator", "signature": "RightAnnihilator(A, B): AlgAss, AlgAss -> AlgAss, AlgAss"}
  - {"name": "RestrictionOfScalars", "signature": "RestrictionOfScalars(A): AlgAss[FldAlg] -> AlgAss, Map"}
  - {"name": "RestrictionOfScalars", "signature": "RestrictionOfScalars(A): AlgAss[FldFun] -> AlgAss, Map"}
  - {"name": "RestrictionOfScalars", "signature": "RestrictionOfScalars(A, F): AlgAss[FldAlg], Fld -> AlgAss, Map"}
  - {"name": "RestrictionOfScalars", "signature": "RestrictionOfScalars(A, F): AlgAss[FldFun], FldFunG -> AlgAss, Map"}
  - {"name": "Centralizer", "signature": "Centralizer(A, s): AlgAss, AlgAssElt -> AlgAss"}
  - {"name": "Centraliser", "signature": "Centraliser(A, s): AlgAss, AlgAssElt -> AlgAss"}
  - {"name": "LieBracket", "signature": "LieBracket(a, b): AlgAssElt, AlgAssElt -> AlgAssElt"}
  - {"name": "(a, b)", "signature": "(a, b): AlgAssElt, AlgAssElt -> AlgAssElt"}
  - {"name": "IsScalar", "signature": "IsScalar(a): AlgAssElt -> BoolElt, RngElt"}
  - {"name": "RepresentationMatrix", "signature": "RepresentationMatrix(a, M : parameters): AlgAssElt, AlgAss -> AlgMatElt"}
  - {"name": "MatrixAlgebra", "signature": "MatrixAlgebra(A): AlgAss -> AlgMat"}
  - {"name": "MatrixAlgebra", "signature": "MatrixAlgebra(A, M : parameters): AlgAss, AlgAss -> AlgMat, Map"}
  - {"name": "RegularRepresentation", "signature": "RegularRepresentation(A : parameters): AlgAss -> AlgMat, Map"}
  - {"name": "JacobsonRadical", "signature": "JacobsonRadical(A): AlgAssV -> AlgAssV"}
  - {"name": "DirectSumDecomposition", "signature": "DirectSumDecomposition(A): AlgAssV -> [ AlgAssV ], [ AlgAssVElt ]"}
  - {"name": "IndecomposableSummands", "signature": "IndecomposableSummands(A): AlgAssV -> [ AlgAssV ], [ AlgAssVElt ]"}
  - {"name": "CentralIdempotents", "signature": "CentralIdempotents(A): AlgAssV -> SeqEnum, SeqEnum"}
examples:
  - "ex-28076e"
  - "ex-661f6a"
  - "ex-564d9d"
  - "ex-4239e7"
---

# Operations on Algebras and their Elements

## Operations on Algebras

<a id="function-centre-algass"></a>
### `Centre(A): AlgAss -> AlgAss`

The centre of the associative algebra $A$.

<a id="function-centralizer-algass-algass"></a>
### `Centralizer(A, S): AlgAss, AlgAss -> AlgAss`

<a id="function-centraliser-algass-algass"></a>
### `Centraliser(A, S): AlgAss, AlgAss -> AlgAss`

The centralizer of the subalgebra $S$ of the associative algebra $A$, that is, the subalgebra of $A$ commuting elementwise with $S$.

<a id="function-idealizer-algass-algass"></a>
### `Idealizer(A, B: parameters): AlgAss, AlgAss -> AlgAss`

<a id="function-idealiser-algass-algass"></a>
### `Idealiser(A, B: parameters): AlgAss, AlgAss -> AlgAss`

```magma
Side: MonStgElt                    Default: "Both"
```

Given an associative algebra $A$ and a subalgebra $B$ of $A$, compute the idealizer of $B$ in $A$, that is, the largest subalgebra of $A$ in which $B$ is an ideal. By default the two-sided idealizer, that is, the largest subalgebra in which $B$ is a two-sided ideal, is found; the left- or right-idealizer can be found by setting the parameter `Side` to `"Left"` or `"Right"` respectively.

<a id="function-liealgebra-algass"></a>
### `LieAlgebra(A): AlgAss -> AlgGen, Map`

For an associative structure constant algebra $A$, return the structure constant algebra $L$ with product given by the Lie bracket $(a,b) \mapsto a*b - b*a$. As a second value the map identifying the elements of $A$ and $L$ is returned.

<a id="function-commutatormodule-algass-algass"></a>
### `CommutatorModule(A, B): AlgAss, AlgAss -> ModTupRng`

Let $A$ and $B$ be subalgebras of an associative algebra with underlying module $M$. This function returns the submodule of $M$ which is spanned by the elements $[a,b] = a*b - b*a$, $a \in A, b \in B$.

<a id="function-commutatorideal-algass-algass"></a>
### `CommutatorIdeal(A, B): AlgAss, AlgAss -> AlgAss`

For two subalgebras $A$ and $B$ of an associative algebra, return the ideal generated by all $[a,b] = a*b - b*a$, $a \in A, b \in B$.

<a id="function-leftannihilator-algass-algass"></a>
### `LeftAnnihilator(A, B): AlgAss, AlgAss -> AlgAss, AlgAss`

For two subalgebras $A$ and $B$ of an associative algebra, return the left annihilator of $B$ in $A$; that is, the subalgebra of $A$ consisting of all elements $a$ such that $a*b = 0$ for all $b \in B$.

<a id="function-rightannihilator-algass-algass"></a>
### `RightAnnihilator(A, B): AlgAss, AlgAss -> AlgAss, AlgAss`

For two subalgebras $A$ and $B$ of an associative algebra, return the right annihilator of $B$ in $A$; that is, the subalgebra of $A$ consisting of all elements $a$ such that $b*a = 0$ for all $b \in B$.

<a id="example-ex-28076e"></a>
### `Example: Lie Algebra sl3 over the Rationals (ex-28076e)`

We create the Lie algebra $sl_3({\mathbb{Q}})$ as a structure constant algebra. First, we construct $gl_3({\mathbb{Q}})$ from the full matrix algebra $M_3({\mathbb{Q}})$ and get $sl_3({\mathbb{Q}})$ as the derived algebra of $gl_3({\mathbb{Q}})$.

```magma
> gl3 := LieAlgebra(Algebra(MatrixRing(Rationals(), 3)));
> sl3 := gl3 * gl3;
> sl3;
Lie Algebra of dimension 8 with base ring Rational Field
```

Let’s see how the first basis element acts.

```magma
> for i in [1..8] do
>     print sl3.i * sl3.1;
> end for;
(0 0 0 0 0 0 0 0)
( 0 -1  0  0  0  0  0  0)
( 0  0 -2  0  0  0  0  0)
(0 0 0 1 0 0 0 0)
(0 0 0 0 0 0 0 0)
( 0  0  0  0  0 -1  0  0)
(0 0 0 0 0 0 2 0)
(0 0 0 0 0 0 0 1)
```

Since it acts diagonally, this element lies in a Cartan subalgebra. The next candidate seems to be the fifth basis element.

```magma
> for i in [1..8] do
>     print sl3.i * sl3.5;
> end for;
(0 0 0 0 0 0 0 0)
(0 1 0 0 0 0 0 0)
( 0  0 -1  0  0  0  0  0)
( 0  0  0 -1  0  0  0  0)
(0 0 0 0 0 0 0 0)
( 0  0  0  0  0 -2  0  0)
(0 0 0 0 0 0 1 0)
(0 0 0 0 0 0 0 2)
```

This also acts diagonally and commutes with `sl3.1`, hence we have luckily found a full Cartan algebra in $sl_3(\Q)$. We can now easily work out the root system. Obviously the root spaces correspond to the pairs `(sl3.2, sl3.4)`, `(sl3.3, sl3.7)`, and `(sl3.6, sl3.8)`. The product of a positive root with its negative should lie in the Cartan algebra.

```magma
> sl3.2*sl3.4;
( 1  0  0  0 -1  0  0  0)
> sl3.3*sl3.7;
(1 0 0 0 0 0 0 0)
> sl3.6*sl3.8;
(0 0 0 0 1 0 0 0)
```

Clearly some choices have to be made and we fix `sl3.3` as the element $e_\alpha$ corresponding to the first fundamental root $\alpha$, `sl3.7` as $e_{-\alpha}$ and get `sl3.1` as $h_\alpha = e_\alpha * e_{-\alpha}$. For the other fundamental root $\beta$ we have to find an element $e_\beta$ such that $e_\alpha * e_\beta$ is non-zero.

```magma
> sl3.3*sl3.2;
(0 0 0 0 0 0 0 0)
> sl3.3*sl3.4;
( 0  0  0  0  0 -1  0  0)
> sl3.3*sl3.6;
(0 0 0 0 0 0 0 0)
> sl3.3*sl3.8;
(0 1 0 0 0 0 0 0)
```

We choose `sl3.8` as $e_\beta$, `sl3.6` as $e_{-\beta}$, and consequently `-sl3.5` as $h_\beta$. This now determines $e_{\alpha+\beta}$ to be `sl3.2` and $e_{-\alpha-\beta}$ to be `sl3.4`.

<a id="function-restrictionofscalars"></a>
### `RestrictionOfScalars(A): AlgAss[FldAlg] -> AlgAss, Map`

<a id="function-restrictionofscalars-algass-fldfun"></a>
### `RestrictionOfScalars(A): AlgAss[FldFun] -> AlgAss, Map`

<a id="function-restrictionofscalars-algass-fldalg-fld"></a>
### `RestrictionOfScalars(A, F): AlgAss[FldAlg], Fld -> AlgAss, Map`

<a id="function-restrictionofscalars-algass-fldfun-fldfung"></a>
### `RestrictionOfScalars(A, F): AlgAss[FldFun], FldFunG -> AlgAss, Map`

Given an associative algebra $A$ over an algebraic number or function field $K$ and an optional coefficient field $F$ of $K$, return the algebra isomorphic to $A$ whose coefficient field is $F$ if given otherwise the coefficient field of $K$.

<a id="example-ex-661f6a"></a>
### `Example: Restricting Scalars of an Algebra (ex-661f6a)`

We illustrate some computations of restricting scalars, first over the coefficient field.

```magma
> P<x> := PolynomialRing(Rationals());
> F<b> := NumberField(x^3-3*x-1);
> Z_F := MaximalOrder(F);
> A<alpha,beta,alphabeta> := QuaternionAlgebra<F | -3,b>;
> A := AssociativeAlgebra(A);
> A;
Associative Algebra of dimension 4 with base ring F
> RA, m := RestrictionOfScalars(A);
> RA;
Associative Algebra of dimension 12 with base ring Rational Field
> m;
Mapping from: AlgAss: A to AlgAss: RA given by a rule
> m(A.1);
(1 0 0 0 0 0 0 0 0 0 0 0)
> $1 @@ m;
(1 0 0 0)
> RA.6 @@ m;
(  0 b^2   0   0)
> m($1);
(0 0 0 0 0 1 0 0 0 0 0 0)
```

We now show an example where the scalars we are restricting to are not necessarily the coefficient field but a coefficient field of the coefficient field.

```magma
> P<x> := PolynomialRing(QuadraticField(23));
> F<b> := NumberField(x^3-3*x-1);
> Z_F := MaximalOrder(F);
> A<alpha,beta,alphabeta> := QuaternionAlgebra<F | -3,b>;
> A := AssociativeAlgebra(A);
> RA, m := RestrictionOfScalars(A);
> RA;
Associative Algebra of dimension 12 with base ring Quadratic Field with defining
polynomial x^2 - 23 over the Rational Field
> m;
Mapping from: AlgAss: A to AlgAss: RA given by a rule
> RA.6 @@ m;
(  0 b^2   0   0)
> m($1);
(0 0 0 0 0 1 0 0 0 0 0 0)
> RAQ, mQ := RestrictionOfScalars(A, Rationals());
> RAQ, mQ;
Associative Algebra of dimension 24 with base ring Rational Field
Mapping from: AlgAss: A to AlgAss: RAQ given by a rule
> mQ(A.1);
(1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> $1 @@ mQ;
(1 0 0 0)
> RAQ.15 @@ mQ;
(                 0                  0 b^2 + 2*$.1*b + 23                  0)
> mQ($1);
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0)
```

## Operations on Elements

<a id="function-centralizer-algass-algasselt"></a>
### `Centralizer(A, s): AlgAss, AlgAssElt -> AlgAss`

<a id="function-centraliser-algass-algasselt"></a>
### `Centraliser(A, s): AlgAss, AlgAssElt -> AlgAss`

The centralizer of the element $s$ of the associative algebra $A$, that is, the subalgebra of $A$ commuting with $s$.

<a id="function-liebracket-algasselt-algasselt"></a>
### `LieBracket(a, b): AlgAssElt, AlgAssElt -> AlgAssElt`

<a id="literal-literal-a-b-algasselt-algasselt-algasselt"></a>
### `(a, b): AlgAssElt, AlgAssElt -> AlgAssElt`

The Lie bracket $a * b - b * a$ of $a$ and $b$, where $a$ and $b$ are elements of an associative algebra $A$.

<a id="function-isscalar-algasselt"></a>
### `IsScalar(a): AlgAssElt -> BoolElt, RngElt`

Returns `true` (and $a$ coerced to $F$) iff a belongs to the base ring $F$ of its parent algebra.

<a id="function-representationmatrix-algasselt-algass"></a>
### `RepresentationMatrix(a, M : parameters): AlgAssElt, AlgAss -> AlgMatElt`

```magma
Side: MonStgElt                    Default: "Right"
```

Returns the matrix representation of `Side`-multiplication by the element $a$ in the associative algebra $A$ (which must have $1$) on the $A$-module $M$.

## Representations

<a id="function-matrixalgebra-algass"></a>
### `MatrixAlgebra(A): AlgAss -> AlgMat`

For an associative algebra $A$ of dimension $n$ return an isomorphic matrix algebra. If $A$ contains the identity-element, the matrix algebra will be of degree $n$, otherwise it will be of degree $n+1$.

<a id="function-matrixalgebra-algass-algass"></a>
### `MatrixAlgebra(A, M : parameters): AlgAss, AlgAss -> AlgMat, Map`

```magma
Side: MonStgElt                    Default: "Right"
```

Given a finite-dimensional $R$-algebra $A$ and a `Side` $A$-module $M$ (both free as $R$-modules), return the matrix algebra of $A$-endomorphisms of $M$, and the $R$-algebra homomorphism from $A$ into this endomorphism ring.

<a id="function-regularrepresentation-algass"></a>
### `RegularRepresentation(A : parameters): AlgAss -> AlgMat, Map`

```magma
Side: MonStgElt                    Default: "Right"
```

For an associative algebra $A$ of dimension $n$ over $R$ return its regular representation. If $B = (e_1, e_2, \ldots, e_n)$ is the stored basis for $A$, an element $a \in A$ is mapped to the matrix in $R^{n \times n}$ which has as its $i$-th row the coordinates of $e_i * a$ with respect to $B$. As a second map, the homomorphism of $A$ onto the regular representation is returned.

By default, the right-regular representation is computed. This can be changed to the left-regular representation (in which the $i$-th row of the image of $a$ contains the coordinates of $a * e_i$) by setting the parameter `Side` to `"Left"`.

## Decomposition of an Algebra

This section describes a few functions that can be used to obtain information on the structure of a finite-dimensional associative algebra.

<a id="function-jacobsonradical-algassv"></a>
### `JacobsonRadical(A): AlgAssV -> AlgAssV`

```magma
Al: MonStgElt                    Default: "Default"
```

This returns the largest nilpotent ideal of $A$. This function works for finite-dimensional associative algebras defined over a field of characteristic $0$, or over a finite field.

The algorithm used by default is taken from [[CIW97](https://docs.magma-maths.org/v2.30-1/references.md#cite-cohen-ivanyos-wales)]. The meataxe algorithm can be used by setting `Al := "Meataxe"`.

<a id="example-ex-564d9d"></a>
### `Example: Jacobson Radical of a Group Algebra (ex-564d9d)`

We compute the Jacobson radical of the group algebra over the field of three elements of a $3$-group. In that case it is equal to the augmentation ideal.

```magma
> G:= SmallGroup( 27, 5 );
> A:= GroupAlgebra( GF(3), G );
> JacobsonRadical( A );
Ideal of dimension 26 of the group algebra A
```

<a id="function-directsumdecomposition-algassv"></a>
### `DirectSumDecomposition(A): AlgAssV -> [ AlgAssV ], [ AlgAssVElt ]`

<a id="function-indecomposablesummands-algassv"></a>
### `IndecomposableSummands(A): AlgAssV -> [ AlgAssV ], [ AlgAssVElt ]`

Given an associative algebra $A$, return the direct sum decomposition of $L$ as a sequence of ideals of $L$ whose sum is $L$ and each of which cannot be further decomposed into a direct sum of ideals. The second sequence return contains the corresponding primitive central idempotents.

For a description of the algorithm we refer to [[EG96](https://docs.magma-maths.org/v2.30-1/references.md#cite-eberly-giesbrecht)].

<a id="function-centralidempotents-algassv"></a>
### `CentralIdempotents(A): AlgAssV -> SeqEnum, SeqEnum`

Let $Z$ be the centre of the associative algebra $A$, and let $J(Z)$ denote its Jacobson radical. This function returns a sequence of primitive orthogonal idempotents in $Z$ such that their images in $Z/J(Z)$ span $J(Z)$. Each such idempotent generates a two-sided ideal in $A$. The second return value is the sequence of these ideals.

In particular, if $A$ is a semisimple algebra, then this function returns a sequence of primitive orthogonal idempotents spanning $Z$. Furthermore, the ideals in the second sequence returned are simple algebras, and their direct sum equals $A$.

For a description of the algorithm we refer to [[EG96](https://docs.magma-maths.org/v2.30-1/references.md#cite-eberly-giesbrecht)].

<a id="example-ex-4239e7"></a>
### `Example: Central Idempotents of a Group Algebra (ex-4239e7)`

We compute the direct sum decomposition of a group algebra.

```magma
> G:= SmallGroup( 10, 2 );
> A:= GroupAlgebra( Rationals(), G );
> ee, II:= CentralIdempotents( A );
> ee[1];
1/10*Id(G) + 1/10*G.2 + 1/10*G.2^2 + 1/10*G.2^3 + 1/10*G.2^4 + 1/10*G.1 +
1/10*G.1 * G.2 + 1/10*G.1 * G.2^2 + 1/10*G.1 * G.2^3 + 1/10*G.1 * G.2^4
> II;
[
    Ideal of dimension 1 of the group algebra A
    Basis:
        Id(G) + G.2 + G.2^2 + G.2^3 + G.2^4 + G.1 + G.1 * G.2 + G.1 * G.2^2 +
        G.1 * G.2^3 + G.1 * G.2^4,
    Ideal of dimension 1 of the group algebra A
    Basis:
        Id(G) + G.2 + G.2^2 + G.2^3 + G.2^4 - G.1 - G.1 * G.2 - G.1 * G.2^2 -
        G.1 * G.2^3 - G.1 * G.2^4,
    Ideal of dimension 4 of the group algebra A
    Basis:
        Id(G) - G.2^4 + G.1 - G.1 * G.2^4
        G.2 - G.2^4 + G.1 * G.2 - G.1 * G.2^4
        G.2^2 - G.2^4 + G.1 * G.2^2 - G.1 * G.2^4
        G.2^3 - G.2^4 + G.1 * G.2^3 - G.1 * G.2^4,
    Ideal of dimension 4 of the group algebra A
    Basis:
        Id(G) - G.2^4 - G.1 + G.1 * G.2^4
        G.2 - G.2^4 - G.1 * G.2 + G.1 * G.2^4
        G.2^2 - G.2^4 - G.1 * G.2^2 + G.1 * G.2^4
        G.2^3 - G.2^4 - G.1 * G.2^3 + G.1 * G.2^4
]
```

We see that here the group algebra is the direct sum of two $1$-dimensional and two $4$-dimensional ideals. The first idempotent is the sum over all group elements divided by the group order.
