# Hilbert Symbols and Embeddings

Let $A$ be a quaternion algebra over $Q$, ${\mathbb{F}}_q(X)$ (with $q$ odd) or a number field $F$ with defining elements $a,b$, and let $v$ be a place of $F$. If $v$ is unramified in $A$ (i.e. $A \otimes_F F_v \cong M_2(F_v)$, we define the *Hilbert symbol* $(a,b)_v$ to be $1$, and otherwise we define $(a,b)_v=-1$.

## `HilbertSymbol(a, b, p): FldRatElt, FldRatElt, RngIntElt -> RngIntElt`

## `HilbertSymbol(a, b, p): FldFunRatElt, FldFunRatElt, RngElt p -> RngIntElt`

## `HilbertSymbol(a, b, p): FldNumElt, FldNumElt, RngOrdIdl -> RngIntElt`

## `HilbertSymbol(A, p): AlgQuat[FldRat], RngIntElt -> RngIntElt`

## `HilbertSymbol(A, p): AlgQuat[FldFunRat], RngElt -> RngIntElt`

## `HilbertSymbol(A, p): AlgQuat, RngOrdIdl -> RngIntElt`

```magma
Al: MonStgElt                    Default: "NormResidueSymbol"
```

Computes the Hilbert symbol for the quaternion algebra $A$ over $F$, namely $(a,b)_p$, where $a,b \in F$ and $p$ is either a prime (if $a,b \in {\mathbb{Q}}$ or ${\mathbb{F}}_q(X)$) or a prime ideal. If $a,b \in {\mathbb{Q}}$, by default table-lookup is used to compute the Hilbert symbol; one can optionally insist on using the full algorithm by setting the parameter `Al` to the value `"Evaluate"`.

## `IsRamified(p, A): RngElt, AlgQuat -> BoolElt`

## `IsUnramified(p, A): RngElt, AlgQuat -> BoolElt`

## `IsRamified(p, A): RngUPol, AlgQuat[FldFunRat] -> BoolElt`

## `IsUnramified(p, A): RngUPol, AlgQuat[FldFunRat] -> BoolElt`

## `IsRamified(p, A): RngOrdIdl, AlgQuat[FldAlg] -> BoolElt`

## `IsUnramified(p, A): RngOrdIdl, AlgQuat[FldAlg] -> BoolElt`

Returns `true` if and only if the prime or prime ideal $p$ is ramified (unramified) in the quaternion algebra $A$.

## `Example: Hilbert Symbols (ex-9d678c)`

We first verify the correctness of all Hilbert symbols over the rationals.

```magma
> QQ := Rationals();
> for a,b in [1..8] do
>   bl := HilbertSymbol(QQ ! a, QQ ! b,2 : Al := "Evaluate")
>                eq NormResidueSymbol(a,b,2);
>   print <a,b,bl>;
>   if not bl then
>     break a;
>   end if;
> end for;
<1, 1, true>
<1, 2, true>
<1, 3, true>
...

```

For a second test, we input a quaternion algebra which is unramified at all finite places.

```magma
> P<x> := PolynomialRing(Rationals());
> F<b> := NumberField(x^3-3*x-1);
> Z_F := MaximalOrder(F);
> A := QuaternionAlgebra<F | -3,b>;
> symbols := [];
> for p in [p : p in [2..100] | IsPrime(p)] do
>   pps := Decomposition(Z_F,p);
>   for pp in pps do
>     Append(~symbols,HilbertSymbol(A,pp[1]));
>   end for;
> end for;
> symbols;
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]

```

Finally, we test “random” quaternion algebras over quadratic extensions at even primes, the hardest case. We use the fact that the quaternion algebra $(a,b)$ is ramified at a prime ideal $p$ if and only if $b$ is a norm from the extension $F(\sqrt{a})$, so we can test this condition using `IsLocalNorm`. Note that this takes substantially more time.

```magma
> for c in [2,-2,6,-6,-1,3,-3] do
>   K<s> := NumberField(x^2-c);
>   Z_K := MaximalOrder(K);
>   Z_Kmod8, f8 := quo<Z_K | 8>;
>   PPK<xK> := PolynomialRing(K);
>   for i := 1 to 10 do
>     S := [x+y*Z_K.2 : x,y in [0..7] | x*y ne 0];
>     a := Random(S);
>     b := Random(S);
>     A := QuaternionAlgebra<K | a,b>;
>     for pp in Decomposition(Z_K,2) do
>       hsym := HilbertSymbol(A,pp[1]);
>       if not IsIrreducible(xK^2-a) then
>         print <c, a, b, hsym eq 1>;
>         if hsym ne 1 then
>           break c;
>         end if;
>       else
>         lclsym := IsLocalNorm(AbelianExtension(ext<K | xK^2-a>),Z_K ! b,pp[1]);
>         bl := (hsym eq 1) eq lclsym;
>         print <c, a, b, bl>;
>         if not bl then
>           break c;
>         end if;
>       end if;
>     end for;
>   end for;
> end for;
<2, 5/1*Z_K.1 + 3/1*Z_K.2, Z_K.1 + 7/1*Z_K.2, true>
<2, 6/1*Z_K.1 + 4/1*Z_K.2, 4/1*Z_K.1 + Z_K.2, true>
<2, 7/1*Z_K.1 + Z_K.2, 2/1*Z_K.1 + 2/1*Z_K.2, true>
...

```

## `pMatrixRing(A, p): AlgQuat, RngOrdIdl -> AlgMat, Map, Map`

## `pMatrixRing(A, p): AlgQuat, RngElt -> AlgMat, Map, Map`

## `pMatrixRing(O, p): AlgAssVOrd, RngOrdIdl -> AlgMat, Map, Map`

## `pMatrixRing(O, p): AlgQuatOrd, RngElt -> AlgMat, Map, Map`

## `pMatrixRing(O, p): AlgQuatOrd[RngInt], RngInt -> AlgMat, Map, Map`

```magma
Precision: RngIntElt                    Default: 
```

Let $A$ be a quaternion algebra $A$ over a field $F$ where $F$ is the rationals, a number field or ${\mathbb{F}}_q(x)$ with $q$ odd. Given $A$ and a prime (ideal) p of the ring of integers $R$ of $F$ such that $p$ is unramified in $A$, this function returns the matrix ring over the completion $F_p$ of $F$ at $p$, a map from $A \to M_2(F_p)$ and the embedding $F \to F_p$.

Given a $p$-maximal order $O$ in $A$, the map from $A \to M_2(F_p)$ induces a map from $O \to <Meta>-_2(R_p)$.

## `IsSplittingField(K, A): Fld, AlgQuat -> BoolElt, AlgQuatElt, Map`

## `HasEmbedding(K, A): Fld, AlgQuat -> BoolElt, AlgQuatElt, Map`

```magma
ComputeEmbedding: BoolElt                    Default: false
```

Given a quaternion algebra $A$ defined over ${\mathbb{Q}}$, ${\mathbb{F}}_q(X)$ (with $q$ odd) or a number field $F$ and $K$ a quadratic extension of $F$, the function returns `true` if and only if there exists an embedding $K \to A$ over $F$. This is done by comparison of ramified places in $K$ and $A$ (see [[Vignéras, 1980](../../references.md#cite-vigneras80), Cor. III.3.5]). If no embedding exists, the second return value will be a witness place. If an embedding exists and the optional argument `ComputeEmbedding` is set to `true`, the second and third return values contain the result of a call to `Embed` as described below.

## `Embed(K, A): Fld, AlgQuat -> AlgQuatElt, Map`

```magma
Al: MonStgElt                    Default: "NormEquation"
```

Given a quaternion algebra $A$ defined over ${\mathbb{Q}}$, ${\mathbb{F}}_q(X)$ (with $q$ odd) or a number field $F$ and $K$ a quadratic extension of $F$, returns an embedding $K \to A$ over $F$, given as an element of $A$, the image of the primitive generator of $K$, and the map $K \to A$.

The algorithm by default involves solving a relative norm equation. Alternatively, a naive search algorithm may be selected by setting the optional parameter `Al:="Search"`.

If there is no embedding, a runtime error occurs (or the `"Search"` runs forever). To check whether an embedding exists, use `HasEmbedding` (see immediately above).

## `Embed(Oc, O): RngOrd, AlgAssVOrd -> AlgAssVOrdElt, Map`

```magma
Al: MonStgElt                    Default: "NormEquation"
```

Given a quadratic order $O_c$ with base number ring $R$ and a quaternion order $O$ with base ring $R$, the function computes an embedding $O_c \hookrightarrow O$ over $R$. It returns the image of the second generator `Oc.2` of `Oc`; secondly it returns the embedding map $O_c \to O$.

The algorithm by default involves solving a relative norm equation. Alternatively, a naive search algorithm may be selected by setting the optional parameter `Al:="Search"`.

*Notes.* Let $K$ be the number field containing $Oc$.

*(i)* `Oc.1, Oc.2` are the generators of $Oc$ as a module, and `Oc.2` is unrelated to `K.1`, where $K$ is the number field containing $Oc$.

*(ii)* To check whether an embedding of $K$ into the algebra exists, one can use `HasEmbedding(K, Algebra(O) : ComputeEmbedding:=false`).

## `Example: Embed (ex-06ae1e)`

```magma
> F<b> := NumberField(Polynomial([1,-3,0,1]));
> A := QuaternionAlgebra<F | -3, b>;
> K := ext<F | Polynomial([2,-1,1])>;
> mu, iota := Embed(K, A);
> mu;
1/2 + 1/6*(-2*b^2 + 2*b + 7)*i + 1/2*(2*b^2 + b - 6)*j + 1/6*(-2*b^2 - b + 4)*k
> MinimalPolynomial(mu);
$.1^2 - $.1 + 2
> iota(K.1) eq mu;
true

```
