A prime ideal P of a commutative ring R is a proper ideal such that ab in P implies a in P or b in P -- equivalently, R/P is an integral domain. A maximal ideal M is a proper ideal contained in no larger proper ideal -- equivalently, R/M is a field. Every maximal ideal is prime, but not conversely. The existence of maximal ideals (via Zorn's lemma) and the structure of the set of all prime ideals (the spectrum Spec R) are foundational to commutative algebra and algebraic geometry.
Prime and maximal ideals are the two most important classes of ideals in commutative algebra. A proper ideal P of a commutative ring R is prime if whenever ab belongs to P, at least one of a or b belongs to P. Equivalently, the quotient ring R/P is an integral domain. A proper ideal M is maximal if there is no ideal strictly between M and R -- equivalently, R/M is a field. Since every field is an integral domain, every maximal ideal is prime. The converse fails: in the integers Z, the zero ideal (0) is prime (since Z is a domain) but not maximal (since Z is not a field).
The existence of maximal ideals relies on Zorn's lemma, an axiom equivalent to the axiom of choice. Given any proper ideal I, the collection of proper ideals containing I is partially ordered by inclusion, and every chain in this poset has an upper bound (the union, which is still a proper ideal since 1 is not in any member of the chain). Zorn's lemma then guarantees a maximal element. This argument is used constantly in commutative algebra: the existence of prime ideals containing a given ideal, the existence of minimal primes, and many localization arguments all trace back to this Zorn's lemma template.
The set of all prime ideals of R, denoted Spec R (the spectrum), is far more than a bare set. It carries the Zariski topology, making it a topological space, and a structure sheaf, making it a locally ringed space. This is the foundation of modern algebraic geometry, where commutative rings are studied through their spectra. The closed points of Spec R correspond to maximal ideals (the "geometric points"), while non-closed points correspond to non-maximal primes (generic points of subvarieties). The passage from a ring to its spectrum is a contravariant functor that converts ring homomorphisms into continuous maps.
In a Noetherian ring, every prime ideal is finitely generated, and the set of minimal primes over any ideal is finite. These finiteness results make the spectrum of a Noetherian ring well-behaved enough for dimension theory (Krull dimension = supremum of lengths of chains of prime ideals) and primary decomposition (every ideal decomposes into components "supported" at finitely many primes). Understanding prime and maximal ideals is the entry point to all of these deeper theories.