---
title: "Definition of a Module"
canonical: "https://docs.magma-maths.org/v2.30-1/Modules/FreeModules/creation-module.html"
source: "https://docs.magma-maths.org/v2.30-1/Modules/FreeModules/creation-module.md"
part: "Modules"
chapter: "Free Modules"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Modules", "source": "https://docs.magma-maths.org/v2.30-1/Modules/index-modules.md"}
  - {"title": "Free Modules", "source": "https://docs.magma-maths.org/v2.30-1/Modules/FreeModules/index-free-modules.md"}
prev: {"title": "Introduction", "source": "https://docs.magma-maths.org/v2.30-1/Modules/FreeModules/introduction.md"}
next: {"title": "Accessing Module Information", "source": "https://docs.magma-maths.org/v2.30-1/Modules/FreeModules/access.md"}
intrinsics:
  - {"name": "RSpace", "signature": "RSpace(R, n): Rng, RngIntElt -> ModTupRng"}
  - {"name": "RModule", "signature": "RModule(R, n): Rng, RngIntElt -> ModRng"}
  - {"name": "RSpace", "signature": "RSpace(R, n, F): Rng, RngIntElt, Mtrx -> ModTupRng"}
  - {"name": "RMatrixSpace", "signature": "RMatrixSpace(R, m, n): Rng, RngIntElt, RngIntElt -> ModMatRng"}
  - {"name": "RModuleWithBasis", "signature": "RModuleWithBasis(Q): [ModFldElt] -> ModFld"}
  - {"name": "RSpaceWithBasis", "signature": "RSpaceWithBasis(Q): [ModTupRngElt] -> ModTupRng"}
  - {"name": "RSpaceWithBasis", "signature": "RSpaceWithBasis(a): AlgMatElt -> ModTupRng"}
  - {"name": "RSpaceWithBasis", "signature": "RSpaceWithBasis(a): ModMatRngElt -> ModTupRng"}
  - {"name": "RMatrixSpaceWithBasis", "signature": "RMatrixSpaceWithBasis(Q): [ModTupRngElt] -> ModMatRng"}
examples:
  - "ex-d42492"
---

# Definition of a Module

## Construction of Modules of $n$-tuples

<a id="function-modrng-rspace"></a>
### `RSpace(R, n): Rng, RngIntElt -> ModTupRng`

<a id="function-modrng-rmodule"></a>
### `RModule(R, n): Rng, RngIntElt -> ModRng`

Given a ring $R$ and a non-negative integer $n$, create the free right $R$-module $R^{(n)}$, consisting of all $n$-tuples over $R$. The module is created with the standard basis, $e_1, \ldots, e_n$, where $e_i$ $(i = 1, \ldots, n)$ is the vector containing a $1$ in the $i$-th position and zeros elsewhere. The function `RModule` creates a module in reduced mode while `RSpace` creates a module in embedded mode.

<a id="function-rspace-rng-rngintelt-mtrx"></a>
### `RSpace(R, n, F): Rng, RngIntElt, Mtrx -> ModTupRng`

Given a ring $R$, a non-negative integer $n$, and a square $n \times n$ symmetric matrix $F$, create the free right $R$-module $R^{(n)}$ (in embedded form), with inner product matrix $F$. This is the same as `RSpace(R, n)`, except that the functions `Norm` and `InnerProduct` (see below) will be with respect to the inner product matrix $F$.

<a id="example-ex-d42492"></a>
### `Example: Module of 6-Tuples over the Integers (ex-d42492)`

We construct the module consisting of $6$-tuples over the integers.

```magma
> Z := IntegerRing();
> M := RModule(Z, 6);
> M;
RModule M of dimension 6 with base ring Integer Ring
```

## Construction of Modules of $m \times n$ Matrices

<a id="function-rmatrixspace-rng-rngintelt-rngintelt"></a>
### `RMatrixSpace(R, m, n): Rng, RngIntElt, RngIntElt -> ModMatRng`

The module comprising all $m \times n$ matrices over the ring $R$.

## Construction of a Module with Specified Basis

<a id="function-rmodulewithbasis-modfldelt"></a>
### `RModuleWithBasis(Q): [ModFldElt] -> ModFld`

<a id="function-rspacewithbasis-modtuprngelt"></a>
### `RSpaceWithBasis(Q): [ModTupRngElt] -> ModTupRng`

<a id="function-rspacewithbasis-algmatelt"></a>
### `RSpaceWithBasis(a): AlgMatElt -> ModTupRng`

<a id="function-rspacewithbasis-modmatrngelt"></a>
### `RSpaceWithBasis(a): ModMatRngElt -> ModTupRng`

Given a sequence $Q$ (or matrix $a$) of $k$ independent vectors each lying in a module $M$, construct the submodule of $M$ of dimension $k$ whose basis is $Q$ (or the rows of $a$). The basis is echelonized internally but all functions which depend on the basis of the space (e.g. `Coordinates`) will use the given basis.

<a id="function-rmatrixspacewithbasis-modtuprngelt"></a>
### `RMatrixSpaceWithBasis(Q): [ModTupRngElt] -> ModMatRng`

The module of $m \times n$ matrices whose basis is given by the linearly independent matrices of the sequence $Q$.
