Inside $\mathbb{Z}_{45}$ the multiples of 9, $\{0, 9, 18, 27, 36\}$, form the copy of $\mathbb{Z}_5$ that the Chinese remainder theorem found. They have a property that a general subring lacks: a multiple of 9 times any element of $\mathbb{Z}_{45}$ is again a multiple of 9. The moduli of earlier units had the same property. A multiple of 12 times any integer is a multiple of 12, and a multiple of $p(x)$ times any polynomial is a multiple of $p(x)$. That property is what made the product of congruence classes well defined. Which subsets of a ring have it, and how many does $\mathbb{Z}_{45}$ have?
Here is what goes wrong without it. The integers $\mathbb{Z}$ form a subring of the rationals $\mathbb{Q}$, so they are closed under subtraction and under multiplication. Try to work "modulo $\mathbb{Z}$" in $\mathbb{Q}$, calling two rationals congruent when their difference is an integer. Then $\tfrac12$ and $\tfrac32$ are congruent, since their difference is $-1$, and adding the same number to both keeps them congruent. Multiplying both by $\tfrac12$ does not:
$$\tfrac12 \cdot \tfrac12 = \tfrac14, \qquad \tfrac32 \cdot \tfrac12 = \tfrac34, \qquad \tfrac34 - \tfrac14 = \tfrac12 \notin \mathbb{Z}.$$
So there is no multiplication of classes modulo $\mathbb{Z}$. The integers are closed under multiplication among themselves, but an integer times a rational can leave $\mathbb{Z}$. The subsets that can serve as moduli are those that absorb multiplication by every element of the ring. They are called ideals.
First we define ideals and give a short test for them. Then we build the ideal generated by one or several elements, and ask when two lists of generators give the same ideal. Next we prove that every ideal of $\mathbb{Z}$ and of $F[x]$ has a single generator, and list the six ideals of $\mathbb{Z}_{45}$. Finally we meet two rings where one generator is not enough, $\mathbb{Z}[x]$ and $\mathbb{Z}[\sqrt{-5}]$; in the second, unique factorization fails as well.
This article opens Ideals and Quotient Rings. It covers §6.1 of the course text (Hungerford, 2014), with Judson (2026, §§16.3, 17.3.1 and 18.2) as a free companion. It uses subrings and the subring test, the The Division Algorithm and Bezout's identity from Divisibility and the Euclidean Algorithm, and their polynomial versions in Polynomial Division over a Field. The next article, Congruence Modulo an Ideal and Quotient Rings, uses ideals to build new rings.
The definition
Definition. A subring $I$ of a ring $R$ is an ideal if, for every $r \in R$ and every $a \in I$, both $ra \in I$ and $ar \in I$.
The condition is called absorption: a product with at least one factor in $I$ lies in $I$, whatever the other factor is. A subring only has to be closed under products of two of its own elements, the special case in which $r$ also lies in $I$. In a commutative ring $ra = ar$, so one of the two conditions suffices. In a noncommutative ring both are needed, and an ideal in this sense is sometimes called two-sided (Judson, 2026, Remark 16.3.9).
Absorption makes closure under multiplication automatic, so a shorter test suffices.
Theorem (ideal test). A nonempty subset $I$ of a ring $R$ is an ideal if and only if
- $a - b \in I$ whenever $a, b \in I$, and
- $ra \in I$ and $ar \in I$ whenever $r \in R$ and $a \in I$.
Proof. An ideal is a subring, so it is closed under subtraction, and it absorbs products by definition. Conversely, suppose $I$ is nonempty and satisfies (1) and (2). Choose $a \in I$; by (1), $0_R = a - a \in I$. For $a, b \in I$, $a - b \in I$ by (1), and $ab \in I$ by (2) with $r = a$, which is an element of $R$. So $I$ contains $0_R$ and is closed under subtraction and multiplication, and the subring test makes it a subring. With (2) it is an ideal. $\blacksquare$
This is the course text's Theorem 6.1. In the opening example, differences of multiples of 9 and products $r \cdot 9k = 9(rk)$ are multiples of 9, so $\{0, 9, 18, 27, 36\}$ is an ideal of $\mathbb{Z}_{45}$.
Examples
Multiples of $n$ in $\mathbb{Z}$. The set $n\mathbb{Z} = \{nk : k \in \mathbb{Z}\}$ contains 0, $nk - nl = n(k - l)$, and $r(nk) = n(rk)$. So it is an ideal. Below we show that these are the only ideals of $\mathbb{Z}$.
The trivial ideals. In every ring, $\{0_R\}$ and $R$ itself are ideals. An ideal other than $R$ is a proper ideal.
Multiples of $2 - \omega$ in the Eisenstein integers. The homomorphism $g(a + b\omega) = [a + 2b]$ from $\mathbb{Z}[\omega]$ onto $\mathbb{Z}_7$ sends exactly the multiples $(2 - \omega)(c + d\omega)$ to 0. The multiples of a fixed element of a commutative ring always form an ideal, as the next section proves. Here they form the triangular grid of points drawn in that article.
A condition after reduction modulo 2. Reducing every coefficient modulo 2 sends a polynomial $f(x)$ in $\mathbb{Z}[x]$ to a polynomial $\bar f(x)$ in $\mathbb{Z}_2[x]$, and this map is a homomorphism (reduction modulo a prime). In $\mathbb{Z}[x]$, let
$$J = \{\, f(x) \in \mathbb{Z}[x] : x^2 + x + 1 \text{ divides } \bar f(x) \text{ in } \mathbb{Z}_2[x] \,\}.$$
The polynomial $x^2 + x + 1$ is the factor of the quartic that ran through Irreducible Polynomials and Roots. Over $\mathbb{Z}_2$ it has no root, since its values at 0 and 1 are both 1. For example $x^3 + 1$ lies in $J$, since modulo 2 it is $(x + 1)(x^2 + x + 1)$. But $x^2 + 1$ does not: modulo 2 it is $(x^2 + x + 1) + x$, which leaves the remainder $x$. The ideal test applies at once. The zero polynomial is in $J$. If $\bar f$ and $\bar g$ are multiples of $x^2 + x + 1$, so is $\overline{f - g} = \bar f - \bar g$. And for any $h(x) \in \mathbb{Z}[x]$, $\overline{hf} = \bar h \bar f$ is a multiple too. So $J$ is an ideal. It returns throughout this unit, because it turns out to need two generators.
Non-examples. $\mathbb{Z}$ is a subring of $\mathbb{Q}$ but not an ideal, as the opening calculation showed: $\tfrac12 \cdot 1 = \tfrac12 \notin \mathbb{Z}$. For the same reason the subring $2\mathbb{Z}$ of even integers, an ideal of $\mathbb{Z}$, is not an ideal of $\mathbb{Z}[x]$: it contains 2 but not $2x$. Whether a set is an ideal depends on the ring it sits in. In the ring $M_2(\mathbb{R})$ of real $2 \times 2$ matrices, the upper triangular matrices form a subring, closed under sums, differences and products. But multiplying the upper triangular matrix $E = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}$ on the left by $\begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}$ gives $\begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}$, which is not upper triangular.
Check your understanding. Let $S$ be the set of polynomials in $\mathbb{Z}[x]$ that use only even powers of $x$, such as $3 + x^2 - 5x^4$. Is $S$ a subring of $\mathbb{Z}[x]$? Is it an ideal?
It is a subring, since even exponents add to even exponents: the script finds $(1 + x^2)(3 - x^2) = -x^4 + 2x^2 + 3$. It is not an ideal, because $1 \in S$ but $x \cdot 1 = x \notin S$. Like $\mathbb{Z}$ inside $\mathbb{Q}$, it is closed under its own products only.
An ideal containing a unit
Absorption makes ideals large as soon as they contain anything invertible. The idea: a unit times its inverse is 1, and 1 times anything is anything.
Proposition. Let $R$ be a ring with identity and $I$ an ideal of $R$.
- If $I$ contains a unit, then $I = R$. In particular $I = R$ if and only if $1_R \in I$.
- If $R$ is a field, its only ideals are $\{0\}$ and $R$.
Proof. (1) Let $u \in I$ be a unit. By absorption $1_R = u^{-1}u \in I$, and then every $r \in R$ satisfies $r = r 1_R \in I$. Conversely, if $I = R$ then $1_R \in I$.
(2) In a field every nonzero element is a unit, so an ideal containing a nonzero element is the whole field by (1). The only ideal with no nonzero element is $\{0\}$. $\blacksquare$
In $\mathbb{Z}_{45}$, for instance, any ideal that contains 2 contains $23 \cdot 2 = 46 = 1$, and so is the whole ring. A field has no room for congruences of interest: working modulo $\{0\}$ changes nothing, and working modulo the whole field identifies everything. Which quotients of a ring are fields is decided in Congruence Modulo an Ideal and Quotient Rings, by the maximal ideals.
Ideals generated by elements
How do we produce ideals systematically? The simplest are the multiples of one element.
Theorem. Let $R$ be a commutative ring with identity and $c \in R$. Then
$$(c) = \{\, rc : r \in R \,\}$$
is an ideal of $R$. It contains $c$, and it is contained in every ideal that contains $c$.
The idea: a difference of two multiples of $c$ is a multiple of $c$, and so is any multiple of a multiple.
Proof. $(c)$ is nonempty, since it contains $0 = 0c$ and $c = 1c$. For $rc$ and $sc$ in $(c)$ and $t \in R$, $rc - sc = (r - s)c \in (c)$ and $t(rc) = (tr)c \in (c)$, by the distributive and associative laws. Since $R$ is commutative, $(rc)t = t(rc)$ as well, and the ideal test applies. Finally, an ideal that contains $c$ contains every product $rc$, by absorption. $\blacksquare$
This is the course text's Theorem 6.2 and Judson's Example 16.3.5. The ideal $(c)$ is the principal ideal generated by $c$. It is the smallest ideal containing $c$, which is the sense in which $c$ generates it. The proof used the identity to place $c$ in $(c)$, and commutativity to get absorption on both sides. The opening ideal is $(9) = \{0, 9, 18, 27, 36\}$ in $\mathbb{Z}_{45}$.
Several elements generate an ideal in the same way, through their combinations.
Theorem. Let $R$ be a commutative ring with identity and $c_1, \ldots, c_n \in R$. Then
$$(c_1, \ldots, c_n) = \{\, r_1 c_1 + \cdots + r_n c_n : r_1, \ldots, r_n \in R \,\}$$
is an ideal of $R$. It contains each $c_i$, and it is contained in every ideal that contains $c_1, \ldots, c_n$.
The idea: the set is the sum of the principal ideals $(c_1), \ldots, (c_n)$, and a sum of two ideals is again an ideal, so the sum can be built one ideal at a time.
Proof. First, for ideals $A$ and $B$ of $R$, the sum $A + B = \{a + b : a \in A, \; b \in B\}$ is an ideal. It contains $0 = 0 + 0$. A difference $(a + b) - (a' + b') = (a - a') + (b - b')$ has one part in $A$ and one in $B$. And $t(a + b) = ta + tb$ for $t \in R$, with $ta \in A$ and $tb \in B$ by absorption; by commutativity, products on the other side are the same.
Now the set in the theorem is $(c_1) + (c_2) + \cdots + (c_n)$, since each term $r_i c_i$ is an arbitrary element of $(c_i)$. The previous theorem makes each $(c_i)$ an ideal. So $(c_1) + (c_2)$ is an ideal, adding $(c_3)$ gives an ideal, and after $n - 1$ steps the whole sum is an ideal. It contains $c_i$, taking $c_i$ from $(c_i)$ and 0 from the other terms. Finally, an ideal containing every $c_i$ contains each $(c_i)$, by the previous theorem, and so every sum of their elements, being closed under addition. $\blacksquare$
This is the course text's Theorem 6.3. The ideal $(c_1, \ldots, c_n)$ is the ideal generated by $c_1, \ldots, c_n$, and an ideal of this form is finitely generated. A list of generators is a description, not an invariant. Different lists can generate the same ideal, and the shortest list is the main theme of the rest of the article.
Two generators that are one
In $\mathbb{Z}$, the ideal generated by two integers is the set of their integer combinations. The article on the Euclidean algorithm proved that the combinations of $a$ and $b$, not both zero, are exactly the multiples of $\gcd(a, b)$. In the language of ideals, that theorem says $(a, b) = (\gcd(a, b))$: an ideal presented with two generators is principal after all. So $(1729, 1001) = (91)$, which is the measuring-rod statement of the earlier article: rods of lengths 1729 and 1001 mark off exactly the multiples of 91. The script confirms that the positive combinations below 400 are $91, 182, 273, 364$.
The same holds in $F[x]$ for a field $F$, where the greatest common divisor is also a combination of the two polynomials and divides both (Polynomial Division over a Field). In $\mathbb{Q}[x]$, $x^2 - 1 = (x - 1)(x + 1)$ and $x^2 + x - 2 = (x - 1)(x + 2)$ have greatest common divisor $x - 1$, and the script finds the Bezout combination
$$(x^2 - 1)(-1) + (x^2 + x - 2)(1) = x - 1.$$
So $(x^2 - 1, \, x^2 + x - 2) = (x - 1)$: a polynomial is a combination of the two quadratics exactly when it has 1 as a root.
Generators that differ by a unit
A principal ideal can have more than one generator. When do two elements generate the same principal ideal? The answer needs the language of divisibility in a commutative ring. We say $a$ divides $b$, written $a \mid b$, if $b = ac$ for some $c \in R$. And $a$ and $b$ are associates if $a = ub$ for a unit $u$. The idea of the next proposition: "is a multiple of" is the same as "lies in the principal ideal of", so divisibility turns into inclusion.
Proposition. Let $R$ be a commutative ring with identity and $a, b \in R$.
- $a \mid b$ if and only if $(b) \subseteq (a)$.
- $(a) = R$ if and only if $a$ is a unit.
- If $R$ is an integral domain, then $(a) = (b)$ if and only if $a$ and $b$ are associates.
Proof. (1) If $b = ac$, then $b \in (a)$, so the smallest ideal containing $b$ lies inside $(a)$. Conversely, if $(b) \subseteq (a)$, then $b = b \cdot 1 \in (a)$, so $b = ca$ for some $c$.
(2) The whole ring is the principal ideal $(1)$, since $r = r \cdot 1$ for every $r$. Every ideal lies inside $R$, so $(a) = R$ says exactly that $(1) \subseteq (a)$. By (1) that means $a \mid 1$, that is, $ac = 1$ for some $c \in R$. In a commutative ring this is the definition of a unit.
(3) If $a = ub$ with $u$ a unit, then $b \mid a$ and, since $b = u^{-1}a$, $a \mid b$; by (1) the two ideals contain each other. Conversely, suppose $(a) = (b)$. By (1), $a = bx$ and $b = ay$ for some $x, y \in R$. If $a = 0$, then $b = 0$ and they are associates. Otherwise $a = bx = a(yx)$, so $a(1 - yx) = 0$, and since $a \neq 0$ in an integral domain, $yx = 1$. So $x$ is a unit and $a = xb$. $\blacksquare$
For integral domains the three parts are Judson's Lemma 18.2.4. They let each nonzero principal ideal be named by a preferred generator:
- in $\mathbb{Z}$ the units are $\pm 1$, so $(n)$ has exactly one positive generator;
- in $F[x]$ the units are the nonzero constants, so a nonzero ideal $(p(x))$ has exactly one monic generator.
The proof of part (3) cancels $a$, which is where the integral domain is used. In $\mathbb{Z}_{45}$, which has zero divisors, the conclusion happens to survive: 3 and 6 generate the same ideal and $6 = 2 \cdot 3$ with 2 a unit, and likewise $36 = 4 \cdot 9$. But the proposition makes no claim for rings with zero divisors. There are commutative rings in which two elements generate the same principal ideal without being associates.
Principal ideal domains
Every ideal met so far in $\mathbb{Z}$ and $\mathbb{Q}[x]$ turned out to have a single generator. Is that always so?
Definition. A principal ideal domain is an integral domain in which every ideal is principal.
The integers
Theorem. Every ideal of $\mathbb{Z}$ is principal. If $I \neq \{0\}$, then $I = (d)$, where $d$ is the least positive element of $I$.
The idea: divide any element of $I$ by the smallest positive one. The remainder lies in $I$ and is smaller still, so it must be 0.
Proof. If $I = \{0\}$, then $I = (0)$. Otherwise $I$ contains some $a \neq 0$, and also $-a = (-1)a$, so it contains a positive integer. By the well-ordering principle it has a least positive element $d$. Since $d \in I$, $(d) \subseteq I$. Conversely, let $a \in I$. By the division algorithm, $a = dq + r$ with $0 \le r < d$. Then $r = a - qd$ lies in $I$, because $I$ contains $a$ and $qd$ and is closed under subtraction. A positive $r$ would be an element of $I$ smaller than $d$, so $r = 0$ and $a = qd \in (d)$. $\blacksquare$
This is Judson's Theorem 16.3.6, and the class sessions proved it the same way. It is the proof that produced the greatest common divisor as the least positive combination in Divisibility and the Euclidean Algorithm, applied to any ideal. The equation $(a, b) = (\gcd(a, b))$ is the special case $I = (a, b)$: the least positive element of $(1729, 1001)$ is 91. The proof cannot assume that $I$ is given by a finite list of generators. It uses only the two properties in the ideal test, and that is why it covers every ideal.
Polynomials over a field
Theorem. Let $F$ be a field. Every ideal of $F[x]$ is principal. If $I \neq \{0\}$, then $I = (p(x))$, where $p(x)$ is a nonzero polynomial of least degree in $I$, and $I$ has exactly one monic generator.
The idea is the same, with degree in place of size.
Proof. Let $p(x)$ be a nonzero element of $I$ of least degree; degrees are nonnegative integers, so one exists. Then $(p) \subseteq I$. For $f \in I$, the division algorithm over a field gives $f = pq + r$ with $r = 0$ or $\deg r < \deg p$. As before $r = f - qp \in I$, and a nonzero $r$ would contradict the choice of $p$, so $r = 0$ and $f \in (p)$. Two monic generators are associates by the previous proposition. Associates in $F[x]$ differ by a nonzero constant factor, which must be 1 if both are monic. $\blacksquare$
This is Judson's Theorem 17.3.10. Since $\mathbb{Z}$ and $F[x]$ are integral domains, both are principal ideal domains. A ring with a division algorithm measured by some size function of this kind is a Euclidean domain. The same proof shows that every Euclidean domain is a principal ideal domain. The Gaussian integers are a third example, with the norm $a^2 + b^2$ as the size (Judson, 2026, §18.2.2 and Example 18.2.13).
The theorem turns a description into a generator. Let $I$ be the set of rational polynomials that vanish at $\sqrt 2$. It is an ideal by the argument used for $J$ above, with evaluation at $\sqrt 2$, a homomorphism from $\mathbb{Q}[x]$ to $\mathbb{R}$, in place of reduction modulo 2: differences and multiples of polynomials with value 0 at $\sqrt 2$ have value 0 there. It contains $x^2 - 2$. It contains no nonzero constant, and no polynomial $ax + b$ of degree 1, since $a\sqrt 2 + b = 0$ would make $\sqrt 2 = -b/a$ rational. So $x^2 - 2$ has the least degree in $I$, and
$$I = \{\, f(x) \in \mathbb{Q}[x] : f(\sqrt 2) = 0 \,\} = (x^2 - 2).$$
Every rational polynomial with $\sqrt 2$ as a root is a multiple of $x^2 - 2$. The first isomorphism theorem turns this into the isomorphism $\mathbb{Q}[x]/(x^2 - 2) \cong \mathbb{Q}(\sqrt 2)$ that Congruence-Class Arithmetic in Polynomial Rings verified by hand.
Check your understanding. The rational polynomials with both 1 and 2 as roots form an ideal of $\mathbb{Q}[x]$. What is its monic generator?
It is $(x - 1)(x - 2) = x^2 - 3x + 2$, which lies in the ideal. A nonzero polynomial of degree at most 1 has at most one root, so nothing of smaller degree does.
The ideals of $\mathbb{Z}_n$
Back to the opening question: how many ideals does $\mathbb{Z}_{45}$ have? $\mathbb{Z}_n$ is not an integral domain unless $n$ is prime, but its ideals are just as easy to list, by the same division argument.
Proposition. Let $n \ge 2$. The ideals of $\mathbb{Z}_n$ are the principal ideals $([d])$ for the positive divisors $d$ of $n$. Different divisors give different ideals, and $([d])$ has $n/d$ elements. Also, $([a]) = ([\gcd(a, n)])$ for every integer $a$.
Proof. Let $I$ be an ideal of $\mathbb{Z}_n$, and let $d$ be the least positive integer with $[d] \in I$; there is one, since $[n] = [0] \in I$. Then $([d]) \subseteq I$. For any $[a] \in I$ with $0 \le a < n$, divide: $a = dq + r$ with $0 \le r < d$. Then $[r] = [a] - [q][d] \in I$, so $r = 0$ by the choice of $d$, and $[a] \in ([d])$. So $I = ([d])$. The same division applied to $n$ itself gives $[r] = [n] - [q][d] = -[q][d] \in I$ with $0 \le r < d$, so $r = 0$ and $d \mid n$.
The elements of $([d])$ are the classes of the multiples $0, d, 2d, \ldots, (n/d - 1)d$. They are different modulo $n$ because they are less than $n$, and every multiple $kd$ reduces to one of them, since $d \mid n$. So $([d])$ has $n/d$ elements, and different divisors give ideals of different sizes.
For the last statement, let $e = \gcd(a, n)$. Since $e \mid a$, $[a] \in ([e])$. By Bezout's identity $e = au + nv$, so $[e] = [u][a] \in ([a])$. Each ideal contains the generator of the other. $\blacksquare$
For $n = 45$ the divisors are 1, 3, 5, 9, 15 and 45. The script finds exactly six distinct ideals, with 45, 15, 9, 5, 3 and 1 elements. It also confirms two further statements:
- $([a]) = ([\gcd(a, 45)])$ for all 45 values of $a$;
- $([a], [b]) = ([\gcd(a, b, 45)])$ for all 2,025 pairs, so every ideal of $\mathbb{Z}_{45}$ generated by two elements is principal.
For instance $(6) = (3)$, the 15 multiples of 3, and $(36) = (9) = \{0, 9, 18, 27, 36\}$. This last ideal is the opening's copy of $\mathbb{Z}_5$, whose identity is the idempotent 36 of the Chinese remainder theorem.
The figure shows the inclusions: $([e]) \subseteq ([d])$ exactly when $d \mid e$, which the script checks for every pair of divisors. Since every ideal is principal, the ideals of $\mathbb{Z}_{45}$ form the same pattern as the divisors of 45, reversed. The pattern is also the pattern of the ideals of $\mathbb{Z}$ that contain $(45)$, namely $(1), (3), (5), (9), (15), (45)$; the next article explains why.
Check your understanding. By the proposition, $[a]$ generates the ideal $([d])$ exactly when $\gcd(a, 45) = d$. How many elements of $\mathbb{Z}_{45}$ generate each of the six ideals, and why must the six counts add up to 45?
Write $a = dk$ with $0 \le k < 45/d$. Then $\gcd(a, 45) = d$ exactly when $\gcd(k, 45/d) = 1$, so $([d])$ has $\varphi(45/d)$ generators, counted by Euler's function. For $d = 1, 3, 5, 9, 15, 45$ the counts are $24, 8, 6, 4, 2, 1$, as the script confirms. They add up to 45 because every element generates exactly one of the six ideals, the one named by its greatest common divisor with 45.
A ring that is not a principal ideal domain
The proofs for $\mathbb{Z}$ and $F[x]$ needed one way to measure size. In $\mathbb{Z}[x]$ there are two, the constant and the degree, and the ideal $J$ of polynomials whose reduction modulo 2 is a multiple of $x^2 + x + 1$ needs one generator for each.
Proposition. In $\mathbb{Z}[x]$, $J = (2, \, x^2 + x + 1)$, and $J$ is not principal. So $\mathbb{Z}[x]$ is not a principal ideal domain.
The idea: every polynomial differs from one of just four polynomials, $0, 1, x$ and $1 + x$, by an element of $J$. A single generator $d$ cannot achieve that. If $d$ is a constant, the powers of $x$ stay apart; if it is not, the integers stay apart.
Proof. The generators. A combination $2g(x) + (x^2 + x + 1)h(x)$ reduces modulo 2 to $(x^2 + x + 1)\bar h(x)$, so $(2, x^2 + x + 1) \subseteq J$. Conversely, let $f \in J$. Division by the monic polynomial $x^2 + x + 1$ is possible in $\mathbb{Z}[x]$ (the division algorithm needs only a unit leading coefficient). It gives $f = (x^2 + x + 1)q + (c + dx)$ with integers $c$ and $d$. Reduce modulo 2: $x^2 + x + 1$ divides $\bar f$ and $(x^2 + x + 1)\bar q$, so it divides their difference $\bar c + \bar d x$. A nonzero multiple of $x^2 + x + 1$ in $\mathbb{Z}_2[x]$ has degree at least 2, because degrees add over a field. So $\bar c + \bar d x = 0$, which means $c$ and $d$ are even, and $f = (x^2 + x + 1)q + 2\big(\tfrac c2 + \tfrac d2 x\big)$ lies in $(2, x^2 + x + 1)$. For example, $x^3 + 1 = (x^2 + x + 1)(x - 1) + 2$, as the script computes.
Four leftovers. Let $f$ be any polynomial in $\mathbb{Z}[x]$. Divide as before, $f = (x^2 + x + 1)q + (c + dx)$, and write $c = 2s + a$ and $d = 2t + b$ with $a, b \in \{0, 1\}$. Then
$$f - (a + bx) = (x^2 + x + 1)q + 2(s + tx) \in J.$$
So every polynomial differs from one of $0, 1, x, 1 + x$ by an element of $J$, and among any five polynomials, two differ by an element of $J$. The script confirms that each polynomial of degree less than 5 with coefficients from $-2$ to 2 differs from exactly one of the four by an element of $J$.
Not principal. Suppose $J = (d)$ for a single polynomial $d(x)$. The constant 1 is not in $J$, since 1 is not a multiple of $x^2 + x + 1$ in $\mathbb{Z}_2[x]$. So $J \neq \mathbb{Z}[x]$, and $d \neq \pm 1$. In each remaining case we find five polynomials no two of which differ by a multiple of $d$, contradicting the last paragraph.
- If $d = 0$ or $\deg d \ge 1$, take $0, 1, 2, 3, 4$. Their differences are nonzero integers. But no nonzero integer is a multiple of $d$: the only multiple of 0 is 0, and a nonzero multiple $de$ of a nonconstant $d$ has degree $\deg d + \deg e \ge 1$, because degrees add in $\mathbb{Z}[x]$, $\mathbb{Z}$ being an integral domain.
- If $d$ is an integer other than $0$ and $\pm 1$, take $0, 1, x, x^2, x^3$. Each difference has a coefficient equal to 1 or $-1$, while every multiple of $d$ has all its coefficients divisible by $d$.
Both cases are impossible. $\blacksquare$
The class sessions made the same point with a different ideal, and the course text and Judson give their own examples. Judson uses the ideal $(x, y)$ of polynomials in two variables (Example 17.3.11). The count of leftovers shows a little more. Every principal ideal of $\mathbb{Z}[x]$ other than the whole ring leaves infinitely many polynomials pairwise apart, the integers $0, 1, 2, \ldots$ or the powers $1, x, x^2, \ldots$, while $J$ leaves four. The obstruction is the one in the idea above: $J$ asks for a small constant and a low degree at once. In $\mathbb{Q}[x]$ the same two generators collapse, since 2 is a unit there: $(2, x^2 + x + 1) = \mathbb{Q}[x]$.
Check your understanding. Is $(2, x^2 + 3x + 3)$ the same ideal of $\mathbb{Z}[x]$ as $J$? Is $(2, x^2 + 1)$?
The first is. The two quadratics differ by $2x + 2$, a multiple of 2, so each list generates the other's elements. The second is not. Modulo 2, $x^2 + 1$ leaves the remainder $x$ on division by $x^2 + x + 1$, so $x^2 + 1$ is not in $J$, and $(2, x^2 + 1)$ is not contained in $J$.
Irreducible elements and prime elements
The failure of one generator has a consequence for factorization. In $\mathbb{Z}$ a prime can be described in two ways:
- by its divisors, having none except the trivial ones;
- by its multiples, through Euclid's lemma: $p \mid ab$ implies $p \mid a$ or $p \mid b$.
The Primes and the Fundamental Theorem of Arithmetic showed that these descriptions agree for integers, and Irreducible Polynomials and Roots showed the same for polynomials over a field. In a general integral domain they are different properties, with different names (Judson, 2026, §18.2).
Definition. Let $D$ be an integral domain and $p \in D$ nonzero and not a unit.
- $p$ is irreducible if whenever $p = ab$, one of $a$ and $b$ is a unit.
- $p$ is prime if whenever $p \mid ab$, then $p \mid a$ or $p \mid b$.
Both conditions translate into statements about ideals. By the proposition on divisibility, $p$ is irreducible exactly when no principal ideal lies strictly between $(p)$ and $D$. Indeed, if $(p) \subseteq (a)$, then $p = ab$. Either $a$ is a unit, so $(a) = D$, or $b$ is, so $(a) = (p)$. Conversely, suppose no principal ideal lies strictly between, and $p = ab$. Then $(p) \subseteq (a)$, so either $(a) = D$ and $a$ is a unit, or $(a) = (p)$. In the second case $a$ and $p$ are associates, and $b$ is a unit by cancellation. And $p$ is prime exactly when $ab \in (p)$ forces $a \in (p)$ or $b \in (p)$, which is the definition of a prime ideal in Congruence Modulo an Ideal and Quotient Rings.
Proposition. In an integral domain every prime element is irreducible. In a principal ideal domain every irreducible element is prime.
The idea of the second half: in $\mathbb{Z}$, Euclid's lemma came from Bezout's identity. In a principal ideal domain the ideal $(p, a)$ has a single generator, and that generator plays the part of the greatest common divisor.
Proof. Let $p$ be prime and $p = ab$. Then $p \mid ab$, so $p$ divides one factor, say $a = pc$. Then $p = pcb$, and canceling $p \neq 0$ in the integral domain gives $cb = 1$, so $b$ is a unit. So $p$ is irreducible.
Now let $D$ be a principal ideal domain, $p$ irreducible, and $p \mid ab$ with $p \nmid a$. The ideal $(p, a)$ is principal, say $(p, a) = (d)$. Then $d \mid p$, so $p = de$, and by irreducibility $d$ or $e$ is a unit. If $e$ were a unit, then $d = pe^{-1}$ and $p$ would divide $d$, which divides $a$, contrary to $p \nmid a$. So $d$ is a unit, $(p, a) = D$, and $1 = pr + as$ for some $r, s \in D$. Multiplying by $b$ gives $b = p(rb) + (ab)s$, and $p$ divides both terms. So $p \mid b$. $\blacksquare$
In $\mathbb{Z}$ the hypothesis that $(p, a)$ is principal and Bezout's identity are the same fact. With $p = 7$ and $a = 10$, $(7, 10) = (1)$ and $1 = 7 \cdot 3 + 10 \cdot (-2)$, which is the equation the proof multiplies by $b$. Judson proves the result as Corollary 18.2.6, by way of maximal ideals.
Where they part: $\mathbb{Z}[\sqrt{-5}]$
The ring $\mathbb{Z}[\sqrt{-5}] = \{a + b\sqrt{-5} : a, b \in \mathbb{Z}\}$ is a subring of $\mathbb{C}$, hence an integral domain. Write $s = \sqrt{-5}$, so $s^2 = -5$. The norm $N(a + bs) = a^2 + 5b^2$ is the square of the absolute value of the complex number $a + bs$. So it is multiplicative, $N(zw) = N(z)N(w)$, and a nonnegative integer. If $u$ is a unit, then $N(u)N(u^{-1}) = N(1) = 1$, so $N(u) = 1$, which forces $u = \pm 1$.
The number 6 factors in two ways:
$$6 = 2 \cdot 3 = (1 + s)(1 - s).$$
The norms are $N(2) = 4$, $N(3) = 9$ and $N(1 \pm s) = 6$. A factorization $z = xy$ into two nonunits needs $N(x)$ and $N(y)$ greater than 1 with product $N(z)$. So a factorization of 2 would need an element of norm 2, and a factorization of 3 or of $1 \pm s$ an element of norm 2 or 3. But $a^2 + 5b^2$ is never 2 or 3: with $b \neq 0$ it is at least 5, and with $b = 0$ it is a perfect square. (The script lists the norms below 30: 0, 1, 4, 5, 6, 9, 14, ...) So 2, 3, $1 + s$ and $1 - s$ are all irreducible.
But 2 is not prime. It divides $(1 + s)(1 - s) = 6$. It divides neither factor, since $\tfrac12(1 \pm s)$ does not have integer coordinates. So $\mathbb{Z}[\sqrt{-5}]$ is not a principal ideal domain, and the ideal that shows it is the one the proof above would have used.
Proposition. The ideal $(2, 1 + s)$ of $\mathbb{Z}[\sqrt{-5}]$ is not principal.
The idea: a generator would divide both 2 and $1 + s$, so its norm would divide both 4 and 6, and no element has norm 2.
Proof. A general element of the ideal is
$$2(a + bs) + (1 + s)(c + ds) = (2a + c - 5d) + (2b + c + d)s,$$
and the difference of its two coordinates, $2a - 2b - 6d$, is even. So the element $1 = 1 + 0s$ is not in the ideal, and the ideal is proper. Suppose it equals $(z)$. Then $z$ divides 2 and $1 + s$, so $N(z)$ divides $N(2) = 4$ and $N(1 + s) = 6$, and hence divides 2. There is no element of norm 2, so $N(z) = 1$ and $z = \pm 1$, which would make the ideal the whole ring. $\blacksquare$
Check your understanding. Is $1 + s$ a prime element of $\mathbb{Z}[\sqrt{-5}]$?
No. It divides $2 \cdot 3 = 6$. If it divided 2 or 3, its norm 6 would divide $N(2) = 4$ or $N(3) = 9$. So it divides the product and neither factor.
So in $\mathbb{Z}[\sqrt{-5}]$ factorization into irreducibles is not unique. The two factorizations of 6 are genuinely different, since no factor on one side is a unit multiple of a factor on the other. This failure is where ideals came from. Kummer worked with rings of complex numbers in which unique factorization fails. He restored it in 1846 by introducing "ideal complex numbers". Dedekind later replaced them by ideals in the present sense, and in 1871 generalized primes to prime ideals (O'Connor and Robertson, MacTutor). In $\mathbb{Z}[\sqrt{-5}]$ the ideals $(2, 1 + s)$, $(3, 1 + s)$ and $(3, 1 - s)$ are the "missing" common factors. For instance the script checks that every element $x + ys$ of $(3, 1 + s)$ has $x \equiv y \pmod 3$, so it too is a proper ideal. How the ideals of such rings factor into prime ideals belongs to algebraic number theory, beyond this course.
Summary
| Ring | Every ideal principal? | Generator of a nonzero ideal |
|---|---|---|
| a field $F$ | yes: only $\{0\}$ and $F$ | 1 |
| $\mathbb{Z}$ | yes | its least positive element |
| $F[x]$, $F$ a field | yes | its monic element of least degree |
| $\mathbb{Z}_n$ | yes (not a domain unless $n$ is prime) | $[d]$ for a divisor $d$ of $n$ |
| $\mathbb{Z}[x]$ | no: $(2, x^2 + x + 1)$ | |
| $\mathbb{Z}[\sqrt{-5}]$ | no: $(2, 1 + \sqrt{-5})$ |
Where it leads
- The kernel of a homomorphism is always an ideal, and every ideal is a kernel. The first isomorphism theorem uses the ideals $(x^2 - 2)$ and $(2, x^2 + x + 1)$ of this article to identify quotient rings with familiar ones.
- Groups have a counterpart: normal subgroups are the subgroups one can work modulo. The subgroups of a cyclic group are listed by divisors just as the ideals of $\mathbb{Z}_n$ are (Subgroups and Cyclic Groups).
What we have learned
An ideal is a subring that absorbs products with every element of the ring. Any list of elements generates one, the set of its combinations. In $\mathbb{Z}$, $F[x]$ and $\mathbb{Z}_n$ one generator always suffices, by the division algorithm, and $\mathbb{Z}_{45}$ has six ideals, one for each divisor of 45. In $\mathbb{Z}[x]$ the ideal $(2, x^2 + x + 1)$ needs two generators. In $\mathbb{Z}[\sqrt{-5}]$ so does $(2, 1 + \sqrt{-5})$, and 6 factors in two different ways.
Ideals were meant to be worked modulo. Two polynomials are congruent modulo $J = (2, x^2 + x + 1)$ when they differ by an element of $J$, and every polynomial is congruent to one of $0, 1, x, 1 + x$. Do the classes form a ring, and which one? The next article, Congruence Modulo an Ideal and Quotient Rings, builds the quotient ring $R/I$ for every ideal. It also classifies ideals by their quotients: prime ideals give integral domains, and maximal ideals give fields.
References
- Hungerford, T. W. (2014). Abstract Algebra: An Introduction (3rd ed.), §6.1. Brooks/Cole, Cengage Learning. The course text: the definition of an ideal, the ideal test (Theorem 6.1), principal ideals in a commutative ring with identity (Theorem 6.2) and finitely generated ideals (Theorem 6.3). record · 44 pages
- Judson, T. W. (2026). Abstract Algebra: Theory and Applications (annual edition, August 2026). Free online at judsonbooks.org. §16.3: ideals, two-sided ideals (Remark 16.3.9), principal ideals (Example 16.3.5), every ideal of $\mathbb{Z}$ is principal (Theorem 16.3.6); §17.3.1: every ideal of $F[x]$ is principal (Theorem 17.3.10), the ideal $(x, y)$ of $F[x, y]$ (Example 17.3.11); §18.2: irreducible and prime elements, associates, Lemma 18.2.4 on divisibility and principal ideals, Corollary 18.2.6 (irreducible implies prime in a principal ideal domain), Euclidean domains and the Gaussian integers (§18.2.2, Example 18.2.13). record · 44 pages
- O'Connor, J. J., and Robertson, E. F. The development of Ring Theory. MacTutor History of Mathematics Archive, University of St Andrews. Kummer's "ideal complex numbers" (1846) restoring unique factorization, Dedekind's ideals, and his prime ideals (1871). record