---
title: "Ideals of ${\\mathbb{Z}}$"
canonical: "https://docs.magma-maths.org/v2.30-1/BasicRings/ResidueClassRings/integer-ideals.html"
source: "https://docs.magma-maths.org/v2.30-1/BasicRings/ResidueClassRings/integer-ideals.md"
part: "Basic Rings"
chapter: "Integer Residue Class Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Basic Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/index-basic-rings.md"}
  - {"title": "Integer Residue Class Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/ResidueClassRings/index-residue-class-rings.md"}
prev: {"title": "Introduction", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/ResidueClassRings/introduction.md"}
next: {"title": "${\\mathbb{Z}}$ as a Number Field Order", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/ResidueClassRings/number-field-like.md"}
intrinsics:
  - {"name": "ideal", "signature": "ideal< R | a >: RngInt, RngIntElt -> RngIntRes"}
examples:
  - "ex-1aa6f6"
---

<a id="integer-ideals"></a>
<a id="rngintres-ideal-division"></a>
<a id="ideals-of-mathbb-z"></a>
# Ideals of ${\mathbb{Z}}$

The theory of ideals of ${\mathbb{Z}}$ is very elementary but for completeness the general machinery for ring ideals applies. Such ideals will have type `RngInt`, that is, the same type as the ring of integers itself (`ideal<Integers() | 1>`).

In the case of ${\mathbb{Z}}$ any subring is an ideal so that the `sub`-constructor creates the same object as does the `ideal`-constructor. One quirk of this fact that ideals are of type `RngInt` is that taking $R/I$ will result in the *ideal division* rather than the ring-by-ideal quotient (this is for compatibility with orders of number fields, as explained in the next section). Here is an example that shows the difference.

```
> Z := Integers();
> I := ideal<Z|1>; // ideal of Z
> Z/I; // interpreted as ideal division
Integer Ring
> quo<Z|I>; // quotient of ring by ideal
Residue class ring of integers modulo 1
```

<a id="constructor-constructor-ideal-rngint-rngintelt-rngintres"></a>
## `ideal< R | a >: RngInt, RngIntElt -> RngIntRes`

Given the ring of integers ${\mathbb{Z}}$ and an integer $a$, return the ideal of ${\mathbb{Z}}$ generated by $a$.

<a id="example-ex-1aa6f6"></a>
## `Example: Ideals of the Integers (ex-1aa6f6)`

We construct some ideals of ${\mathbb{Z}}$.

```magma
> Z := IntegerRing();
> I13 := ideal< Z | 13 >;
> I13;
Ideal of Integer Ring generated by 13
> 1 in I13;
false
> 0 in I13;
true
> -13 in I13;
true
> I0 := ideal< Z | 0 >;
> 0 in I0;
true
> 1 in I0;
false
```

We check that ${\mathbb{Z}}$ is regarded as an ideal.

```magma
> I1 := ideal< Z | 1 >;
> I1 eq Z;
true
```
