# Operations on Algebras and their Elements

## Operations on Algebras

### `Centre(A): AlgAss -> AlgAss`

The centre of the associative algebra $A$.

### `Centralizer(A, S): AlgAss, AlgAss -> AlgAss`

### `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$.

### `Idealizer(A, B: parameters): AlgAss, AlgAss -> AlgAss`

### `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.

### `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.

### `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$.

### `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$.

### `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$.

### `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$.

### `Example: liealg (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({\mathbb{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`.

### `RestrictionOfScalars(A): AlgAss[FldAlg] -> AlgAss, Map`

### `RestrictionOfScalars(A): AlgAss[FldFun] -> AlgAss, Map`

### `RestrictionOfScalars(A, F): AlgAss[FldAlg], Fld -> AlgAss, Map`

### `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$.

### `Example: restrict (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

### `Centralizer(A, s): AlgAss, AlgAssElt -> AlgAss`

### `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$.

### `LieBracket(a, b): AlgAssElt, AlgAssElt -> AlgAssElt`

### `(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$.

### `IsScalar(a): AlgAssElt -> BoolElt, RngElt`

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

### `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

### `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$.

### `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.

### `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.

### `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 [[Cohen *et al.*, 1997](../../references.md#cite-cohen-ivanyos-wales)]. The meataxe algorithm can be used by setting `Al := "Meataxe"`.

### `Example: Jac Rad (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

```

### `DirectSumDecomposition(A): AlgAssV -> [ AlgAssV ], [ AlgAssVElt ]`

### `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 [[Eberly and Giesbrecht, 1996](../../references.md#cite-eberly-giesbrecht)].

### `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 [[Eberly and Giesbrecht, 1996](../../references.md#cite-eberly-giesbrecht)].

### `Example: Id Pots (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.
