Lesson 10 of 15

Ideals

Ideals

An ideal II of a ring RR is a subset that is:

  1. A subgroup of (R,+)(R, +)
  2. Absorbing under multiplication: for all rRr \in R and aIa \in I, both raIra \in I and arIar \in I

Ideals are to rings what normal subgroups are to groups — they let us form quotient structures.

Ideals in Zn\mathbb{Z}_n

In Zn\mathbb{Z}_n, every ideal is principal — generated by a single element. The ideal generated by aa is:

a={0,a,2a,3a,}(modn)\langle a \rangle = \{0, a, 2a, 3a, \ldots\} \pmod{n}

which equals {kamodn:k=0,1,}\{ka \bmod n : k = 0, 1, \ldots\}.

Example: Ideals of Z6\mathbb{Z}_6

  • 0={0}\langle 0 \rangle = \{0\}
  • 1={0,1,2,3,4,5}=Z6\langle 1 \rangle = \{0, 1, 2, 3, 4, 5\} = \mathbb{Z}_6
  • 2={0,2,4}\langle 2 \rangle = \{0, 2, 4\}
  • 3={0,3}\langle 3 \rangle = \{0, 3\}

Note: 4={0,4,2}=2\langle 4 \rangle = \{0, 4, 2\} = \langle 2 \rangle and 5=1\langle 5 \rangle = \langle 1 \rangle.

Maximal and Prime Ideals

  • An ideal IRI \neq R is maximal if no ideal lies strictly between II and RR
  • An ideal II is prime if abIab \in I implies aIa \in I or bIb \in I

In Zn\mathbb{Z}_n, d\langle d \rangle is a prime ideal if and only if dd is prime (or d=0d = 0 when nn is prime).

Your Task

Implement principal_ideal(a, n) returning the sorted elements of a\langle a \rangle in Zn\mathbb{Z}_n, all_ideals(n) returning all distinct ideals (sorted by size then lex), and is_prime_ideal(ideal, n) checking the prime ideal condition.

Pyodide loading...
Loading...
Click "Run" to execute your code.