---
title: "Operations on Elements of an Algebra"
canonical: "https://docs.magma-maths.org/v2.30-1/Algebras/IntroductionToAlgebras/ops-2.html"
source: "https://docs.magma-maths.org/v2.30-1/Algebras/IntroductionToAlgebras/ops-2.md"
part: "Algebras"
chapter: "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": "Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/IntroductionToAlgebras/index-introduction-to-algebras.md"}
prev: {"title": "Operations on Algebras and Subalgebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/IntroductionToAlgebras/ops.md"}
next: {"title": "Structure Constant Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/StructureConstantAlgebras/index-structure-constant-algebras.md"}
intrinsics:
  - {"name": "+", "signature": "a + b: AlgGenElt, AlgGenElt -> AlgGenElt"}
  - {"name": "-", "signature": "- a: AlgGenElt -> AlgGenElt"}
  - {"name": "-", "signature": "a - b: AlgGenElt, AlgGenElt -> AlgGenElt"}
  - {"name": "*", "signature": "a * b: AlgGenElt, AlgGenElt -> AlgGenElt"}
  - {"name": "*", "signature": "a * r: AlgGenElt, RngElt -> AlgGenElt"}
  - {"name": "*", "signature": "r * a: RngElt, AlgGenElt -> AlgGenElt"}
  - {"name": "/", "signature": "a / r: AlgGenElt, RngElt -> AlgGenElt"}
  - {"name": "^", "signature": "a ^ n: AlgGenElt, RngIntElt -> AlgGenElt"}
  - {"name": "MinimalPolynomial", "signature": "MinimalPolynomial(a): AlgGenElt -> RngUPolElt"}
  - {"name": "Parent", "signature": "Parent(a): AlgGenElt -> AlgGen"}
  - {"name": "eq", "signature": "a eq b: AlgGenElt, AlgGenElt -> BoolElt"}
  - {"name": "ne", "signature": "a ne b: AlgGenElt, AlgGenElt -> BoolElt"}
  - {"name": "in", "signature": "a in A: AlgGenElt, AlgGen -> BoolElt"}
  - {"name": "notin", "signature": "a notin A: AlgGenElt, AlgGen -> BoolElt"}
  - {"name": "IsZero", "signature": "IsZero(a): AlgGenElt -> BoolElt"}
  - {"name": "IsOne", "signature": "IsOne(a): AlgGenElt -> BoolElt"}
  - {"name": "IsMinusOne", "signature": "IsMinusOne(a): AlgGenElt -> BoolElt"}
  - {"name": "IsUnit", "signature": "IsUnit(a): AlgGenElt -> BoolElt, AlgGenElt"}
  - {"name": "IsRegular", "signature": "IsRegular(a): AlgGenElt -> BoolElt"}
  - {"name": "IsZeroDivisor", "signature": "IsZeroDivisor(a): AlgGenElt -> BoolElt"}
  - {"name": "IsIdempotent", "signature": "IsIdempotent(a): AlgGenElt -> BoolElt"}
  - {"name": "IsNilpotent", "signature": "IsNilpotent(a): AlgGenElt -> BoolElt, RngIntElt"}
---

# Operations on Elements of an Algebra

## Operations on Elements

<a id="operation-op-plus-alggenelt-alggenelt"></a>
### `a + b: AlgGenElt, AlgGenElt -> AlgGenElt`

The sum of the elements $a$ and $b$ of an algebra $A$.

<a id="operation-operation-alggenelt-alggenelt"></a>
### `- a: AlgGenElt -> AlgGenElt`

The negation of the algebra element $a$.

<a id="operation-op-minus-alggenelt-alggenelt"></a>
### `a - b: AlgGenElt, AlgGenElt -> AlgGenElt`

The difference of the elements $a$ and $b$ of an algebra $A$.

<a id="operation-op-times-alggenelt-alggenelt"></a>
### `a * b: AlgGenElt, AlgGenElt -> AlgGenElt`

The product of the elements $a$ and $b$ of an algebra $A$.

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

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

The product of the element $a$ of the algebra $A$ and the ring element $r \in R$, where $R$ is the coefficient ring of $A$.

<a id="operation-op-div-alggenelt-rngelt"></a>
### `a / r: AlgGenElt, RngElt -> AlgGenElt`

The product of the element $a$ of the $R$-algebra $A$ and the ring element $1 / r \in R$, where $R$ is a field.

<a id="operation-op-pow-alggenelt-rngintelt"></a>
### `a ^ n: AlgGenElt, RngIntElt -> AlgGenElt`

If $n$ is positive, form the (left-normed) $n$-th power $(( \ldots ((a*a)*a) \ldots )*a)$ of $a$; if the parent algebra $A$ of $a$ has an identity and $n$ is zero, return the identity; if $n < 0$ and $a$ has an inverse $a^{-1}$ in $A$, form the $n$-th power of $a^{-1}$.

<a id="function-minimalpolynomial-alggenelt"></a>
### `MinimalPolynomial(a): AlgGenElt -> RngUPolElt`

If $R$ is a field or the integer ring, return the minimal polynomial of the algebra element $a$.

<a id="function-parent-alggenelt"></a>
### `Parent(a): AlgGenElt -> AlgGen`

For an element $a$ in an algebra $A$ return $A$.

## Comparisons and Membership

<a id="operation-op-eq-alggenelt-alggenelt"></a>
### `a eq b: AlgGenElt, AlgGenElt -> BoolElt`

Returns `true` if the elements $a$ and $b$ of an algebra $A$ are equal; otherwise `false`.

<a id="operation-op-ne-alggenelt-alggenelt"></a>
### `a ne b: AlgGenElt, AlgGenElt -> BoolElt`

Returns `true` if the elements $a$ and $b$ of an algebra $A$ are not equal; otherwise `false`.

<a id="operation-op-in-alggenelt-alggen"></a>
### `a in A: AlgGenElt, AlgGen -> BoolElt`

Returns `true` if $a$ is in the algebra $A$; otherwise `false`.

<a id="operation-op-notin-alggenelt-alggen"></a>
### `a notin A: AlgGenElt, AlgGen -> BoolElt`

Returns `true` if $a$ is not in the algebra $A$; otherwise `false`.

## Predicates on Elements

<a id="function-iszero-alggenelt"></a>
### `IsZero(a): AlgGenElt -> BoolElt`

Returns `true` if the algebra element $a$ is zero; otherwise `false`.

<a id="function-isone-alggenelt"></a>
### `IsOne(a): AlgGenElt -> BoolElt`

Returns `true` if the algebra element $a$ is the identity; otherwise `false`.

<a id="function-isminusone-alggenelt"></a>
### `IsMinusOne(a): AlgGenElt -> BoolElt`

Returns `true` if the algebra element $a$ is the negative of the identity element; otherwise `false`.

<a id="function-isunit-alggenelt"></a>
### `IsUnit(a): AlgGenElt -> BoolElt, AlgGenElt`

Returns `true` if the element $a$ is a unit, plus the inverse; otherwise `false`.

<a id="function-isregular-alggenelt"></a>
### `IsRegular(a): AlgGenElt -> BoolElt`

Returns `true` if the element $a$ is regular, that is, is not a zero divisor; otherwise `false`.

<a id="function-iszerodivisor-alggenelt"></a>
### `IsZeroDivisor(a): AlgGenElt -> BoolElt`

Returns `true` if the algebra element $a$ is a divisor of zero; otherwise `false`.

<a id="function-isidempotent-alggenelt"></a>
### `IsIdempotent(a): AlgGenElt -> BoolElt`

Returns `true` if the element $a$ is an idempotent, i.e. if $a^2 = a$; otherwise `false`.

<a id="function-isnilpotent-alggenelt"></a>
### `IsNilpotent(a): AlgGenElt -> BoolElt, RngIntElt`

Returns `true` if the element $a$ is nilpotent, i.e. if $a^n = 0$ for some $n \geq 0$; otherwise `false`. If `true`, the minimal $n$ such that $a^n = 0$ is returned as a second value.
