---
title: "Module Operations"
canonical: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/ModulesOverMultivariateRings/operations.html"
source: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/ModulesOverMultivariateRings/operations.md"
part: "Commutative Algebra"
chapter: "Modules over Multivariate Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Commutative Algebra", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/index-commutative-algebra.md"}
  - {"title": "Modules over Multivariate Rings", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/ModulesOverMultivariateRings/index-modules-over-multivariate-rings.md"}
prev: {"title": "Predicates", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/ModulesOverMultivariateRings/predicates.md"}
next: {"title": "Changing Ring", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/ModulesOverMultivariateRings/change-ring.md"}
intrinsics:
  - {"name": "MinimalBasis", "signature": "MinimalBasis(M): ModMPol -> [ ModMPolElt ]"}
  - {"name": "MinimalBasis", "signature": "MinimalBasis(S): [ ModMPolElt ] -> [ ModMPolElt ]"}
  - {"name": "MinimalBasis", "signature": "MinimalBasis(S): { ModMPolElt } -> [ ModMPolElt ]"}
  - {"name": "Rank", "signature": "Rank(M): ModMPol -> RngIntElt"}
  - {"name": "ColonModule", "signature": "ColonModule(M, J): ModMPol, RngMPol -> ModMPol"}
  - {"name": "ColonIdeal", "signature": "ColonIdeal(M, N): ModMPol, ModMPol -> RngMPol"}
  - {"name": "Annihilator", "signature": "Annihilator(M): ModMPol -> RngMPol"}
  - {"name": "FittingIdeal", "signature": "FittingIdeal(M, i): ModMPol, RngIntElt -> RngMPol"}
  - {"name": "FittingIdeals", "signature": "FittingIdeals(M): ModMPol -> RngMPol"}
  - {"name": "SyzygyModule", "signature": "SyzygyModule(M): ModMPol -> [ ModMPolElt ]"}
  - {"name": "MinimalSyzygyModule", "signature": "MinimalSyzygyModule(M): ModMPol -> [ ModMPolElt ]"}
  - {"name": "SyzygyModule", "signature": "SyzygyModule(Q): [ RngMPolElt ] -> ModTupRng"}
examples:
  - "ex-e30655"
---

# Module Operations

The following functions perform some fundamental module operations.

<a id="function-minimalbasis-modmpol"></a>
## `MinimalBasis(M): ModMPol -> [ ModMPolElt ]`

Given an $R$-module $M$, return a minimal basis $B$ of $M$. If $M$ is graded, or if $R$ is a local ring, then the cardinality of $B$ (the rank) is guaranteed to be unique (so is the absolutely minimal number of elements needed to generate $M$).

Otherwise the cardinality of $B$ is not unique: $B$ will only satisfy the rule that the $i$-th element of $B$ is not in the submodule generated by elements $1$ to $i-1$ of $B$.

In the graded case or local cases, a minimal basis is computed in the usual way starting from any basis $B$ consisting of homogeneous elements. $B$ gives a particular presentation whose relation matrix $R$ consists of homogeneous polynomials. If $R$ contains a non-zero constant term (or more generally a unit in the local case), an element of $B$ can be eliminated and $R$ recalculated. This can be continued until all non-zero terms of $R$ have positive degree.

<a id="function-minimalbasis-modmpolelt"></a>
## `MinimalBasis(S): [ ModMPolElt ] -> [ ModMPolElt ]`

<a id="function-minimalbasis-modmpolelt-2"></a>
## `MinimalBasis(S): { ModMPolElt } -> [ ModMPolElt ]`

Given a set or sequence $S$ of homogeneous module elements from a module $M$, return a minimal basis of the submodule of $M$ generated by $S$.

<a id="function-pmod-rank"></a>
## `Rank(M): ModMPol -> RngIntElt`

Given an $R$-module $M$, return the rank of $M$. This is simply defined to be the cardinality of the minimal basis of $M$, returned by the function `MinimalBasis`. Thus if $M$ is graded, or if $R$ is a local ring, then the rank is guaranteed to be unique (and is the absolutely minimal number of elements needed to generate $M$). Otherwise the result is not an invariant of $M$, but simply reflects the minimum as found by the `MinimalBasis` algorithm.

<a id="function-colonmodule-modmpol-rngmpol"></a>
## `ColonModule(M, J): ModMPol, RngMPol -> ModMPol`

Given an $R$-module $M$ and an ideal $J$ of $R$, return the colon module $M:J$ which is the submodule of the ambient module $A$ of $M$ consisting of all $f\in A$ such that $f\cdot g\in M$ for all $g\in J$. When $J$ is generated by a single element, this easily reduces to a syzygy computation in $A$ and in the general case, we intersect the colon modules for a set of generators of $J$.

<a id="function-colonideal-modmpol-modmpol"></a>
## `ColonIdeal(M, N): ModMPol, ModMPol -> RngMPol`

Given an $R$-modules $M$ and $N$ which are both submodules of a common supermodule, return the colon ideal $M:N$, which is the ideal of $R$ consisting of all $f\in R$ such that $f\cdot N \subset M$. The algorithm used is as described in section 2.8.4 of [[GP02](https://docs.magma-maths.org/v2.30-1/references.md#cite-grpf02)].

<a id="function-annihilator-modmpol"></a>
## `Annihilator(M): ModMPol -> RngMPol`

Given an $R$-module $M$, return the annihilator ideal of $M$. This is the ideal $I$ of $R$ consisting of all $f\in R$ such that $f\cdot M = 0$ (which can be seen to equal the ideal $0_M : M$, where $0_M$ is the zero submodule of $M$, so is a special case of `ColonIdeal`).

<a id="function-fittingideal-modmpol-rngintelt"></a>
## `FittingIdeal(M, i): ModMPol, RngIntElt -> RngMPol`

Given an $R$-module $M$ of degree $r$ and an integer $i\ge 0$, return the $i$-th Fitting ideal of $M$, which is the ideal of $R$ generated by the $(r-i)$-th minors of the presentation matrix of $M$, where $r$ is the degree of $M$. See [[CLO98](https://docs.magma-maths.org/v2.30-1/references.md#cite-uag-clo), p.229] or [[Eis95](https://docs.magma-maths.org/v2.30-1/references.md#cite-eisenbudcommalg), Sec. 20.2].

<a id="function-fittingideals-modmpol"></a>
## `FittingIdeals(M): ModMPol -> RngMPol`

Given an $R$-module $M$ of degree $r$, return the Fitting ideals (for from 0 to $r$) as a sequence of ideals of $R$.

<a id="function-syzygymodule-modmpol"></a>
## `SyzygyModule(M): ModMPol -> [ ModMPolElt ]`

Given a module $M$, return the syzygy module $S$ of $M$. If the basis $B$ of $M$ has length $k$, the syzygy module $S$ has degree $k$ and elements of $S$ express a syzygy amongst the $k$ elements of the basis $B$. Note that the degree of the resulting module thus depends on the current basis of $M$.

<a id="function-minimalsyzygymodule-modmpol"></a>
## `MinimalSyzygyModule(M): ModMPol -> [ ModMPolElt ]`

Given a homogeneous module $M$, return the syzygy module $S$ of the minimal basis of $M$. If the minimal basis $B$ of $M$ has length $k$, the syzygy module $S$ has degree $k$ and elements of $S$ express a syzygy amongst the $k$ elements of the minimal basis $B$.

<a id="function-syzygymodule-rngmpolelt"></a>
## `SyzygyModule(Q): [ RngMPolElt ] -> ModTupRng`

Given a sequence $Q$ of polynomials from a multivariate polynomial ring $P$, return the module of syzygies of $Q$. This is a module over $P$ of degree $k$, where $k$ is the length of $Q$, consisting of all vectors $v$ such that the sum of $v[i]*Q[i]$ for $i=1,\ldots k$ is zero.

<a id="example-ex-e30655"></a>
## `Example: Rank of a Module and Its Localization (ex-e30655)`

In this example we note that a certain module $M$ has rank 3 (equal to its degree 3), since no generator is redundant. If we move to the localization of $M$, then $(1+x-z)$ becomes a unit, so the first generator becomes redundant.

```magma
> R<x,y,z> := PolynomialRing(RationalField(), 3, "grevlex");
> F := RModule(R, 3);
> M := quo<F | [x + 1, y, z], [z, y, 0]>;
> M;
Reduced Module R^3/<relations>
Relations:
[x + 1,     y,     z],
[    z,     y,     0]
> Degree(M);
3
> Rank(M);
3
> ML := Localization(M);
> ML;
Reduced Module R^3/<relations> (local)
Relations:
[1 + x - z,         0,         z],
[        z,         y,         0]
> Rank(ML);
2
> MinimalBasis(ML);
[
    [0, 1, 0],
    [0, 0, 1]
]
```
