# How to derive the class number formula?

What's a simple way to derive the class number formula, if it is simpler I only need it for quadratic fields: $$\lim_{s\to 1} (s-1)\zeta_K(s)=\frac{2^{r_1}\cdot(2\pi)^{r_2}\cdot h_K\cdot \operatorname{Reg}_K}{w_K \cdot \sqrt{|D_K|}}$$ and why would we expect something like this to exist?

-
Do you want imaginary quadratic fields or real quadratic fields? The former is much easier, since the regulator is always $1$. –  David Speyer Feb 1 at 14:31
@DavidSpeyer, both but I will study the easier first. –  user58512 Feb 1 at 14:38

Look up Tom Weston's Lectures on the Dirichlet Class Number Formula for Imaginary Quadratic Fields.

The basic idea simple : there are two ways you may want to count the quadratic integers (or rather than the integers, the number of ideals).

One way is to use the additive structure of the ring of integers (involving the discriminant and the factors of $2$ and $\pi$) : in the case of imaginary quadratic fields, the numbers whose norm is less than $N$ are complex numbers distributed uniformly in a disk of radius $\sqrt N$, and their density is given by the inverse of the discriminant. Hence a quantity behaving like $2^{r_1}(2\pi)^{r_2}/ \sqrt {D_K}$

The other way is to use the multiplicative structure of the ideal group (involving the number of roots of unity, the regulator, the size of the ideal class group, and finally the $\zeta_K$ residue). Every number has a unique factorisation as a unit times a product of prime ideals.
If the class group is big, you get a lower proportion of numbers among ideals. The more roots of unity there are, the more numbers there are, and the regulator (actually there is no regulator for imaginary quadratic fields) measures "how dense" is the non torsion factor of the unit group, much like the discriminant above. The only really difficult factor to relate to is the $\zeta_K$ residue, which is all about the distribution of prime ideals in your ring of integers. Put all of those together and you get a quantity behaving like $(w_K \lim (s-1)\zeta_K(s))/ (h_K Reg_K)$

Then you say that are you are counting the same things, so those two quantities should be related, and this gives you the class number formula.

-