---
title: "Invariants"
canonical: "https://docs.magma-maths.org/v2.30-1/Algebras/NonAssociativeAlgebras/Invariants-of-nonassociative-algebras.html"
source: "https://docs.magma-maths.org/v2.30-1/Algebras/NonAssociativeAlgebras/Invariants-of-nonassociative-algebras.md"
part: "Algebras"
chapter: "Non–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": "Non–Associative Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/NonAssociativeAlgebras/index-non-associative-algebras.md"}
prev: {"title": "Jordan Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/NonAssociativeAlgebras/Jordan-algebras.md"}
next: {"title": "Generic Operations", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/NonAssociativeAlgebras/Generics-for-nonassociative-algebras.md"}
intrinsics:
  - {"name": "Center", "signature": "Center(A): Alg -> Alg"}
  - {"name": "Centre", "signature": "Centre(A): Alg -> Alg"}
  - {"name": "Centroid", "signature": "Centroid(A): Alg -> AlgMat"}
  - {"name": "LeftNucleus", "signature": "LeftNucleus(A): Alg -> AlgMat"}
  - {"name": "RightNucleus", "signature": "RightNucleus(A): Alg -> AlgMat"}
  - {"name": "MidNucleus", "signature": "MidNucleus(A): Alg -> AlgMat"}
  - {"name": "DerivationAlgebra", "signature": "DerivationAlgebra(A): Alg -> AlgMatLie"}
examples:
  - "ex-ebe4ae"
  - "ex-8c0a5c"
  - "ex-a850f6"
---

# Invariants

Converting an algebra to a tensor enables Magma to compute standard invariants of any algebra. We note that there are known errors for ${\mathbb{R}}$ and ${\mathbb{C}}$ due to the numerical stability of the linear algebra involved in the computations.

<a id="function-center-alg"></a>
## `Center(A): Alg -> Alg`

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

Returns the center of the algebra $A$.

<a id="function-centroid-alg"></a>
## `Centroid(A): Alg -> AlgMat`

Returns the centroid of the $K$-algebra $A$ as a subalgebra of $\rm{End}_K(A)$.

<a id="example-ex-ebe4ae"></a>
## `Example: Center and Centroid of an Algebra (ex-ebe4ae)`

We will construct a representation of $\rm{SL}_2(9)$ in $\rm{Mat}_4({\bf F}_{3})$. First we construct $\rm{GL}_2(9)$ from $\rm{Mat}_4({\bf F}_{3})$.

```magma
> M := MatrixAlgebra(GF(3), 4);
> f := ConwayPolynomial(3, 2);
> C := CompanionMatrix(f);
> I := IdentityMatrix(GF(3), 2);
> A := sub< M | [InsertBlock(M!0, X, i, j) :
>     X in [I, C], i in [1, 3], j in [1, 3]] >;
> T := CommutatorTensor(A);
> T;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 8 over GF(3)
U1 : Full Vector space of degree 8 over GF(3)
U0 : Full Vector space of degree 8 over GF(3)
> GL2 := HeisenbergAlgebra(T);
> GL2;
Algebra of dimension 8 with base ring GF(3)
```

Our Lie algebra is not simple as it has a nontrivial center, so we will obtain $\rm{SL}_2$ by factoring out the center. Note that our algebras are over the prime field ${\bf F}_{3}$, so the center is 2-dimensional (over ${\bf F}_{3}$). Notice that $\rm{SL}_2(9)$ has a trivial center but has a 2-dimensional centroid.

```magma
> SL2 := GL2/Center(GL2);
> SL2;
Algebra of dimension 6 with base ring GF(3)
> Center(SL2);
Algebra of dimension 0 with base ring GF(3)
> Centroid(SL2);
Matrix Algebra of degree 6 with 2 generators over GF(3)
```

<a id="function-leftnucleus-alg"></a>
## `LeftNucleus(A): Alg -> AlgMat`

<a id="function-rightnucleus-alg"></a>
## `RightNucleus(A): Alg -> AlgMat`

<a id="function-midnucleus-alg"></a>
## `MidNucleus(A): Alg -> AlgMat`

Returns the nucleus of the algebra $A$ as a subalgebra of the enveloping algebra of right multiplication ${\cal R}(A)$.

<a id="function-derivationalgebra-alg"></a>
## `DerivationAlgebra(A): Alg -> AlgMatLie`

Returns the derivation algebra of the algebra $A$ as a Lie subalgebra of $\rm{End}_K(A)$.

<a id="example-ex-8c0a5c"></a>
## `Example: Derivation Algebra of the Octonions (ex-8c0a5c)`

We will compute the derivation algebra of the (rational) octonions $O$ and also the 27 dimension exceptional Jordan algebra ${\cal H}_3( O )$. Because the intrinsics use exact linear algebra, we do not use the more familiar field ${\mathbb{C}}$ in this context. First we consider $O$. We verify that $\rm{Der}( O )\cong G_2$.

```magma
> A := OctonionAlgebra(Rationals(), -1, -1, -1);
> A;
Algebra of dimension 8 with base ring Rational Field
> D := DerivationAlgebra(A);
> D;
Matrix Lie Algebra of degree 8 over Rational Field
> SemisimpleType(D);
G2
```

Now we will just briefly perform a sanity check and verify that `D` acts as it should.

```magma
> a := Random(Basis(A));
> b := Random(Basis(A));
> del := Random(Basis(D));
> (a*b)*del eq (a*del)*b + a*(b*del);
true
```

Finally, we construct ${\cal H}_3( O )$ the $3\times 3$ Hermitian matrices, and we verify that $\rm{Der}({\cal H}_3( O )\cong F_4$.

```magma
> J := ExceptionalJordanCSA(A);
> J;
Algebra of dimension 27 with base ring Rational Field
> D_J := DerivationAlgebra(J);
> Dimension(D_J);
52
> SemisimpleType(D_J);
F4
```

<a id="example-ex-a850f6"></a>
## `Example: Further Invariants of Nonassociative Algebras (ex-a850f6)`

We demonstrate further how to use these functions to get invariants of nonassociative algebras. First, we will obtain the derivation Lie algebra of the Octonions, which are of type $G_2$.

```magma
> A := OctonionAlgebra(GF(7),-1,-1,-1);
> A;
Algebra of dimension 8 with base ring GF(7)
> D := DerivationAlgebra(A);
> D.1;
[0 0 0 0 0 0 0 0]
[0 0 6 0 6 3 2 1]
[0 1 0 3 4 1 1 3]
[0 0 4 0 6 4 2 3]
[0 1 3 1 0 6 2 0]
[0 4 6 3 1 0 6 2]
[0 5 6 5 5 1 0 4]
[0 6 4 4 0 5 3 0]
> Dimension(D);
14
> SemisimpleType(D);
G2
```

Now we will show that the left, mid, and right nuclei are all one dimensional. All of which are generated by $R_1$, multiplication by $1_A$.

```magma
> Z := Center(A);
> Z;
Algebra of dimension 1 with base ring GF(7)
>
> L := LeftNucleus(A);
> L;
Matrix Algebra of degree 8 with 1 generator over GF(7)
> L.1;
[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 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 1 0]
[0 0 0 0 0 0 0 1]
>
> L eq MidNucleus(A);
true
> L eq RightNucleus(A);
true
```
