# Elements of Quaternion Algebras

For more information about elements of orders of associative algebras, see Section [Orders](../AssociativeAlgebras/alg_ass_ord.md#secalgassvord).

## Creation of Elements

### `A ! 0: AlgQuat, RngIntElt -> AlgQuatElt`

### `Zero(A): AlgQuat -> AlgQuatElt`

The zero element of the quaternion algebra $A$.

### `A ! 1: AlgQuat, RngIntElt -> AlgQuatElt`

### `One(A): AlgQuat -> AlgQuatElt`

The identity element of the quaternion algebra $A$.

### `A . i: AlgQuat, RngIntElt -> AlgQuatElt`

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

### `x + y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

The sum of $x$ and $y$.

### `x - y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

The difference of $x$ and $y$.

### `x * y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

The product of $x$ and $y$.

### `x / y: AlgQuatElt, AlgQuatElt -> AlgQuatElt`

### `x / y: AlgQuatOrdElt, AlgQuatOrdElt -> AlgQuatElt`

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

### `x eq y: AlgQuatElt, AlgQuatElt -> BoolElt`

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

### `x ne y: AlgQuatElt, AlgQuatElt -> BoolElt`

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

### `x in A: AlgQuatElt, AlgQuat -> BoolElt`

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

### `x notin A: AlgQuatElt, AlgQuat -> BoolElt`

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

### `Conjugate(x): AlgQuatElt -> AlgQuatElt`

### `Conjugate(x): AlgQuatOrdElt -> AlgQuatOrdElt`

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

### `ElementToSequence(x): AlgQuatElt -> SeqEnum`

### `Eltseq(x): AlgQuatElt -> SeqEnum`

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

### `Norm(x): AlgQuatElt -> FldElt`

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

### `Trace(x): AlgQuatElt -> FldElt`

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

### `CharacteristicPolynomial(x): AlgQuatElt -> RngUPolElt`

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

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

### `Example: Element Arithmetic (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.
