What is the meaning of the ideal class group? When I first learned about the ideal class group, I learned that it measures the failure of unique factorization in a number ring. The main justification for this is that a number ring has unique factorization if and only if it has class number $1$.
This is very unsatisfying though because the exact size of the class group is not used, and neither is the entire group structure of the class group. Furthermore, the dichotomy of "UFD / not UFD", while an important first step, doesn't measure the extent to which unique factorization fails, only if it fails or not. So my questions are:

*

*In what way does the exact size of the class group measure the extent to which a number ring fails to have unique factorization? (Beyond the dichotomy of class number $1$ vs. not $1$.)


*In what way does the group structure of the class group measure the extent to which a number ring fails to have unique factorization? This I have basically no feeling for: if the class group is $\mathbb{Z}/2 \times \mathbb{Z}/2$ versus $\mathbb{Z}/4$, is that difference measuring anything related to unique factorization? What is it measuring at all?
This is a question that has been asked on SE a few times before (see here and here) but the answers weren't exactly what I was looking for, so I wanted to ask it again. Thanks for the help!
 A: Everyone says the class group "measures" the failure of unique factorization, but the only sense of measuring that failure is exactly what you noticed: class number 1 vs. class number greater than 1.  That is the only justification for such terms as "measuring the failure".  Edit: By "only sense" I mean that the people who teach about ideal class groups in algebraic number theory classes have no  grander meaning in mind than the distinction $h=1$ and $h > 1$ when they speak about class groups measuring the failure of unique factorization.  There are descriptions of the structure of the ideal class group in terms of how elements factors into other elements (see the link in Bill Dubuque's comment above), but that is not what people have in mind when they speak about ideal class groups "measuring the failure" of unique factorization.
This is typical in math: you construct a group (or vector space, etc.) for each object in some family and the group is nontrivial iff some nice property doesn't hold. Let's call the nice property "wakalixes". Then you say to the world "this group measures the failure of wakalixes" and that leads generations of students to ask "What do you mean it measures the failure? What does having one nontrivial wakalixes group or some other nonisomorphic nontrivial wakalixes group actually mean?" And the answer is "All that means is that wakalixes fails in both cases." There is no other meaning intended in geneal. In number theory, topology, etc., when you try to do something and run into a gadget that is trivial when you can do what you want and nontrivial when you can't do what you want, you call the gadget "a measure of the failure" to do what you want or "an obstruction" to do what you want.
Ideal class groups have interpretations and applications that are not directly about the failure or not of unique factorization, and such applications are much more important for the role of ideal class groups in number theory than trying to intuit some down to earth meaning about a class group being cyclic of order $4$.
Maybe the following point will interest you. If you replace $\mathcal O_K$ with $\mathcal O_K[1/\alpha]$ where $\alpha$ is a nonzero element of $\mathcal O_K$ such that the ideal class group of $K$ is generated by ideal classes of the prime ideals dividing $(\alpha)$, then $\mathcal O_K[1/\alpha]$ is a PID.  For instance, $\mathbf Z[\sqrt{-5}]$ has class number 2 generated by the ideal class of the prime ideal $\mathfrak p = (2,1+\sqrt{-5})$. We have $\mathfrak p^2 = (2)$ and $\mathbf Z[\sqrt{-5},1/2]$ is a PID. More generally, for a ring of $S$-integers $\mathcal O_{K,S}$, where $S$ is a finite set of places of $K$ containing all the archimedean places, the ideal class group is a quotient group of the ideal class group of $\mathcal O_K$ (details are in the answer here), so by putting into $S$ a suitable set of primes you can gradually kill off the whole class group and you're left with a PID. In this way, the class group tells you how to enlarge $\mathcal O_K$ in a mild way to recover unique factorization while maintaining other nice properties (like a finitely generated unit group, which would not happen if you did something extreme and just replaced $\mathcal O_K$ by $K$).
When I was a grad student I was really bothered by encountering the same slogan ("it measures the failure...") in algebraic topology with homology groups. I asked a postdoc "If I told you $H_{37}(X)$ has a particular value, does that automatically mean something to you?"  And the postdoc said "Nope."
A: Maybe you can adopt another point of view: the class group measures the failure of ideals being principal.
This is more meaningful:

*

*if the class group is $\Bbb Z/2\times\Bbb Z/2$, then there are ideals that are not principal, but the square of any ideal is principal.

*if the class group of $\Bbb Z/4$, then it is even possible that the square of an ideal is still not principal.

Note however that the class group does not measure the number of generators needed for an ideal, as any ideal (of an integer ring) can be generated by two elements.

To expand more on the unique factorization part:
Let us recall that the name "ideal" comes from "ideal numbers", which were invented by Kummer when he noticed that unique factorization does not hold for the integer ring of a cyclotomic field (which was used in a famous "proof" of Fermat's last theorem).
Kummer then found that, if we add some more "numbers" to the integer ring, then we can have unique factorization. Today we understand that Kummer was talking about the unique factorization of ideals of a Dedekind domain.
These extra "numbers" are what he called "ideal numbers". Note that usual numbers (i.e. elements of the integer ring) can be viewed as ideal numbers by identifying a number with the principal ideal it generates.
It then makes sense to say that the class group measures failure of unique factorization: the class group measures "how many" extra ideal numbers should be added, so as to achieve unique factorization.
E.g. if the class group has order $4$, then we should add three times more ideal numbers to the usual numbers.
Moreover, the group structure of the class group reflects "how" the ideal numbers should be added into usual numbers. This is a bit harder to visualize, but imagine something like $\Lambda = \Bbb Z(1, 0)\oplus \Bbb Z(0, 1)$, and two ways of "adding three times more numbers": $\Lambda_1 = \Bbb Z(\frac 1 4, 0) \oplus \Bbb Z(0, 1)$ vs $\Lambda_2 = \Bbb Z(\frac 1 2, 0) \oplus \Bbb Z(0, \frac 1 2)$.
A: There's at least one satisfying result showing that it is not only the dichotomy of $CN=1$ vs $CN\ne 1$ that matters for measuring failure of unique factorization. In class number $2$, while factorizations are not unique, at least their lengths are unique, i.e. all factorizations into irreducible factors have the same number of factors. In class number $3$ and above, lengths are no longer unique.
(See Ireland & Rosen exercises 15-16 of chapter 12.)
A: The class group measures the degree to which the underlying number ring needs "help" from ideals to fix unique factorization.
For example, $\mathbf{Z}$ has a class number of 1, and so doesn't need any help.
But $\mathbf{Z}[\sqrt{-5}]$ has a class number of 2, and so we need to work with extra ideals that aren't principal.
A: You may want to read this answer, in which a domain with class number 2 is modified by overlaying the lattice of its integers with a second lattice, whose elements are sums involving two square-root terms (like $(1/2)(\sqrt{2}+\sqrt{-10})$ in the augmentation of $\mathbb Z[\sqrt{-5}]$). When multiplied pairwise, these give products that lie in the original domain. The unique factorization with this augmentation is then converted to nonunique factorizations in the original domain by pairing up the augmented-domain factors in various ways. For instance,
$6=(\sqrt{2})^2\left(\dfrac{\sqrt2+\sqrt{-10}}2\right)\left(\dfrac{\sqrt2-\sqrt{-10}}2\right)$
yields $2×3$ if the above factors are paired in one way but $(1+\sqrt{-5})(1-\sqrt{-5})$ with a different pairing.
This works with class number 2 where the class group must have a single 2-cycle, and it may be generalized for higher class numbers if the class group consists only of multiple 2-cycles (see here for an example involving class number 4). With any class group involving larger cycles, such as all class-3 domains where the class group has to have a 3-cycle or class-4 domains where the class group is $\mathbb Z/4\mathbb Z$ instead of $\mathbb Z/2\mathbb Z×\mathbb Z/2\mathbb Z$, this square root extraction does not work and if unique factorization is to be repaired at all, it requires more complex embedding.
