---
title: "Basic Operations on Ideals"
canonical: "https://docs.magma-maths.org/v2.30-1/Algebras/FinitelyPresentedAlgebras/ideal-operation.html"
source: "https://docs.magma-maths.org/v2.30-1/Algebras/FinitelyPresentedAlgebras/ideal-operation.md"
part: "Algebras"
chapter: "Finitely Presented Algebras"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/index-algebras.md"}
  - {"title": "Finitely Presented Algebras", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/FinitelyPresentedAlgebras/index-finitely-presented-algebras.md"}
prev: {"title": "Ideals and Gröbner Bases", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/FinitelyPresentedAlgebras/ideals.md"}
next: {"title": "Changing Coefficient Ring", "source": "https://docs.magma-maths.org/v2.30-1/Algebras/FinitelyPresentedAlgebras/change-ring.md"}
intrinsics:
  - {"name": "+", "signature": "I + J: AlgFr, AlgFr -> AlgFr"}
  - {"name": "*", "signature": "I * J: AlgFr, AlgFr -> AlgFr"}
  - {"name": "/", "signature": "F / J: AlgFr, AlgFr -> AlgFrRes"}
  - {"name": "Generic", "signature": "Generic(I): AlgFr -> AlgFr"}
  - {"name": "eq", "signature": "I eq J: AlgFr, AlgFr -> BoolElt"}
  - {"name": "ne", "signature": "I ne J: AlgFr, AlgFr -> BoolElt"}
  - {"name": "notsubset", "signature": "I notsubset J: AlgFr, AlgFr -> BoolElt"}
  - {"name": "subset", "signature": "I subset J: AlgFr, AlgFr -> BoolElt"}
  - {"name": "IsZero", "signature": "IsZero(I): AlgFr -> BoolElt"}
  - {"name": "in", "signature": "f in I: AlgFrElt, AlgFr -> BoolElt"}
  - {"name": "NormalForm", "signature": "NormalForm(f, I): AlgFrElt, AlgFr -> AlgFrElt"}
  - {"name": "NormalForm", "signature": "NormalForm(f, S): AlgFrElt, [ AlgFrElt ] -> AlgFrElt"}
  - {"name": "notin", "signature": "f notin I: AlgFrElt, AlgFr -> BoolElt"}
examples:
  - "ex-3dd8c1"
---

# Basic Operations on Ideals

In the following, note that the free algebra $F$ itself is a valid ideal (the ideal containing 1).

## Construction of New Ideals

<a id="operation-op-plus-algfr-algfr"></a>
### `I + J: AlgFr, AlgFr -> AlgFr`

Given ideals $I$ and $J$ belonging to the same algebra $F$, return the sum of $I$ and $J$, which is the ideal generated by the union of the generators of $I$ and $J$.

<a id="operation-op-times-algfr-algfr"></a>
### `I * J: AlgFr, AlgFr -> AlgFr`

Given ideals $I$ and $J$ belonging to the same algebra $A$, return the product of $I$ and $J$, which is the ideal generated by the products of the generators of $I$ with those of $J$.

<a id="operation-op-div-algfr-algfr"></a>
### `F / J: AlgFr, AlgFr -> AlgFrRes`

Given an algebra $F$ over a field and an ideal $J$ of $F$, return the fp-algebra $F/J$ (see below).

<a id="function-generic-algfr"></a>
### `Generic(I): AlgFr -> AlgFr`

Given an ideal $I$ of a generic algebra $A$, return $A$.

## Ideal Predicates

<a id="operation-op-eq-algfr-algfr"></a>
### `I eq J: AlgFr, AlgFr -> BoolElt`

Given two ideals $I$ and $J$ belonging to the same algebra $F$, return whether $I$ and $J$ are equal.

<a id="operation-op-ne-algfr-algfr"></a>
### `I ne J: AlgFr, AlgFr -> BoolElt`

Given two ideals $I$ and $J$ belonging to the same algebra $F$, return whether $I$ and $J$ are not equal.

<a id="operation-operation-notsubset-algfr-algfr-boolelt"></a>
### `I notsubset J: AlgFr, AlgFr -> BoolElt`

Given two ideals $I$ and $J$ belonging to the same algebra $F$ return whether $I$ is not contained in $J$.

<a id="operation-op-subset-algfr-algfr"></a>
### `I subset J: AlgFr, AlgFr -> BoolElt`

Given two ideals $I$ and $J$ belonging to the same algebra $F$ return whether $I$ is contained in $J$.

<a id="function-iszero-algfr"></a>
### `IsZero(I): AlgFr -> BoolElt`

Given an ideal $I$ of the algebra $F$, return whether $I$ is the zero ideal (contains zero alone).

## Operations on Elements of Ideals

<a id="operation-op-in-algfrelt-algfr"></a>
### `f in I: AlgFrElt, AlgFr -> BoolElt`

Given a polynomial $f$ from an algebra $F$, together with an ideal $I$ of $F$, return whether $f$ is in $I$.

<a id="function-normalform-algfrelt-algfr"></a>
### `NormalForm(f, I): AlgFrElt, AlgFr -> AlgFrElt`

Given a polynomial $f$ from an algebra $F$, together with an ideal $I$ of $F$, return the unique normal form of $f$ with respect to (the Gröbner basis of) $I$. The normal form of $f$ is zero if and only if $f$ is in $I$.

<a id="function-normalform-algfrelt-algfrelt"></a>
### `NormalForm(f, S): AlgFrElt, [ AlgFrElt ] -> AlgFrElt`

Given a polynomial $f$ from an algebra $F$, together with a set or sequence $S$ of polynomials from $F$, return a normal form of $f$ with respect to $S$. This is not unique in general. If the normal form of $f$ is zero then $f$ is in the ideal generated by $S$, but the converse is false in general. In fact, the normal form is unique if and only if $S$ forms a Groëbner basis.

<a id="operation-op-notin-algfrelt-algfr"></a>
### `f notin I: AlgFrElt, AlgFr -> BoolElt`

Given a polynomial $f$ from an algebra $F$, together with an ideal $I$ of $F$, return whether $f$ is not in $I$.

<a id="example-ex-3dd8c1"></a>
### `Example: Normal Forms Modulo an Ideal (ex-3dd8c1)`

We demonstrate the element operations with respect to an ideal of ${\mathbb{Q}}[x, y, z]$.

```magma
> F<x,y,z> := FreeAlgebra(RationalField(), 3);
> I := ideal<F | (x + y)^3, (y - z)^2, y^2*z + z>;
> NormalForm(y^2*z + z, I);
0
> NormalForm(x^3, I);
-x^2*y - x*y*x - x*y*z - x*z*y + x*z^2 - y*x^2 - y*x*y - y*z*x -
    y*z*y - z*y*x - z*y*z + z^2*x + z^3
> NormalForm(z^4 + y^2, I);
z^4 + y*z + z*y - z^2
> x + y in I;
false
```
