---
title: "Elements of Quaternion Algebras"
canonical: "https://docs.magma-maths.org/v2.30-1/Algebras/QuaternionAlgebras/elements.html"
source: "https://docs.magma-maths.org/v2.30-1/Algebras/QuaternionAlgebras/elements.md"
part: "Algebras"
chapter: "Quaternion 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": "Quaternion Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/QuaternionAlgebras/index-quaternion-algebras.md"}
prev: {"title": "Creation of Quaternion Orders", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/QuaternionAlgebras/order-creation.md"}
next: {"title": "Attributes of Quaternion Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/QuaternionAlgebras/algebra-attributes.md"}
intrinsics:
  - {"name": "!", "signature": "A ! 0: AlgQuat, RngIntElt -> AlgQuatElt"}
  - {"name": "Zero", "signature": "Zero(A): AlgQuat -> AlgQuatElt"}
  - {"name": "!", "signature": "A ! 1: AlgQuat, RngIntElt -> AlgQuatElt"}
  - {"name": "One", "signature": "One(A): AlgQuat -> AlgQuatElt"}
  - {"name": ".", "signature": "A . i: AlgQuat, RngIntElt -> AlgQuatElt"}
  - {"name": "Name", "signature": "Name(A, i): AlgQuat, RngIntElt -> AlgQuatElt"}
  - {"name": "!", "signature": "A ! x: AlgQuat, Any -> AlgQuatElt"}
  - {"name": "+", "signature": "x + y: AlgQuatElt, AlgQuatElt -> AlgQuatElt"}
  - {"name": "-", "signature": "x - y: AlgQuatElt, AlgQuatElt -> AlgQuatElt"}
  - {"name": "*", "signature": "x * y: AlgQuatElt, AlgQuatElt -> AlgQuatElt"}
  - {"name": "/", "signature": "x / y: AlgQuatElt, AlgQuatElt -> AlgQuatElt"}
  - {"name": "/", "signature": "x / y: AlgQuatOrdElt, AlgQuatOrdElt -> AlgQuatElt"}
  - {"name": "eq", "signature": "x eq y: AlgQuatElt, AlgQuatElt -> BoolElt"}
  - {"name": "ne", "signature": "x ne y: AlgQuatElt, AlgQuatElt -> BoolElt"}
  - {"name": "in", "signature": "x in A: AlgQuatElt, AlgQuat -> BoolElt"}
  - {"name": "notin", "signature": "x notin A: AlgQuatElt, AlgQuat -> BoolElt"}
  - {"name": "Conjugate", "signature": "Conjugate(x): AlgQuatElt -> AlgQuatElt"}
  - {"name": "Conjugate", "signature": "Conjugate(x): AlgQuatOrdElt -> AlgQuatOrdElt"}
  - {"name": "Conjugate", "signature": "Conjugate(x): AlgAssVOrdElt -> AlgAssVOrdElt"}
  - {"name": "ElementToSequence", "signature": "ElementToSequence(x): AlgQuatElt -> SeqEnum"}
  - {"name": "Eltseq", "signature": "Eltseq(x): AlgQuatElt -> SeqEnum"}
  - {"name": "Coordinates", "signature": "Coordinates(x): AlgQuatElt -> SeqEnum"}
  - {"name": "Norm", "signature": "Norm(x): AlgQuatElt -> FldElt"}
  - {"name": "Norm", "signature": "Norm(x): AlgQuatOrdElt -> RngElt"}
  - {"name": "Trace", "signature": "Trace(x): AlgQuatElt -> FldElt"}
  - {"name": "Trace", "signature": "Trace(x): AlgQuatOrdElt -> RngElt"}
  - {"name": "CharacteristicPolynomial", "signature": "CharacteristicPolynomial(x): AlgQuatElt -> RngUPolElt"}
  - {"name": "CharacteristicPolynomial", "signature": "CharacteristicPolynomial(x): AlgQuatOrdElt -> RngUPolElt"}
  - {"name": "MinimalPolynomial", "signature": "MinimalPolynomial(x): AlgQuatElt -> RngUPolElt"}
examples:
  - "ex-317c57"
---

# Elements of Quaternion Algebras

For more information about elements of orders of associative algebras, see Section [Orders](https://docs.magma-maths.org/v2.30-1/Algebras/AssociativeAlgebras/alg_ass_ord.md#secalgassvord).

## Creation of Elements

<a id="operation-op-algquat-rngintelt"></a>
### `A ! 0: AlgQuat, RngIntElt -> AlgQuatElt`

<a id="function-zero-algquat"></a>
### `Zero(A): AlgQuat -> AlgQuatElt`

The zero element of the quaternion algebra $A$.

<a id="operation-op-algquat-rngintelt-2"></a>
### `A ! 1: AlgQuat, RngIntElt -> AlgQuatElt`

<a id="function-one-algquat"></a>
### `One(A): AlgQuat -> AlgQuatElt`

The identity element of the quaternion algebra $A$.

<a id="operation-operation-algquat-rngintelt-algquatelt"></a>
### `A . i: AlgQuat, RngIntElt -> AlgQuatElt`

<a id="function-name-algquat-rngintelt"></a>
### `Name(A, i): AlgQuat, RngIntElt -> AlgQuatElt`

Given a quaternion algebra $A$ and an integer $1\le i\le 3$, returns the $i$th generator of $A$ as an algebra over the base ring. Note that the element $1$ is always the first element of a basis, and is never returned as a generating element.

<a id="operation-op-algquat-any"></a>
### `A ! x: AlgQuat, Any -> AlgQuatElt`

Return an element of the quaternion algebra $A$ described by $x$, where $x$ may be an algebra element, a module element, a sequence, an element of an order of an associative algebra or be coercible into the coefficient ring of $A$.

## Arithmetic of Elements

<a id="operation-op-plus-algquatelt-algquatelt"></a>
### `x + y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

The sum of $x$ and $y$.

<a id="operation-op-minus-algquatelt-algquatelt"></a>
### `x - y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

The difference of $x$ and $y$.

<a id="operation-op-times-algquatelt-algquatelt"></a>
### `x * y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

The product of $x$ and $y$.

<a id="operation-op-div-algquatelt-algquatelt"></a>
### `x / y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

<a id="operation-op-div-algquatordelt-algquatordelt"></a>
### `x / y: AlgQuatOrdElt, AlgQuatOrdElt -> AlgQuatElt`

The quotient of $x$ by the unit $y$ in the quaternion algebra.

<a id="operation-op-eq-algquatelt-algquatelt"></a>
### `x eq y: AlgQuatElt, AlgQuatElt -> BoolElt`

Returns `true` if the elements $x$ and $y$ are equal; otherwise `false`.

<a id="operation-op-ne-algquatelt-algquatelt"></a>
### `x ne y: AlgQuatElt, AlgQuatElt -> BoolElt`

Returns `true` if and only if the elements $x$ and $y$ are not equal.

<a id="operation-op-in-algquatelt-algquat"></a>
### `x in A: AlgQuatElt, AlgQuat -> BoolElt`

Returns `true` if and only if $x$ is in the algebra $A$.

<a id="operation-op-notin-algquatelt-algquat"></a>
### `x notin A: AlgQuatElt, AlgQuat -> BoolElt`

Returns `true` if and only if $x$ is not in the algebra $A$.

<a id="function-conjugate-algquatelt"></a>
### `Conjugate(x): AlgQuatElt -> AlgQuatElt`

<a id="function-conjugate-algquatordelt"></a>
### `Conjugate(x): AlgQuatOrdElt -> AlgQuatOrdElt`

<a id="function-conjugate-algassvordelt"></a>
### `Conjugate(x): AlgAssVOrdElt -> AlgAssVOrdElt`

The conjugate $\bar{x}$ of the element $x$ of a quaternion algebra, defined so that the reduced trace and reduced norm are $\bar{x}+x$ and $\bar{x}x$, respectively.

<a id="function-elementtosequence-algquatelt"></a>
### `ElementToSequence(x): AlgQuatElt -> SeqEnum`

<a id="function-eltseq-algquatelt"></a>
### `Eltseq(x): AlgQuatElt -> SeqEnum`

<a id="function-coordinates-algquatelt"></a>
### `Coordinates(x): AlgQuatElt -> SeqEnum`

Given an element $x$ of a quaternion algebra or order, this function returns the sequence of coordinates of $x$ in terms of the basis of its parent.

<a id="function-norm-algquatelt"></a>
### `Norm(x): AlgQuatElt -> FldElt`

<a id="function-norm-algquatordelt"></a>
### `Norm(x): AlgQuatOrdElt -> RngElt`

The reduced norm ${\rm N}(x)$ of the element $x$ of a quaternion algebra, defined so that the characteristic polynomial for $x$ is $x^2 - {\operatorname{Tr}}(x)x + {\rm N}(x) = 0$, where ${\operatorname{Tr}}(x)$ is the reduced trace.

<a id="function-trace-algquatelt"></a>
### `Trace(x): AlgQuatElt -> FldElt`

<a id="function-trace-algquatordelt"></a>
### `Trace(x): AlgQuatOrdElt -> RngElt`

The reduced trace ${\operatorname{Tr}}(x)$ of the element $x$ of a quaternion algebra, defined so that the characteristic polynomial for $x$ is $x^2 - {\operatorname{Tr}}(x)x + {\rm N}(x) = 0$, where ${\rm N}(x)$ is the reduced norm.

<a id="function-characteristicpolynomial-algquatelt"></a>
### `CharacteristicPolynomial(x): AlgQuatElt -> RngUPolElt`

<a id="function-characteristicpolynomial-algquatordelt"></a>
### `CharacteristicPolynomial(x): AlgQuatOrdElt -> RngUPolElt`

The characteristic polynomial of degree $2$ for the element $x$ of a quaternion algebra over the base ring of its parent.

<a id="function-minimalpolynomial-algquatelt"></a>
### `MinimalPolynomial(x): AlgQuatElt -> RngUPolElt`

The minimal polynomial of degree $1$ or $2$ for the element $x$ of a quaternion algebra over the base ring of its parent.

<a id="example-ex-317c57"></a>
### `Example: Reduced Trace and Norm of an Element (ex-317c57)`

We demonstrate the relation between characteristic polynomial, and reduced trace and norm in the following example.

```magma
> A := QuaternionAlgebra< RationalField() | -17, -271 >;
> x := A![1,-2,3,0];
> Trace(x);
2
> Norm(x);
2508
> x^2 - Trace(x)*x + Norm(x);
0
```

Note that trace and norm of an element $x$ of any algebra can be defined as the trace and norm of the linear operator corresponding to right-multiplication by $x$. The reduced trace and norm in a quaternion algebra $A$ are taken instead to be the corresponding trace and determinant in any two-dimensional matrix representation of $A$, or equivalently, the sum and product of an element with its conjugate. The definition of norm and trace used for a general algebra can be realised in a quaternion algebra by the following code.

```magma
> P<X> := PolynomialRing(RationalField());
> M := RepresentationMatrix(x, A);
> M;
[   1   -2    3    0]
[  34    1    0    3]
[-813    0    1    2]
[   0 -813  -34    1]
> Trace(M);
4
> Factorization(CharacteristicPolynomial(M));
[
    <X^2 - 2*X + 2508, 2>
]
```

The general definition of trace (for the algebra) is twice the reduced trace, and the general definition of norm is the square of the reduced norm.
