# Subspaces, Quotient Spaces and Homomorphisms

## Construction of Subspaces

The conventions defining the presentations of subspaces and quotient spaces are as follows:

**•**
If $V$ has been created using the function `VectorSpace` or `MatrixSpace`, then every subspace and quotient space of $V$ is given in terms of a basis consisting of elements of $V$, i.e. by means of an embedded basis.

**•**
If $V$ has been created using the function `RModule`, then every subspace and quotient space of $V$ is given in terms of a reduced basis.

### `sub<V | L>: ModTupFld, List -> ModTupFld`

Given a $K$-vector space $V$, construct the subspace $U$ generated by the elements of $V$ specified by the list $L$. Each term $L_i$ of the list $L$ must be an expression defining an object of one of the following types:

**(a)**
A sequence of $n$ elements of $K$ defining an element of $V$;

**(b)**
A set or sequence whose terms are elements of $V$;

**(c)**
A subspace of $V$;

**(d)**
A set or sequence whose terms are subspaces of $V$.

The generators stored for $U$ consist of the vectors specified by terms $L_i$ together with the stored generators for subspaces specified by terms of $L_i$. Repetitions of a vector and occurrences of the zero vector are removed (unless $U$ is the trivial subspace).

The constructor returns the subspace $U$ and the inclusion homomorphism $f : U \rightarrow V$. If $V$ is of embedded type, the basis constructed for $U$ consists of elements of $V$. If $V$ is of standard type, a standard basis is constructed for $U$.

### `Morphism(U, V): ModTupFld, ModTupFld -> RModMatElt`

Assuming the vector space $U$ has been created as a subspace of $V$, the function returns the matrix defining the embedding of $U$ into $V$.

### `Example: Subspace1 (ex-466045)`

The ternary Golay code is a six-dimensional subspace of the vector space $K^{(11)}$, where $K$ is ${\bf F}_{3}$. This subspace is first constructed in the space constructed by the `VectorSpace` function.

```magma
> K11 := VectorSpace(FiniteField(3), 11);
> G3 := sub< K11  |
>     [1,0,0,0,0,0,1,1,1,1,1], [0,1,0,0,0,0,0,1,2,2,1],
>     [0,0,1,0,0,0,1,0,1,2,2], [0,0,0,1,0,0,2,1,0,1,2],
>     [0,0,0,0,1,0,2,2,1,0,1], [0,0,0,0,0,1,1,2,2,1,0] >;
> G3;
Vector space of degree 11, dimension 6 over GF(3)
Generators:
(1 0 0 0 0 0 1 1 1 1 1)
(0 1 0 0 0 0 0 1 2 2 1)
(0 0 1 0 0 0 1 0 1 2 2)
(0 0 0 1 0 0 2 1 0 1 2)
(0 0 0 0 1 0 2 2 1 0 1)
(0 0 0 0 0 1 1 2 2 1 0)
Echelonized basis:
(1 0 0 0 0 0 1 1 1 1 1)
(0 1 0 0 0 0 0 1 2 2 1)
(0 0 1 0 0 0 1 0 1 2 2)
(0 0 0 1 0 0 2 1 0 1 2)
(0 0 0 0 1 0 2 2 1 0 1)
(0 0 0 0 0 1 1 2 2 1 0)

```

### `Example: Subspace2 (ex-1f57d1)`

We now construct the ternary Golay code starting with the vector space constructed using the `RModule` function. In this case the subspace is presented on a reduced basis.

```magma
> K11 := RModule(FiniteField(3), 11);
> G3 := sub< K11 |
>     [1,0,0,0,0,0,1,1,1,1,1], [0,1,0,0,0,0,0,1,2,2,1],
>     [0,0,1,0,0,0,1,0,1,2,2], [0,0,0,1,0,0,2,1,0,1,2],
>     [0,0,0,0,1,0,2,2,1,0,1], [0,0,0,0,0,1,1,2,2,1,0] >;
> G3;
KModule G3 of dimension 6 with base ring GF(3)
> Basis(G3);

[
    G3: (1 0 0 0 0 0),
    G3: (0 1 0 0 0 0),
    G3: (0 0 1 0 0 0),
    G3: (0 0 0 1 0 0),
    G3: (0 0 0 0 1 0),
    G3: (0 0 0 0 0 1)
]
> f := Morphism(G3, K11);
> f;
[1 0 0 0 0 0 1 1 1 1 1]
[0 1 0 0 0 0 0 1 2 2 1]
[0 0 1 0 0 0 1 0 1 2 2]
[0 0 0 1 0 0 2 1 0 1 2]
[0 0 0 0 1 0 2 2 1 0 1]
[0 0 0 0 0 1 1 2 2 1 0]

```

## Construction of Quotient Vector Spaces

### `quo<V | L>: ModTupFld, List -> ModTupFld, Map`

Given a $K$-vector space $V$, construct the quotient vector space $W = V/U$, where $U$ is the subspace generated by the elements of $V$ specified by the list $L$. Each term $L_i$ of the list $L$ must be an expression defining an object of one of the following types:

**(a)**
A sequence of $n$ elements of $K$ defining an element of $V$;

**(b)**
A set or sequence whose terms are elements of $V$;

**(c)**
A subspace of $V$;

**(d)**
A set or sequence whose terms are subspaces of $V$.

The generators constructed for $U$ consist of the elements specified by terms $L_i$ together with the stored generators for subspaces specified by terms of $L_i$.

The constructor returns the quotient space $W$ and the natural homomorphism $f : V \rightarrow W$.

### `V / U: ModTupFld, ModTupFld -> ModTupFld, Map`

Given a subspace $U$ of the vector space $V$, construct the quotient space $W$ of $V$ by $U$. If $r$ is defined to be $\dim(V) - \dim(U)$, then $W$ is created as an $r$-dimensional vector space relative to the standard basis.

The constructor returns the quotient space $W$ and the natural homomorphism $f : V \rightarrow W$.

### `Example: Quotients1 (ex-4d668d)`

We construct the quotient of $K^{(11)}$ by the Golay code.

```magma
> K11 := VectorSpace(FiniteField(3), 11);
> Q3, f := quo< K11 |
>  [1,0,0,0,0,0,1,1,1,1,1], [0,1,0,0,0,0,0,1,2,2,1],
>  [0,0,1,0,0,0,1,0,1,2,2], [0,0,0,1,0,0,2,1,0,1,2],
>  [0,0,0,0,1,0,2,2,1,0,1], [0,0,0,0,0,1,1,2,2,1,0] >;
> Q3;
Full Vector space of degree 5 over GF(3)
> f;
Mapping from: ModTupFld: K11 to ModTupFld: Q3

```

### `Example: Quotients2 (ex-e0a05b)`

If we wished to construct this quotient of $K^{(11)}$ as a subspace of the original space, we could do so using the `Complement` function.

```magma
> K11 := VectorSpace(FiniteField(3), 11);
> S := sub< K11 |
>     [1,0,0,0,0,0,1,1,1,1,1], [0,1,0,0,0,0,0,1,2,2,1],
>     [0,0,1,0,0,0,1,0,1,2,2], [0,0,0,1,0,0,2,1,0,1,2],
>     [0,0,0,0,1,0,2,2,1,0,1], [0,0,0,0,0,1,1,2,2,1,0] >;
> Complement(K11, S);
Vector space of degree 11, dimension 5 over GF(3)
Echelonized basis:
(0 0 0 0 0 0 1 0 0 0 0)
(0 0 0 0 0 0 0 1 0 0 0)
(0 0 0 0 0 0 0 0 1 0 0)
(0 0 0 0 0 0 0 0 0 1 0)
(0 0 0 0 0 0 0 0 0 0 1)

```

### `Example: Quotients3 (ex-aceeb2)`

We construct a subspace and its quotient space in ${\mathbb{Q}}^{(3 \times 4)}$.

```magma
> Q := RationalField();
> Q3 := VectorSpace(Q, 3);
> Q4 := VectorSpace(Q, 4);
> H34 := Hom(Q3, Q4);
> a := H34 ! [ 2, 0, 1, -1/2,  1, 0, 3/2, 4,  4/5, 6/7, 0, -1/3];
> b := H34 ! [ 1/2, -3, 0, 5,  1/3, 2, 4/5, 0,  5, -1, 5, 7];
> c := H34 ! [ -1, 4/9, 1, -4,  5, -5/6, -3/2, 0,  4/3, 7, 0, 7/9];
> d := H34 ! [ -3, 5, 1/3, -1/2,  2/3, 4, -2, 0,  0, 4, -1, 0];
> a, b, c, d;
[   2    0    1 -1/2]
[   1    0  3/2    4]
[ 4/5  6/7    0 -1/3]

[1/2  -3   0   5]
[1/3   2 4/5   0]
[  5  -1   5   7]

[  -1  4/9    1   -4]
[   5 -5/6 -3/2    0]
[ 4/3    7    0  7/9]

[  -3    5  1/3 -1/2]
[ 2/3    4   -2    0]
[   0    4   -1    0]
> U := sub< H34 | a, b, c, d >;
> U:Maximal;
KMatrixSpace of 3 by 4 GHom matrices and dimension 4 over Rational Field
Echelonized basis:

[1    0    0    0]
[-33872/30351    -5164/10117    42559/50585    11560/10117]
[-10514/10117    -121582/70819    -8476/10117    -48292/30351]

[           0            1            0            0]
[ -7797/10117   4803/10117 12861/101170   5940/10117]
[ -7818/10117 -38214/70819  -7821/10117 -10967/10117]

[           0            0            1            0]
[ 31261/10117  28101/20234  -2157/20234  18552/10117]
[161802/50585 291399/70819  20088/10117  33419/10117]

[          0           0           0           1]
[-8624/30351  7445/10117  7696/50585  2408/10117]
[32388/50585 -3562/10117  6272/10117 27580/30351]
> W := H34/U;
> W;
Full Vector space of degree 8 over Rational Field

```
