The ideal class group measures exactly how far a Dedekind domain is from being a principal ideal domain. Element factorization fails when nonprincipal prime ideals occur, while ideal factorization remains unique.
Ideal classes
Definition. Let \(I_K\) be the group of nonzero fractional ideals of \(\mathcal O_K\), and let \[ P_K=\{(\alpha)=\alpha\mathcal O_K:\alpha\in K^\times\} \] be the subgroup of principal fractional ideals. The ideal class group is \[ \operatorname{Cl}(K)=I_K/P_K, \] and its order \(h_K\) is the class number.
Proposition. The following are equivalent: \[ h_K=1;\qquad \mathcal O_K\text{ is a PID};\qquad \mathcal O_K\text{ is a UFD}. \]
Proof. The first two statements are definitions. Every PID is a UFD. Conversely, in a Dedekind domain that is a UFD, factor a nonzero element of an ideal into irreducibles and use prime ideal factorization to show every prime ideal is generated by an irreducible; then every ideal, being a product of prime ideals, is principal.
A concrete failure
Example. In \(R=\mathbb Z[\sqrt{-5}]\), \[ 6=2\cdot3=(1+\sqrt{-5})(1-\sqrt{-5}). \] All four displayed factors are irreducible and no factor on one side is associate to a factor on the other. The norm \[ N(a+b\sqrt{-5})=a^2+5b^2 \] rules out the intermediate norms needed for further factorization.
Ideal factorization resolves the ambiguity: \[ (2)=\mathfrak p_2^2,\qquad (3)=\mathfrak p_3\overline{\mathfrak p}_3,\qquad (1+\sqrt{-5})=\mathfrak p_2\mathfrak p_3. \] Both element factorizations induce the same multiset of prime ideals.
Finiteness of the class group
Theorem (Minkowski). Every ideal class of a degree-\(n\) number field with \(r_2\) complex pairs contains an integral ideal \(\mathfrak a\) satisfying \[ N\mathfrak a \le\left(\frac4\pi\right)^{r_2} \frac{n!}{n^n}\sqrt{|d_K|}. \] Consequently \(\operatorname{Cl}(K)\) is finite.
Idea of proof. Embed \(\mathcal O_K\) as a lattice in \(\mathbb R^{r_1}\times\mathbb C^{r_2}\). Minkowski's convex-body theorem finds a nonzero element of controlled norm in a lattice representing the inverse ideal class. Multiplying by that element produces an integral ideal in the desired class with bounded norm. Only finitely many ideals have norm below a fixed bound.
Binary quadratic forms
For quadratic fields, ideal classes correspond to equivalence classes of primitive binary quadratic forms \[ ax^2+bxy+cy^2,\qquad b^2-4ac=D. \] Gauss composition gives these classes a group law. This identifies questions about representing integers by quadratic forms with the arithmetic of ideal classes.
Unique factorization of ideals as a repair
The passage \[ \text{elements}\longrightarrow\text{principal ideals} \longrightarrow\text{all ideals} \] does not merely hide the failure of factorization. It identifies its exact obstruction: a product of prime ideals is generated by an element precisely when the product of their classes is trivial.