# Constructing Polar Spaces

If $J$ is an $n\times n$ matrix, the command `VectorSpace(K,n,J)` creates a vector space of dimension $n$ over $K$ with a bilinear form whose matrix is $J$.

The default form attached to every vector space in Magma is the symmetric form whose matrix is the identity matrix.

A vector space $V$ is recognised as a polar space if any of the following conditions apply. (There is no check to ensure that the inner product matrix is is non-degenerate.)

1.There is a quadratic form attached to $V$.

2.There is a field involution attached to $V$ and the inner product matrix of $V$ is hermitian or skew-hermitian with respect to this involution.

3.The inner product matrix of $V$ is symmetric or alternating.

Thus a vector space with a symmetric inner product matrix but no quadratic form attached is a polar space. If the characteristic of the field is 2 and the form is not alternating it is a pseudo-symplectic space, otherwise we shall call it an orthogonal space to distinguish it from quadratic spaces.

## `PolarSpace(F, a): AlgMatElt[FldFin], FldAut -> ModTupFld[FldFin]`

```magma
Symbolic: BoolElt                    Default: true
```

The polar space associated to the Gram matrix $F$, hermitian with repsect to the field automorphism $a$. `Symbolic` determines the method of finding isotropic subspaces.

## `TrivialPolarSpace(F, n): FldFin, RngIntElt -> ModTupFld[FldFin]`

Polar space over $F$ of dimension $n$ with the zero bilinear form.

## `IsPolarSpace(V): ModTupFld -> BoolElt`

Check if the vector space $V$ is a quadratic space or if the Gram matrix of $V$ is a reflexive form.

## `PolarSpaceType(V): ModTupFld -> MonStgElt`

The type of the polar space $V$, returned as a string.

## `Example: polarspace (ex-1d3f36)`

Create the standard vector space of dimension 4 over the rational field and check if it is a polar space.

```magma
> V := VectorSpace(Rationals(),4);
> IsPolarSpace(V);
true
> PolarSpaceType(V);
orthogonal space

```

## Isotropic Subspaces

### `FirstIsotropicSubspace(V, k): ModTupFld[FldFin], RngIntElt -> ModTupFld[FldFin]`

Starts an enumeration process of $k$-dimensional isotropic subspaces in $V$, and returns the first non-singular one.

### `NextIsotropicSubspace(V, k): ModTupFld[FldFin], RngIntElt -> ModTupFld[FldFin]`

The next $k$-dimensional isotropic subspace in $V$.

### `AllIsotropicSubspaces(V, k): ModTupFld[FldFin], RngIntElt -> [ ModTupFld[FldFin] ]`

All $k$-dimensional isotropic subspaces in $V$.

### `NumberOfIsotropicSubspaces(V, k): ModTupFld[FldFin], RngIntElt -> RngIntElt`

The number of $k$-dimensional isotropic subspaces in $V$.

## Symplectic Spaces

### `SymplecticSpace(J): AlgMatElt -> ModTupRng`

The symplectic space of dimension $n$ defined by the $n\times n$ matrix $J$. This function checks to ensure that $J$ is alternating.

The symplectic inner product on this space is obtained from `InnerProduct`, which evaluates the alternating form $J$ and returns a value in the base ring. This is distinct from the intrinsic `SymplecticInnerProduct` described in Chapter [Quantum Codes](../../CodingTheory/QuantumCodes/index-quantum-codes.md#chap-codequantum): that intrinsic computes the coding-theory product $(a|b)*(c|d) = ad - bc$ in compact or extended format and returns its field trace down to the prime field (see that chapter for the precise source field of the trace in each format).

### `IsSymplecticSpace(W): ModTupFld -> BoolElt`

Returns `true` if the `Involution` attribute of the generic vector space $W$ is not assigned and the space carries an alternating form, otherwise `false`.

Note that a quadratic space over a field of characteristic 2 satisfies these conditions and consequently this function will return `true` for these spaces.

### `IsPseudoSymplecticSpace(W): ModTupFld -> BoolElt`

Given a vector space $W$ over a finite field, this intrinsic returns `true` if the base field has characteristic 2, the `Involution` attribute is not assigned to the generic space and the form is symmetric but not alternating, otherwise `false`.

### `DirectSum(V, W): ModTupRng, ModTupRng -> ModTupRng, Map, Map`

If $V$ and $W$ are symplectic spaces this function returns the orthogonal direct sum $V\perp W$ and linear embeddings $V \to V\perp W$ and $W \to V\perp W$.

## Unitary Spaces

In order to accommodate hermitian forms it is necessary to assign a field automorphism of order two to the `Involution` attribute of the vector space.

Thus a unitary space is characterised as a vector space $V$ whose ambient space, `Generic(V)`, has the attribute `Involution` and whose inner product matrix is either hermitian or skew hermitian.

### `UnitarySpace(J, sigma): AlgMatElt, Map -> ModTupFld`

The $n$-dimensional unitary space over the base field $K$ of $J$, where $\sigma$ is an automorphism of $K$ of order 2 and where $J$ is an $n \times n$ matrix which is hermitian or skew-hermitian with respect to $\sigma$.

### `IsUnitarySpace(W): ModTupFld -> BoolElt, RngIntElt`

Return `true` if the `Involution` attribute of the generic space of $W$ is assigned and the form is either hermitian or skew-hermitian when restricted to $W$. The second return value is $1$ if the form is hermitian and $-1$ if the form is skew-hermitian.

### `Example: unitaryform (ex-b9c1f1)`

Create a unitary geometry with the standard hermitian form and check that the given vector is isotropic. Note that the function `DotProduct` takes both the form and the field involution into account when calculating its values. For finite fields, the function `InnerProduct` *ignores* the field involution.

```magma
> K<z> := GF(25);
> J, sigma := StandardHermitianForm(5,K);
> J;
[   0    0    0    0    1]
[   0    0    0    1    0]
[   0    0    1    0    0]
[   0    1    0    0    0]
[   1    0    0    0    0]
> sigma(z);
z^5
> V := UnitarySpace(J,sigma);
> u := V![1,z,0,z^2,-1];
> DotProduct(u,u);
0
> InnerProduct(u,u);
z^20

```

### `ConjugateTranspose(M, sigma): Mtrx, Map -> Mtrx`

The transpose of the matrix $\sigma(M)$, where $\sigma$ is an automorphism of the base field of the matrix $M$.

## Quadratic Spaces

A vector space $V$ with an attached quadratic form is called a *quadratic space*. The polar form of a quadratic space is the inner product matrix $J$ of the space. If the characteristic of the field is not 2, the value of the quadratic form on a row vector $v$ is ${1\over 2}{v*J*v^\mathrm{tr}}$.

### `QuadraticSpace(Q): AlgMatElt -> ModTupRng`

The quadratic space of dimension $n$ defined by the quadratic form represented by an $n\times n$ matrix $Q$. The inner product matrix of the space is $Q + Q^\mathrm{tr}$.

### `QuadraticSpace(f): RngMPolElt -> ModTupRng`

The quadratic space of dimension $n$ whose quadratic form is given by the quadratic polynomial $f$ in $n$ variables. If the variables are $x_1$, …, $x_n$, then for $i\le j$, the $(i,j)$-th entry of the matrix of the form is the coefficient of $x_ix_j$ in $f$.

### `SymmetricToQuadraticForm(J): AlgMatElt -> AlgMatElt`

Provided the characteristic of the field is not two, this is the upper triangular matrix which represents the quadratic form whose polar form is the symmetric matrix $J$.

### `QuadraticFormMatrix(V): ModTupRng -> ModAlgElt`

The matrix which defines the quadratic form of the quadratic space $V$.

### `QuadraticNorm(v): ModTupFldElt -> FldElt`

The value $Q(v)$, where $Q$ is the quadratic form attached to the generic space of the parent of the vector $v$.

### `QuadraticFormPolynomial(V): ModTupRng -> RngPolElt`

The polynomial $\sum_{i, j} q_{ij}x_ix_j$, where $Q = (q_{ij})$ is the matrix of the quadratic form of the quadratic space $V$.

### `QuadraticFormPolynomial(Q): AlgMatElt -> RngPolElt`

The polynomial $\sum_{i, j} q_{ij}x_ix_j$, where $Q = (q_{ij})$ is a matrix representing a quadratic form.

### `Example: polyquad (ex-474785)`

The quadratic space defined by a polynomial.

```magma
> _<x,y,z> := PolynomialRing(Rationals(),3);
> f := x^2 + x*y +3*x*z - 2*y*z + y^2 +z^2;
> V := QuadraticSpace(f);
> PolarSpaceType(V);
quadratic space
> IsNonsingular(V);
true
> QuadraticFormMatrix(V);
[ 1  1  3]
[ 0  1 -2]
[ 0  0  1]

```

### `OrthogonalSum(V, W): ModTupFld, ModTupFld -> ModTupFld, Map, Map`

The orthogonal direct sum $V$ of the quadratic spaces $V$ and $W$ together with linear embeddings $V \to V\perp W$ and $W \to V\perp W$.

### `OrthogonalTensorProduct(V, W): ModTupFld, ModTupFld -> ModTupFld`

The tensor product of the quadratic spaces $V$ and $W$. If $\beta$ and $\gamma$ are the symmetric bilinear forms on $V$ and $W$, respectively, and if $\xi$ is the bilinear form on the tensor product, then $\xi(v_1\otimes w_1,v_2\otimes w_2) = \beta(v_1,v_2)\gamma(w_1,w_2)$.

### `TotallySingularComplement(V, U, W): ModTupFld, ModTupFld, ModTupFld -> ModTupFld`

Given totally singular subspaces $U$ and $W$ of the quadratic space $V$ such that $U^\perp \cap W = 0$ this function returns a totally singular subspace $X$ such that $V = X \oplus U^\perp$ and $W\subseteq X$.

### `Discriminant(V): ModTupFld -> RngIntElt`

If $V$ is a vector space over the finite field $K$ and if $J$ is the Gram matrix of $V$, the *discriminant* of $V$ is the determinant $\Delta$ of $J$ modulo squares. That is, the discriminant is 0 if $\Delta$ is a square in $K$, 1 if it is a non-square. The form $J$ is required to be non-degenerate.

### `ArfInvariant(V): ModTupFld -> RngIntElt`

The Arf invariant of the quadratic space $V$.

Currently this is available only for quadratic spaces of even dimension $2m$ over a finite field $F$ of characteristic 2. In this case there are two possibilities: either the Witt index of the form is $m$ and the Arf invariant is 0, or the Witt index is $m-1$ and the Arf invariant is 1.

### `DicksonInvariant(V, f): ModTupFld, Mtrx -> RngIntElt`

The Dickson invariant of the isometry $f$ of the quadratic space $V$ is the rank (mod 2) of $1-f$. If the polar form of $Q$ is non-degenerate, the Dickson invariant defines a homomorphism from the orthogonal group $O(V)$ onto the additive group of order 2.

### `SpinorNorm(V, f): ModTupFld, Mtrx -> RngIntElt`

The spinor norm of the isometry $f$ of the quadratic space $V$. This is the discriminant of the Wall form (Section [Wall Forms](wallform.md#sectwall)) of $f$.

### `SpinorNorm(Q, g): AlgMatElt[Fld], AlgMatElt[Fld] -> FldElt`

Given a symmetric matrix $Q$ over a field $F$, and a matrix $g$ satisfying $gQg^\mathrm{tr}= Q$, returns an element $x \in F$ representing in $F / F^{\times 2}$ the spinor norm of the isometry $g$ with repsect to the quadratic form represented by $Q$.

### `Example: Spinor General (ex-ff51ba)`

An example for a spinor norm computation over a general field.

```magma
> Q := SymmetricMatrix(Rationals(), [2,0,2,0,0,2,1,0,0,2,0,0,1,1,52]);
> g := Matrix(Rationals(), 5, 5,
>                    [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,-1,0,0,0,1,0,-1]);
> g * Q * Transpose(g) eq Q;
true
> SpinorNorm(Q,g);
2745
> FactorizationOfQuotient(SpinorNorm(Q, g));
[ <3, 2>, <5, 1>, <61, 1> ]

```

### `CharacterQQModSquares(d, r): RngIntElt, FldRatElt -> RngIntElt`

Let $\chi_d : {\mathbb{Q}}^{\times} / {\mathbb{Q}}^{\times 2} \to {\mathbb{Z}}^{\times}$ be the multiplicative character defined by $\chi_d(p) = -1$ iff $p \mid d$. Returns $\chi_d(r)$.

### `SpinorNormRho(d, g, Q): RngIntElt, GrpMatElt, AlgMatElt -> RngIntElt`

Let $Q$ be an integral symmetric matrix, $g$ an isometry of the quadratic space, and $d \mid {\rm Disc}(Q)$. Returns the value of $\chi_d$ (as in `CharacterQQModSquares`) at the spinor norm of $g$ with respect to ${\rm O}(Q)$.

### `HyperbolicBasis(U, B, W): ModTupFld, SeqEnum, ModTupFld -> SeqEnum`

Given complementary totally singular subspaces $U$ and $W$ of a quadratic space and a basis $B$ for $U$, return a sequence of pairwise orthogonal hyperbolic pairs whose second components form a basis for $W$.

### `OrthogonalReflection(a): ModTupFldElt -> AlgMatElt`

The reflection determined by a non-singular vector of a quadratic space.

### `RootSequence(V, f): ModTupFld, Mtrx -> SeqEnum`

Given a matrix $f$ representing an isometry of the quadratic space $V$, return a sequence of vectors such that the product of the corresponding orthogonal reflections is $f$. The empty sequence is returned if $f$ is the identity matrix.

### `ReflectionFactors(V, f): ModTupFld, Mtrx -> SeqEnum`

Given a matrix $f$ representing an isometry of the quadratic space $V$, return a sequence of reflections whose product is $f$. The empty sequence corresponds to the identity matrix.

Given a quadratic space $V$ defined by a quadratic form $Q$ with polar form $\beta$ and non-zero vectors $u,v \in V$ such that $u$ is singular and $\beta(u,v) = 0$, the *Siegel transformation* (also called an Eichler transformation) is the isometry $\rho_{u,v}$ defined by

$$
x \rho_{u,v} = x + \beta(x,v)u - \beta(x,u)v - Q(v)\beta(x,u) u.
$$

### `SiegelTransformation(u, v): ModTupFldElt, ModTupFldElt -> AlgMatElt`

The Siegel transformation defined by a singular vector $u$ and a vector $v$ orthogonal to $u$. The common parent of $u$ and $v$ must be a quadratic space.

### `Example: siegel (ex-717e94)`

A group of isometries generated by Siegel transformations.

```magma
> Q := StandardQuadraticForm(4,3);
> V := QuadraticSpace(Q);
> u := V.1;
> QuadraticNorm(u);
0
> X := { v : v in V | DotProduct(u,v) eq 0 and QuadraticNorm(v) ne 0 };
> #X;
12
> H := sub< GL(V) | [SiegelTransformation(u,v) : v in X]>;
> #H;
9

```
