Hilbert, in his 9th problem, posed the problem of finding the general reciprocity law for any number field. The class field theory developed in the first half of the 20th century was successful in answering this question for finite abelian extensions of $\mathbb{Q}$. As an easy consequence of class field theory, one can reproduce the classical Kronecker-Weber theorem, that is, every finite abelian extension of $\mathbb{Q}$ is a subfield of some cyclotomic extension $\mathbb{Q}(\xi_m)$ of $\mathbb{Q}$. Hilbert's 12th problem also asked how to extend the Kronecker-Weber theorem to an arbitrary ground number field, in other words, how to describe abelian extensions of a number field more explicitly.

Motivated by the case of $\mathbb{Q}$ where all abelian extensions are obtained by adjoining the values of the exponential function, Kronecker conjectured, while he was studying elliptic functions, that all abelian extensions of an imaginary quadratic field should also arise in such a manner. This was achieved by the beautiful theory of complex multiplication, which allows one to describe all abelian extensions of an imaginary quadratic field via the values of the modular $j$-function and the Weber function, or in the language of elliptic curves, via the $j$-invariant and (certain powers of) $x$-coordinates of all torsion points of the corresponding elliptic curve. This problem for general number fields, known as Kronecker's Jugendtraum (dream of youth), is still largely open and is at the heart of current research in number theory.

In this chapter, we will start by establishing the one-one correspondence between $C({\cal O})$, the ideal class group of an order ${\cal O}$ in an imaginary quadratic field $K$, and $\Ell({\cal O})$, the set of all isomorphism classes of elliptic curves with complex multiplication by ${\cal O}$. Next, we will define the ring class field of ${\cal O}$ and then prove that it is obtained by adjoining the value $j(\mathfrak{a})$ for any proper fractional ideal of ${\cal O}$, using the method of reduction of elliptic curves. Moreover, the ray class fields of $K$ can be obtained by adjoining the values of the Weber function. Next, we will discuss the modular equation and use it to prove the integrality of $j(\mathfrak{a})$. The values of $j(\mathfrak{a})$, i.e., the values of $j(\tau)$ at the imaginary quadratic argument $\tau$, are called singular moduli as they correspond to the $j$-invariants of singular elliptic curves. We will use Weber's method to explicitly compute singular moduli for orders of class number 1. These singular moduli turn out to be highly divisible as predicted by a remarkable theorem of Gross and Zagier. Gross and Zagier's theorem on singular moduli completely determines the prime factorization of the norm of the difference between two singular moduli. Our last section will be devoted to the algebraic proof of this theorem, relying on Deuring's results on the endomorphism rings of elliptic curves.

TopComplex multiplication

As we saw in the first chapter, for a complex elliptic curve $E=\mathbb{C}/\Lambda$, the endomorphism ring $\End(E)$ can be identified with $\{\alpha\in\mathbb{C}\mid \alpha\Lambda\subseteq\Lambda\}$. When $E$ has complex multiplication, $\{\alpha\in\mathbb{C}\mid \alpha\Lambda\subseteq\Lambda\}$ is an order ${\cal O}$ in an imaginary quadratic extension $K$ of $\mathbb{Q}$. Though complex conjugation will give us two isomorphisms between $K$ and $\End(E)\otimes\mathbb{Q}$, we do have a canonical way to identify ${\cal O}$ with $\End(E)$. Namely, for every $\alpha\in {\cal O}\subseteq K$, we identify it with the endomorphism $[\alpha]$ of $E$ induced by the multiplication $\alpha: \mathbb{C}\rightarrow\mathbb{C}$. In other words, the effect of $[\alpha]$ on the invariant differential is given by $[\alpha]^*\omega=\alpha\cdot\omega$. We call this identification the normalized identification.

Example 1 Let $E: y^2=x^3+x$, then $j(E)=1728$, $\#\Aut(E)=4$ and $E$ has complex multiplication by $\mathbb{Z}[i]$. The normalized identification is given by the endomorphism $[i](x,y)=(-x,iy)$, since $[i]^*(dx/y)=d(-x)/(iy)=i(dx/y)$.
Example 2 Let $E: y^2=x^3+1$, then $j(E)=0$, $\#\Aut(E)=6$ and $E$ has complex multiplication by $\mathbb{Z}[\rho]$, where $\rho=e^{2\pi i/3}$. The normalized identification is given by the endomorphism $[\rho](x,y)=(\rho x,y)$, since $[\rho]^*(dx/y)=d(\rho x)/y=\rho(dx/y)$.

Fix an order ${\cal O}$ in $K$. We are interested in studying all complex elliptic curves with endomorphism ring ${\cal O}$. We denote the set of all these isomorphism classes by $\Ell({\cal O})$. As we will see in Theorem 1, it turns out that $\Ell({\cal O})$ is in bijection with a purely algebraic object constructed from ${\cal O}$, namely the ideal class group of ${\cal O}$.

Definition 1 Let $K$ and ${\cal O}$ be as above. Let $\mathfrak{a}$ be a fractional ideal of ${\cal O}$, then $\{\beta\in K\mid \beta \mathfrak{a} \subseteq \mathfrak{a} \}$ is a ring and contains the order ${\cal O}$, so it is also an order. We say that $\mathfrak{a}$ is proper if $\{\beta\in K\mid \beta \mathfrak{a} \subseteq \mathfrak{a} \}$ is equal to ${\cal O}$.
Definition 2 The set of all proper fractional ideals of ${\cal O}$, denoted by $I({\cal O})$, forms a group ([1, 4.11]), called the ideal group of ${\cal O}$. Denote by $P({\cal O})$ the subgroup of principal proper fractional ideals. The quotient group $C({\cal O})=I({\cal O})/P({\cal O})$ is called the ideal class group of ${\cal O}$. When ${\cal O}$ is the ring of integers ${\cal O}_K$, we recover the ideal class group of $K$ in the usual sense.
Remark 1 A fractional ideal of ${\cal O}$ is proper if and only if it is locally principal ([1, 5.4.2]), hence $C({\cal O})$ can be viewed as the reduced Grothendieck group $\tilde{K_0}({\cal O})$, i.e., the group of projective ${\cal O}$-modules of rank 1 ([2]).
Theorem 1 Let $E$ be a complex elliptic curve with $\End(E)\cong{\cal O}$, then $E\cong\mathbb{C}/\mathfrak{a}$ for some proper fractional ideal $\mathfrak{a}$ of ${\cal O}$. Moreover, $\mathbb{C}/\mathfrak{a}\cong\mathbb{C}/\mathfrak{b}$ if and only $\mathfrak{a}$ and $\mathfrak{b}$ are in the same ideal class. Conversely, for every proper fractional ideal $\mathfrak{a}$, $\End(\mathbb{C}/\mathfrak{a})\cong{\cal O}$.

In other words, the above correspondence gives a bijection $\Ell({\cal O})\cong C({\cal O})$.

Proof Since $E$ is a complex elliptic curve, by Example 1 we know that $E\cong\mathbb{C}/\Lambda$ for some lattice $\Lambda=\mathbb{Z}+\mathbb{Z}\tau$ for some $\tau\in K$ . We can view $\Lambda$ as a fractional ideal $\mathfrak{a}$ of ${\cal O}$. Then, under the normalized identification, $${\cal O}=\End(\mathbb{C}/\mathfrak{a})=\{\beta\in\mathbb{C}\mid\beta\mathfrak{a} \subseteq \mathfrak{a}\}=\{\beta\in K\mid \beta \mathfrak{a} \subseteq \mathfrak{a} \}.$$ Therefore $\mathfrak{a}$ is a proper fractional ideal. Moreover, $\mathbb{C}/\mathfrak{a}\cong\mathbb{C}/\mathfrak{b}$ if and only if $\mathfrak{a}=\alpha \mathfrak{b}$ for some $a\in K^*$, if and only if $\mathfrak{a}$ and $\mathfrak{b}$ are in the same ideal class, since every principal fractional ideal is automatically proper.

Conversely, suppose $\mathfrak{a}$ is a proper fractional ideal, then $\{\beta\in K\mid \beta \mathfrak{a} \subseteq \mathfrak{a}\}={\cal O}$, hence $\End(\mathbb{C}/\mathfrak{a})\cong{\cal O}$. ¡õ

We will soon see that $C({\cal O})$ is a finite group. The order of $C({\cal O})$, denoted by $h({\cal O})$, is called the class number of ${\cal O}$. So by Theorem 1, there are exactly $h({\cal O})$ isomorphism classes of elliptic curves with complex multiplication by ${\cal O}$ and each of them corresponds to an ideal class of ${\cal O}$. Let $E$ be an elliptic curve with $\End(E)\cong{\cal O}$, then for any automorphism $\sigma$ of $\mathbb{C}$, $E^\sigma$ is also an elliptic curve with $\End(E)\cong{\cal O}$. So by the finiteness of the ideal class group and the above correspondence between $\Ell({\cal O})$ and $C({\cal O})$, we know $j(E)^\sigma$ has finitely many values, hence $j(E)$ is an algebraic number of degree at most $h({\cal O)}$.

An amazing fact is that for an elliptic curve $E$ with complex multiplication by ${\cal O}$, $j(E)$ is actually an algebraic integer of degree $h({\cal O})$ (Theorem 8). In particular, an elliptic curve with complex multiplication has a rational $j$-invariant if and only $h({\cal O})=1$. We will calculate these $j$-invariants later.

TopRing class fields

Let $K$ be an imaginary quadratic extension of $\mathbb{Q}$ of discriminant $d_K$. The ring of integers ${\cal O}_K$ of $K$ is equal to $\mathbb{Z}+\mathbb{Z}\omega_K$ where $\omega_K=\frac{d_K+\sqrt{d_K}}{2}$. Every order ${\cal O}$ of $K$ is a free $\mathbb{Z}$-module of rank 2, hence is of the form ${\cal O}=\mathbb{Z}+f{\cal O}_K$, where the positive integer $f$ is called the conductor of ${\cal O}$. When $f=1$, ${\cal O}={\cal O}_K$ is the maximal order and is a Dedekind domain. But when $f>1$, ${\cal O}$ is not integrally closed and hence is not a Dedekind domain. So it is not necessary for the unique factorization to hold for ideals in ${\cal O}$. For example, ${\cal O}=\mathbb{Z}[\sqrt{-3}]$ is an order of conductor 2 of $K=\mathbb{Q}(\sqrt{-3})$, and the ideal $(4)$ has two different prime factorizations $(2)^2=(1-\sqrt{-3})(1+\sqrt{-3})$. However, we will see that the situation becomes better when we restrict our attention to the ideals prime to $f$.

Proposition 1 Every ideal of ${\cal O}$ prime to $f$ is proper. An ideal $\mathfrak{a}$ of ${\cal O}$ is prime to $f$ if and only if $N(\mathfrak{a})$ is prime to $f$.
Proof Suppose $\mathfrak{a}$ is an ideal of ${\cal O}$ prime to $f$. By definition, $\mathfrak{a}+f{\cal O}={\cal O}$. Suppose $\beta\in K$ such that $\beta \mathfrak{a}\subseteq \mathfrak{a}$, then $$\beta{\cal O}=\beta(\mathfrak{a}+f{\cal O})=\beta \mathfrak{a}+\beta f{\cal O}\subseteq \mathfrak{a} +f{\cal O}_K\subseteq {\cal O}.$$ Hence $\beta\in{\cal O}$. It follows that $\mathfrak{a}$ is proper.

Next, let $m_f:{\cal O}/\mathfrak{a}\rightarrow{\cal O}/\mathfrak{a}$ be multiplication by $f$. Then $a+f{\cal O}={\cal O}$ if and only if $m_f$ is surjective. But ${\cal O}/\mathfrak{a}$ is an finite abelian group of order $N(\mathfrak{a})$, so $m_f$ is surjective if and only if $N(\mathfrak{a})$ is prime to $f$. ¡õ

Therefore the ideals prime to $f$ are in $I({\cal O})$ and are closed under multiplication. They generate a subgroup of fractional ideals $I({\cal O},f)\subseteq I({\cal O})$. Similarly define $P({\cal O},f)$. Given any integer $m$, every ideal class in $C({\cal O})$ contains an ideal prime to $m$ ([3, 7.17]). So the natural inclusion induces a surjective map $I({\cal O},f)\rightarrow C({\cal O})$. Moreover, the kernel of this surjective map is $P({\cal O},f)$, so we have an isomorphism $I({\cal O},f)/P({\cal O},f)\cong C({\cal O})$ ([3, 7.19]).

Since ${\cal O}_K$ is a Dedekind domain, the first part of the next Proposition 2 ([3, 7.20, 7.22]) tells us that unique factorization does hold for fractional ideals of ${\cal O}$ prime to $f$.

Proposition 2 The map $\mathfrak{a}\mapsto \mathfrak{a}\cap{\cal O}$ induces an isomorphism $I({\cal O}_K,f)\cong I({\cal O},f)$, and the inverse map is given by $\mathfrak{a}\mapsto \mathfrak{a}{\cal O}_K$. The isomorphism $I({\cal O}_K,f)\cong I({\cal O},f)$ induces an isomorphism $I({\cal O}_K,f)/P_{K,\mathbb{Z}}(f)\cong I({\cal O},f)/P({\cal O},f)$, where $$P_{K,\mathbb{Z}}(f)=\{\alpha{\cal O}_K\in I_K(f)\mid \alpha\equiv a \pmod{f{\cal O}_K}, a\in\mathbb{Z}, \gcd(a,f)=1\}.$$

Viewing $f$ as a cycle of $K$, we know that $I_K(f)=I({\cal O}_K,f)$ and that $P_{K,\mathbb{Z}}$ is a subgroup of $I_K(f)$ containing $P_{K,f}$ (we use the symbols for generalized ideal groups as in [4, VI]). Hence, by class field theory, $P_{K,\mathbb{Z}}$ corresponds to a finite abelian extension $H$ of $K$.

Definition 3 The class field $H$ of the subgroup $P_{K,\mathbb{Z}}(f)$ is called the ring class field of ${\cal O}$.

Combining the isomorphism $I({\cal O},f)/P({\cal O},f)\cong C({\cal O})$ and the second part of Proposition 2, we know that $C({\cal O})\cong I_K(f)/P_{K,\mathbb{Z}}(f)$, and composing with the Artin map we obtain an isomorphism $C({\cal O})\cong\Gal(H/K)$. In particular, $C({\cal O})$ is a finite group. Again, when $f=1$, i.e., ${\cal O}$ is the maximal order ${\cal O}_K$, the ring class field of ${\cal O}$ is just the usual Hilbert class field of $K$. So we may regard the ring class field as a generalization of the Hilbert class field.

Remark 2 The ring class field of the order $\mathbb{Z}[-\sqrt{n}]$ is related to the classical problem of determining the primes of the form $x^2+ny^2$ studied by Fermat, Euler, Lagrange, Legendre and Gauss. More precisely, let $\alpha$ be a real algebraic integer such that the ring class field $H=K(\alpha)$ and let $f_n(x)$ be its minimal polynomial, then for odd $p $ dividing neither $n$ nor the discriminant of $f_n(x)$, we have $$p=x^2+ny^2\Longleftrightarrow\legendre{-n}{p}=1 \text{ and } f_n(x)\equiv0\pmod{p}\text{ has an integer solution}.$$ See [3] for this beautiful story.

TopMain theorems of complex multiplication

The first main result of this section is the ``First Main Theorem'' of complex multiplication, which says the ring class field of ${\cal O}$ can be obtained by adjoining the value of $j$-function at any proper ideal of ${\cal O}$. The key step of the proof is to establish the so-called Hasse congruence (Theorem 2), which expresses the Frobenius action on the value of the $j$-function via the action on the argument of the $j$-function. There are several different approaches to do so: the complex analytic method using the modular equation, or the algebraic method we choose here using the reduction of elliptic curves. We follow mainly the exposition of [5] and [3].

First, by using Chebotarev's density theorem, one can show the following characterization of field extensions by the primes which split completely ([3, 8.20]). We will utilize this Lemma 1 twice to characterize the ring class field in Lemma 2.

Lemma 1 Let $F$ be a number field. Let $L$ be a finite Galois extension of $F$ and $M$ be a finite extension of $F$. Then $L\subseteq M$ if and only if for all but finitely many unramified primes $\mathfrak{p}$ of $F$ which have a degree 1 prime $\mathfrak{P}$ of $M$ above $\mathfrak{p}$, $\mathfrak{p}$ splits completely in $L$.

From now on, let us fix an order ${\cal O}$ of conductor $f$ in an imaginary quadratic field $K$. Let $\mathfrak{a}_1, \ldots, \mathfrak{a}_h$ ($h=h({\cal O})$) be the representatives of the ideal class group $C({\cal O})$ and $E_1,\ldots, E_h$ be the corresponding elliptic curves with complex multiplication by ${\cal O}$ via Theorem 1. Let $L=K(j(\mathfrak{a}_1),\ldots,j(\mathfrak{a}_h))$.

Lemma 2 Let $p $ be a prime which splits as $p{\cal O}=\mathfrak{p}\mathfrak{p}'$. If for all but finitely many such $p $, we have the congruence $$j(\mathfrak{p}\mathfrak{a})^p\equiv j(\mathfrak{a})\pmod{\mathfrak{P}}$$ for any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$ and any prime $\mathfrak{P}$ of $L$ over $p $, then $L$ is the ring class field of ${\cal O}$ for any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$.
Proof Let $H$ be the ring class field of ${\cal O}$. Let us first show that $H\subseteq L$. Suppose $p $ is a unramified prime of $\mathbb{Q}$ and $\mathfrak{P}$ is a degree 1 prime of $L$ over $p $. By Lemma 1, it suffices to show that for all but finitely many such $p $, $p $ splits completely in $H$. Since $\mathfrak{P}$ is of degree 1, we already know that $p $ must split completely as $p{\cal O}=\mathfrak{p}\mathfrak{p}'$ in $K$ for some primes $\mathfrak{p}, \mathfrak{p}'$ of ${\cal O}$. By the assumption, for all but finitely many such $p $, we have $$j(\mathfrak{a})\equiv j(\mathfrak{p}\mathfrak{a})^p\equiv j(\mathfrak{p}\mathfrak{a})\pmod{\mathfrak{P}},$$ where the second equality is because $\mathfrak{P}$ has degree 1. Excluding the finitely many primes $p $ such that $\mathfrak{P}$ divides any of the differences $j(\mathfrak{a}_m)-j(\mathfrak{a}_n)$, we conclude that $j(\mathfrak{a})=j(\mathfrak{p}\mathfrak{a})$ for all but finitely many primes $p $. So $\mathfrak{p}$ is a principal ideal of ${\cal O}$ and hence has trivial Artin symbol, therefore $p $ splits completely in $H$.

Next let us show that $L\subseteq H$. Let $M$ be the Galois closure of $L$. Suppose $p $ is a prime which splits completely in $H$. Again by Lemma 1, it suffices to show that for all but finitely such $p $, $p $ splits completely in $M$. Since $p $ splits completely in $H$, $\mathfrak{p}$ must be a principal ideal of ${\cal O}$ and then $j(\mathfrak{p}\mathfrak{a})=j(\mathfrak{a})$. So by assumption, $$j(\mathfrak{a})^p\equiv j(\mathfrak{a})\pmod{\mathfrak{P}}$$ for all but finitely many such $p $ and any prime $\mathfrak{P}$ of $M$ above $p $. Now suppose further that $p $ does not divide the index $[{\cal O}_L:{\cal O}_K(j(\mathfrak{a}))]$, then we have $$\alpha^p\equiv \alpha\pmod{\mathfrak{P}}$$ for any $\alpha\in{\cal O}_L$, hence $\mathfrak{P}$ has degree 1 for any $\mathfrak{P}$ above $p $. Therefore $p $ splits completely in $M$. ¡õ

Theorem 2 Let $p $ be a prime satisfying that $\gcd(p,f)=1$, $p $ splits as $p{\cal O}=\mathfrak{p}\mathfrak{p}'$ and the $E_i$'s have good reduction at $p $. Then for any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$ and any prime $\mathfrak{P}$ of $L$ above $p $, we have the Hasse congruence $$j(\mathfrak{p}\mathfrak{a})^p\equiv j(\mathfrak{a})\pmod{\mathfrak{P}}.$$
Proof Since $\gcd(p,f)=1$, $\mathfrak{p}$ and $\mathfrak{p}'$ are proper. We may assume that $\mathfrak{a}_1$ and $\mathfrak{a}_2$ represent $\mathfrak{a}$ and $\mathfrak{p}\mathfrak{a}$ in the ideal classes. Then $E_1=\mathbb{C}/\mathfrak{a}$, $E_2=\mathbb{C}/\mathfrak{p}\mathfrak{a}$ and we have a natural isogeny $\lambda:E_2\rightarrow E_1$ since $\mathfrak{p}\mathfrak{a}\subseteq \mathfrak{a}$. Because $p $ splits completely, we know that $\deg\lambda=\#(\mathfrak{a}/\mathfrak{p}\mathfrak{a})=N(\mathfrak{p})=p$. Now find an ideal $\mathfrak{b}$ prime to $p $ in the ideal class of $\mathfrak{p}'$, then $\mathfrak{b}\mathfrak{p}$ is a principal ideal generated by some $\alpha\in \mathfrak{p}$. Therefore $\alpha (\mathfrak{a})\subseteq \mathfrak{p}\mathfrak{a} $ induces an isogeny $\mu: E_1\rightarrow E_2$ and $\deg \mu=\#(\mathfrak{p}\mathfrak{a}/\alpha(\mathfrak{a}))=N(\mathfrak{b})$ is prime to $p $ by our choice of $\mathfrak{b}$. The composition $\lambda\circ\mu:E_1\rightarrow E_1$ is given by $\alpha\in \End(E_1)$ via the normalized identification of ${\cal O}$ and $\End(E_1)$.

Now since the $E_i$'s have good reduction at $p $, reducing modulo $\mathfrak{P}$ we get an isogeny $\tilde\lambda\circ\tilde\mu=\tilde\alpha\in \End(\widetilde{E_1})$. But $\alpha\in \mathfrak{p}$, so $\tilde\alpha^*(\omega)=\tilde\alpha\cdot\omega=0$ where $\omega$ is the invariant differential of $\widetilde{E_1}$. Therefore $\tilde\alpha$ is inseparable. As the reduction does not change the degree of an isogeny, $\deg\tilde\mu=\deg\mu$ is prime to $p $, hence $\deg\tilde\mu$ is separable. We conclude that $\tilde\lambda$ is inseparable. But $\deg\tilde\lambda=\deg\lambda=p$, hence $\tilde\lambda$ is purely inseparable. So $\tilde\lambda$ is the composition of the $p $-Frobenius $\widetilde{E_2}\rightarrow \widetilde{E_2}^{(p)}$ and an isomorphism $\widetilde{E_2}^{(p)}\rightarrow \widetilde{E_1}$. Hence $$j(E_2)^{p}\equiv j(E_1)\pmod{\mathfrak{P}}$$ and the claim follows. ¡õ

From Theorem 2 and Lemma 2, we already know that $K(j(\mathfrak{a}_1,\ldots,\mathfrak{a}_h))$ is actually the ring class field $H$ of ${\cal O}$. Further more, we can use the limited information of the Hasse congruence to compute the Galois action on the $j$-values.

Theorem 3 For any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$ and $\sigma\in \Gal(H/K)$, we have $$j(\mathfrak{p}\mathfrak{a})^\sigma=j(\mathfrak{a})$$ for any proper ideal $\mathfrak{p}=\mathfrak{q}\cap{\cal O}$, where $\mathfrak{q}$ is a prime of $K$ whose Artin symbol is $\sigma$. In particular, $\{j(\mathfrak{a}_1), \ldots, j(\mathfrak{a}_h)\}$ is the Galois orbit of $j(\mathfrak{a})$ for any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$ and $[\mathbb{Q}(j(\mathfrak{a})):\mathbb{Q}]=[K(j(\mathfrak{a})):K]=h$, where $h=h({\cal O})$.
Proof By Chebotarev's density theorem, there are infinite many degree 1 primes $\mathfrak{q}$ of $K$ whose Artin symbol is $\sigma$. By Theorem 2, for all but finitely many such primes $\mathfrak{q}$ (excluding those not prime to $f$), we have $$j(\mathfrak{p}\mathfrak{a})^\sigma\equiv j(\mathfrak{p}\mathfrak{a})^p\equiv j(\mathfrak{a})\pmod{\mathfrak{P} },$$ where $\mathfrak{p}=\mathfrak{q}\cap{\cal O}$ is proper and $\mathfrak{P}$ is any prime of $H$ over $p $. Since these $\mathfrak{p}$'s have the same Artin symbol, they must lie in the same ideal class of ${\cal O}$. So $j(\mathfrak{p}\mathfrak{a})^\sigma-j(\mathfrak{a})$ is the same for every $\mathfrak{p}$ and has infinitely many prime factors, therefore it must be zero. We conclude that $j(\mathfrak{p}\mathfrak{a})^\sigma=j(\mathfrak{a})$. The remaining part follows since $[K:\mathbb{Q}]\le2$ and we already know $[\mathbb{Q}(j(\mathfrak{a})):\mathbb{Q}]\le h$. ¡õ

Now we are in a position to prove the First Main Theorem of complex multiplication.

Theorem 4 (First Main Theorem) $K(j(\mathfrak{a}))$ is the ring class field of ${\cal O}$ for any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$. In particular, $K(j({\cal O}_K))$ is the Hilbert class field of $K$.
Proof This follows directly from Theorem 2, Lemma 2 and Theorem 3. ¡õ
Remark 3 Theorem 4 gives us a primitive element $\alpha=j(\sqrt{-n})$ as in Remark 2.

As a consequence of the First Main Theorem 4, all everywhere unramified extensions of $K$ can be obtained as a subfield of $K(j({\cal O}_K))$. Moreover, one can show that an abelian extension of $K$ is generalized dihedral over $\mathbb{Q}$ if and only if it is contained in the ring class field of some order in $K$ ([3, 9.18]), so the First Main Theorem also tells us how to construct generalized dihedral extensions explicitly. Now, it is natural to ask how to generate all abelian extensions of $K$, in other words, how to give an explicit description of the ray class fields of $K$. This is the content of the ``Second Main Theorem'' of complex multiplication.

Definition 4 Let $E$ be an elliptic curve with a Weierstrass model $y^2=4x^2-g_2x-g_3$. For any $P\in E$, define the Weber function 
  \begin{equation*}
    h(P,E)=
    \begin{cases}
      \displaystyle\frac{g_2g_3}{\Delta} x(P), & j(E)\ne0,1728, \\
      \displaystyle\frac{g_2^2}{\Delta} x(P)^2, & j(E)=1728, \\
      \displaystyle\frac{g_3}{\Delta} x(P)^3, & j(E)=0.
    \end{cases}
  \end{equation*}
So the Weber function is essentially the $x$-coordinate function on the elliptic curve $E$. Notice that the powers of the coordinate $x(P)$ and the normalized constants appearing in the expression are chosen in the way that $h(P,E)$ is invariant under the isomorphisms of elliptic curves. In the language of lattices, we may define the Weber function $h(z,\Lambda)$ as follows: 
  \begin{equation*}
    h(z,\Lambda)=
    \begin{cases}
      \displaystyle\frac{g_2(\Lambda)g_3(\Lambda)}{\Delta(\Lambda)}\wp(z,\Lambda), & g_2(\Lambda),g_3(\Lambda)\ne0, \\
      \displaystyle\frac{g_2(\Lambda)^2}{\Delta(\Lambda)}\wp(z,\Lambda)^2, & g_3(\Lambda)=0, \\
      \displaystyle\frac{g_3(\Lambda)}{\Delta(\Lambda)}\wp(z,\Lambda)^3, & g_2(\Lambda)=0.
    \end{cases}
  \end{equation*}

Now let us establish an analog of the Hasse congruence for the Weber function.

Theorem 5 Let $z\in K$ and $L$ be an extension of $K$ containing all $j(\mathfrak{a}_i)$'s and $h(z,\mathfrak{a}_i)$'s. Let $p $ be a prime satisfying $\gcd(p,f)=1$, $p $ splits as $p{\cal O}=\mathfrak{p}\mathfrak{p}'$ and $E_i$'s have good reduction at $p $. Then for any proper fractional ideal $\mathfrak{a}$ of ${\cal O}$ and any prime $\mathfrak{P}$ of $L$ above $p $, we have the congruence $$h(z,\mathfrak{p}\mathfrak{a})^p\equiv h(z,\mathfrak{a})\pmod{\mathfrak{P}}.$$
Proof We proceed as the proof of Theorem 2 and obtain an isogeny $\tilde\lambda: \widetilde{E_2}\rightarrow\widetilde{E_1}$ which is the composition of the $p $-Frobenius $\widetilde{E_2}\rightarrow\widetilde{E_2}^{(p)}$ and an isomorphism $\widetilde{E_2}^{(p)}\rightarrow\widetilde{E_1}$. Since the Weber function is invariant under isomorphisms, we know that $$h(P, E_2)^p\equiv h(\lambda(P), E_1)\pmod{\mathfrak{P}}$$ and the claim follows since $\lambda$ is just the natural projection. ¡õ

After the congruence in Theorem 5 is established, a similar argument as for ring class fields will allow us to construct all the ray class fields of $K$. We state this Second Main Theorem and omit the details of the proof here. Roughly speaking, the maximal abelian extension of $K$ is generated by $j({\cal O}_K)$ and the $x$-coordinates of all torsion points of the corresponding elliptic curve with complex multiplication by ${\cal O}_K$. See [3, 11.39] and [6, II.5] for more.

Theorem 6 (Second Main Theorem) Let $\mathfrak{a}$ be an ideal of ${\cal O}_K$ and $E$ be an elliptic curve with complex multiplication by ${\cal O}_K$. Let $E[\mathfrak{a}]=\{P\in E\mid [\alpha]P=O, \alpha\in \mathfrak{a}\}$ be the $\mathfrak{a}$-torsion points of $E$, then $K(j(E), h(E[\mathfrak{a}],E))$ is the ray class field of $K$ with respect to the cycle $\mathfrak{a}$. In particular, the maximal abelian extension of $K$ is equal to $K(j(E), h(E_\mathrm{tor},E))$.

TopModular equations and the integrality of singular moduli

We have seen that $j(\mathfrak{a})$ is an algebraic number of degree $h({\cal O})$ from Theorem 3. But in fact more is true: it is an algebraic integer. There are several possible proofs of this fact: the complex analytic proof using the modular equation, the good reduction proof due to Serre and Tate, and the bad reduction proof due to Serre ([6, II.6]). We have not talked much about the analytic aspect of $j$-function so far, so we will choose the first approach here.

Let us first recall some facts about the modular curve $X_0(N)$, which plays an important role in modern number theory. The modular curve $X_0(N)$ is a compact Riemann surface constructed by compactifying $\Gamma_0(N)\backslash{\cal H}$, the quotient of upper half plane by the congruence group $\Gamma_0(N)$. It is the compactification of the moduli space of elliptic curves along with the level structure of a cyclic subgroup of order $N$. Viewing $X_0(N)$ as a complex algebraic curve, the function field of $X_0(N)$ is equal to $\mathbb{C}(j(N\tau),j(\tau))$. So $X_0(N)$ has a planar model defined by some complex polynomial $\Phi_N(X,Y)$ satisfying $\Phi_N(j(N\tau),j(\tau))=0$, called the modular equation of level $N$ ([7]).

An unexpected result is that the modular equation $\Phi_N(X,Y)$ in fact has rational, or even better, integer coefficients. Therefore, $X_0(N)$ can be defined as an algebraic curve over $\mathbb{Q}$ without reference to the complex numbers and it has a planar model over $\mathbb{Q}$ defined by the modular equation. The goal of this section is to prove this unexpected fact and deduce the integrality of $j(\mathfrak{a})$ as a consequence.

To define the modular equation, we need the following lemma.

Lemma 3 (Hasse $q$-expansion principle) Let $f(\tau)$ be a modular function with respect to $\Gamma(1)$ with the $q$-expansion $\sum\limits_{n=-t}^\infty c_nq^n$. Then $f$ can be expressed as a polynomial of degree $t$ in $\mathbb{Z}[c_{-t},\ldots,c_0][j(\tau)]$. In particular, if $c_i$'s are integers, then this polynomial has integer coefficients.
Proof The proof is by induction on $t$. When $t=0$, $f(\tau)$ is a holomorphic function on the compact Riemann surface $X(1)$, hence it must be the constant $c_0$. When $t>0$, since $j(\tau)$ has $q$-expansion $\frac{1}{q}+744+\cdots$ with integer coefficients, the leading term of the $q$-expansion of $f-c_{-t}j^t$ is $(c_{1-t}-744)q^{1-t}$ and all the coefficients are in $\mathbb{Z}[c_{1-t},\ldots,c_0]$. Now applying the induction hypothesis, we know $f-c_{-t}j^t\in \mathbb{Z}[c_{1-t},\ldots,c_0][j]$ is a polynomial of degree $t-1$. The lemma follows. ¡õ
Definition 5 Let $$\Delta_N=
\left\{
  A=\begin{bmatrix}
    a & b \\
    c & d
  \end{bmatrix} : \det(A)=N, \gcd(a,b,c,d)=1
\right\}.$$ Suppose $\{\gamma_i\}$ is a set of orbit representatives for the left action of $\Gamma(1)$ on $\Delta_N$. We define $$\Phi_N(X, j(\tau))=\prod_i (X-j(\gamma_i\tau)).$$ Then the coefficients of $X$ in $\Phi_N(X,j(\tau))$ are modular functions of $\Gamma(1)$, hence by Lemma 3, these coefficients of $X$ are polynomials in $j(\tau)$. So $\Phi_N(X, Y)$ is a polynomial, called the modular polynomial or the modular equation of level $N$.

Since $\begin{bmatrix}
  N & 0 \\
  0 & 1
\end{bmatrix}\in\Delta_N$, it follows immediately that $\Phi_N(j(N\tau),j(\tau))=0$. Also, it is an easy computation ([5, 4.5]) to see that the set of orbit representatives can be chosen as $$C(N)=
  \left\{
    \begin{bmatrix}
      a & b \\
      0 & d
    \end{bmatrix}
    : ad=N, a>0, 0\le b <d, \gcd(a,b,d)=1
  \right\}.$$

Theorem 7 The modular equation $\Phi_N(X, Y)\in\mathbb{Z}[X, Y]$. Moreover, when $N$ is not a perfect square, the leading coefficient of $\Phi_N(X,X)$ is $\pm1$.
Proof By Lemma 3, to show $\Phi_N(X, Y)\in\mathbb{Z}[X, Y]$, it suffices to show that the $q$-expansions of $\Phi_N(X,j(\tau))$ have integer coefficients. Using the orbit representatives in $C(N)$, we find that for $\gamma_i=
  \begin{bmatrix}
    a & b \\
    0 & d
  \end{bmatrix}$, $j(\gamma_i\tau)$ has a Fourier expansion in $q^{a/d}$ with coefficients in $\mathbb{Z}[\xi]$ where $\xi=e^{2\pi i/N}$, hence the coefficients of $q$-expansions of $\Phi_N(X, j(\tau))$ are in $\mathbb{Z}[\xi]$. For an integer $r$ prime to $N$, the map $$
\begin{bmatrix}
  a & b \\
  0 & d
\end{bmatrix}\mapsto
\begin{bmatrix}
  a & br\!\! \mod{d} \\
  0 & d
\end{bmatrix}$$ is a permutation of $C(N)$, hence it leaves $\Phi_N(X, j(\tau))$ unchanged. But this map has an action $\xi\mapsto\xi^r$ on the coefficients, therefore the coefficients are actually in $\mathbb{Z}$. So $\Phi_N(X, Y)\in\mathbb{Z}[X,Y]$.

Now suppose $N$ is not a perfect square. The leading coefficient of $\Phi_N(X,X)$ is the same as the leading coefficient of the $q$-expansion of $\Phi_N(j(\tau), j(\tau))$, so let us show that the latter is $\pm1$. Now $j(\tau)$ begins with $q^{-1}$ and $j(\gamma_i\tau)$ begins with $\xi^dq^{-a/d}$, so since $N$ is not a perfect square and $ad=N$, we know that $q^{-1}$ and $\xi^dq^{-a/d}$ cannot cancel out, hence the leading coefficient of $j(\tau)-j(\gamma_i\tau)$ is a root of unity. Multiplying them together, we know that the leading coefficient of $\Phi_N(j(\tau),j(\tau))$ is a root of unity. But we already know it is an integer, hence it must be $\pm1$. ¡õ

Example 3 The first two modular equations are computed as 
  \begin{align*}
    \Phi_1(X,Y)&=X-Y, \\
    \Phi_2(X,Y)&=X^3+Y^3-X^2Y^2+2^4\cdot3\cdot31(X^2Y+Y^2X)-2^4\cdot3^4\cdot5^3(X^2+Y^2) \\
    &\quad+3^4\cdot5^3\cdot4027XY+2^8\cdot3^7\cdot5^6(X+Y)-2^{12}\cdot3^8\cdot5^9.
  \end{align*}
See [3, 13.B] for an algorithm of computing the modular equations. However, it is usually cumbersome to do the computation even for small levels. The $N=3$ case was computed by Smith in 1878; the $N=5$ case was computed by Berwick in 1916; the $N=7$ case was computed by Herrmann in 1974 and the $N=11$ case was computed by Kaltofen and Yui using MACSYMA in 1984. The resulting polynomial $\Phi_{11}(X,Y)$ is of degree 21 with coefficients up to $10^{60}$ and needs 5 pages to be written out.

Now we are in a position to prove the integrality of the singular moduli.

Theorem 8 Let ${\cal O}$ be an order in an imaginary quadratic field $K$ and $\mathfrak{a}$ be a proper fractional ideal of ${\cal O}$. Then $j(\mathfrak{a})$ is an algebraic integer of degree $h({\cal O})$.
Proof By Chebotarev's density theorem, there are infinitely many degree 1 primes of ${\cal O}$ in the principal ideal class. Let $\mathfrak{p}$ be such a prime. Then $\mathfrak{a}/\mathfrak{p}\mathfrak{a}\cong\mathbb{Z}/p\mathbb{Z}$ where $p=N(\mathfrak{p})$ is a prime. We may assume that $\mathfrak{a}=\mathbb{Z}+ \mathbb{Z}\tau$, then $\mathfrak{p}\mathfrak{a}$ is homothetic to $\mathbb{Z}+\mathbb{Z}\gamma\tau$ for some $\gamma\in\Delta_p$ ([3, 11.24]). We know that $\Phi_p(j(\mathfrak{a}),j(\mathfrak{p}\mathfrak{a}))=0$ by definition. But $j(\mathfrak{p}\mathfrak{a})=j(\mathfrak{a})$ by our choice of $\mathfrak{p}$. Hence by Theorem 7, $j(\mathfrak{a})$ satisfies the polynomial $\Phi_p(X,X)\in\mathbb{Z}[X]$ with leading coefficient $\pm1$ and therefore $j(\mathfrak{a})$ is an algebraic integer. Moreover, we know that its degree is $h({\cal O})$ from Theorem 3. ¡õ

TopWeber's computation of singular moduli

As an application of Proposition 2, we get an exact sequence $$0\rightarrow I_K(f)\cap P_K/P_{K,\mathbb{Z}}(f)\rightarrow C({\cal O})\rightarrow C({\cal O}_K)\rightarrow 0.$$ Hence the class numbers of ${\cal O}$ and ${\cal O}_K$ are related by $$h({\cal O})=\#(I_K(f)\cap P_K/P_{K,\mathbb{Z}}(f))\cdot h({\cal O}_K).$$ One can show that there is an exact sequence ([3, Exercise 7.30]) $$0\rightarrow \{\pm1\}\rightarrow(\mathbb{Z}/f\mathbb{Z})^*\times {\cal O}_K^*\rightarrow({\cal O}_K/f{\cal O}_K)^*\rightarrow I_K(f)\cap P_K/P_{K,\mathbb{Z}}(f)\rightarrow0.$$ Therefore we are able to reproduce the following formula due to Gauss for the class number of an order ${\cal O}$ in $K$ ([3, 7.24]).

Theorem 9 Let $K$ be an imaginary quadratic field and ${\cal O}$ be an order in $K$ of conductor $f$, then $$h({\cal O})=\frac{h({\cal O}_K)f}{[{\cal O}_K^*:{\cal O}^*]}\prod_{p\mid f}\left(1-\legendre{d_K}{p}\frac{1}{p}\right).$$

Our goal in this section is to compute the $j({\cal O})$ for the orders ${\cal O}$ of class number 1. By Theorem 8, all these singular moduli are rational integers. A famous result about the Gauss class number problem, now known as the Stark-Heegner theorem, says that there only 9 imaginary quadratic fields having class number 1. Moreover, using Theorem 9, we can conclude that there are only four more cases for non-maximal orders of class number 1. More precisely, when ${\cal O}_K=\{\pm1\}$, only $f=2$ and $K=\mathbb{Q}(-7)$ can occur; when ${\cal O}_K=\{\pm1,\pm i \}$ (i.e., $K=\mathbb{Q}(\sqrt{-1})$), only $f=2$ can occur; when ${\cal O}_K=\{\pm1, \pm \rho,\pm\rho^2\}$ (i.e., $K=\mathbb{Q}({\sqrt{-3}})$), only $f=2,3$ can occur. Since an order ${\cal O}$ is uniquely determined by its discriminant $D=f^2d_K$, we may summarize the results as the following theorem.

Theorem 10 There are only 9 imaginary quadratic fields $K$ of class number 1. Their discriminants are $$d_K=-3,-4,-7,-8,-11,-19,-43,-67,-163.$$ There are only 13 orders ${\cal O}$ of class number 1. Their discriminants are $$D=-3,-4,-7,-8,-11,-12,-16,-19,-27,-28,-43,-67, -163.$$

To compute these singular moduli, one may proceed by plugging $\tau$ into the $q$-expansion of $j(\tau)$, $$j(\tau) = \frac{1}{q} + 744 + 196884 q + 21493760 q^2 + 864299970 q^3 + 20245856256 q^4 + \cdots.$$ This $q$-expansion can be computed via the $q$-expansions of $g_2(\tau)$ and $g_3(\tau)$, $$g_2(\tau)=\frac{(2\pi)^4}{12}\left(1+240\sum_{n=1}^\infty\sigma_3(n)q^n\right),\quad g_3(\tau)=\frac{(2\pi)^6}{216}\left(1-504\sum_{n=1}^\infty\sigma_5(n)q^n\right).$$ So nowadays we can handle this task using a computer. The numerical method will work pretty well for our purpose since we know a priori that these values are integers. All the 13 singular moduli of integer values are listed in Table 1. Table 1

By Theorem 10, we easily obtain a quick method of detecting complex multiplication for elliptic curves over $\mathbb{Q}$: if $j(E)$ appears in Table 1 , then $E$ has complex multiplication with the corresponding order ${\cal O}$; otherwise, $E$ does not have complex multiplication.

However, we are not fully satisfied with this direct computation. For example, it does not explain why most singular moduli in Table 1 (except the two boxed ones) are cubes. Nor does it explain the observation that all these singular moduli are highly divisible. We will try to explain the reasons for these phenomena in the last two sections of this chapter (see Theorem 11, Corollary 1).

Now let us introduce Weber's method for computing the singular moduli of integer values. The main tool of Weber's computation is a class of Weber functions $\gamma_2(\tau)$, $\mathfrak{f}(\tau)$, $\mathfrak{f}_1(\tau)$ and $\mathfrak{f}_2(\tau)$ (not to be confused with the Weber function $h(z,\Lambda)$ defined earlier).

Definition 6 Define the Weber function $$\gamma_2(\tau)=\sqrt[{3}]{j(\tau)}=12\frac{g_2(\tau)}{\sqrt[{3}]{\Delta(\tau)}}, $$ where $\sqrt[{3}]{\Delta(\tau)}$ is chosen so that it is real-valued on the imaginary axis.

The Weber function $\gamma_2(\tau)$ satisfies the following transformation property $$\gamma_2(\tau+1)=e^{-2\pi i/3}\gamma_2(\tau),\quad \gamma_2(-1/\tau)=\gamma_2(\tau).$$ Then it is straightforward to check that $\gamma_2(3\tau)$ is a modular function with respect to $\Gamma_0(9)$ ([3, 12.3]). So $\mathbb{Q}(\gamma_2(\tau))\in\mathbb{Q}(j(\tau/3),j(3\tau))$. Moreover, when the order ${\cal O}=\mathbb{Z}+\mathbb{Z}\tau$ has discriminant prime to 3, we have the following even better relationship between $\gamma_2(\tau)$ and $j(\tau)$ ([3, 12.2]).

Theorem 11 Let ${\cal O}$ be an order of discriminant $D$ and assume $3\nmid D$. Set $$\tau_0=
  \begin{cases}
    \sqrt{-m}, &  D=-4m\equiv0\pmod{4}, \\
    (3+\sqrt{-m})/2, & D=-m\equiv1\pmod{4}.
  \end{cases}$$ Then ${\cal O}=\mathbb{Z}+\mathbb{Z}\tau_0$. $\gamma_2(\tau_0)$ is an algebraic integer and $K(\gamma_2(\tau_0))$ is the ring class field of ${\cal O}$. Moreover, $\mathbb{Q}(\gamma_2(\tau_0))=\mathbb{Q}(j(\tau_0))$.

By the last part of Theorem 11, we know that $\gamma_2(\tau_0)$ has the same degree as $j(\tau_0)$ when $3\nmid D$. In particular, when $h({\cal O})=1$, $\gamma_2(\tau_0)$ is an integer since $j(\tau_0)$ is so. Therefore $j({\cal O})=j(\tau_0)=\gamma_2(\tau_0)^3$ is a cube when $3\nmid D$, which coincides with the result listed in Table 1 . The two boxed exceptions $D=-12, -27$, as expected, are divisible by 3.

Definition 7 Let $$\eta(\tau)=q^{1/24}\prod_{n=1}^{\infty}(1-q^n)$$ be the Dedekind $\eta$-function. We define the Weber functions 
 \begin{align*}
    \mathfrak{f}(\tau)&=e^{-\pi i/24}\frac{\eta(\frac{\tau+1}{2})}{\eta(\tau)}=q^{-1/48}\prod_{n=1}^\infty(1+q^{n-1/2}), \\
    \mathfrak{f}_1(\tau) &=\frac{\eta(\tau/2)}{\eta(\tau)}=q^{-1/48}\prod_{n=1}^\infty(1-q^{n-1/2}), \\
    \mathfrak{f}_2(\tau) &=\sqrt{2}\frac{\eta(2\tau)}{\eta(\tau)}=\sqrt{2}q^{1/24}\prod_{n=1}^\infty(1+q^n).
  \end{align*}

We may summarize the most important relationship and transformation properties of these Weber functions as follows [3, 12.17, 12.19]. These properties are crucial to Weber's computation of singular moduli.

Theorem 12
  1. $\mathfrak{f}(\tau)\mathfrak{f}_1(\tau)\mathfrak{f}_2(\tau)=\sqrt{2}$.
  2. $\mathfrak{f}_1(2\tau)\mathfrak{f}_2(\tau)=\sqrt{2}$.
  3. $\displaystyle\gamma_2(\tau)=\frac{\mathfrak{f}(\tau)^{24}-16}{\mathfrak{f}(\tau)^8}=\frac{\mathfrak{f}_1(\tau)^{24}+16}{\mathfrak{f}_1(\tau)^8}=\frac{\mathfrak{f}_2(\tau)^{24}+16}{\mathfrak{f}_2(\tau)^8}$.
  4. $\mathfrak{f}(\tau+1)=e^{-\pi i/24}\mathfrak{f}_1(\tau)$, $\mathfrak{f}_1(\tau+1)=e^{-\pi i/24}\mathfrak{f}(\tau)$, $\mathfrak{f}_2(\tau+1)=e^{\pi i/12}\mathfrak{f}_2(\tau)$.
  5. $\mathfrak{f}(-1/\tau)=\mathfrak{f}(\tau)$, $\mathfrak{f}_1(-1/\tau)=\mathfrak{f}_2(\tau)$, $\mathfrak{f}_2(-1/\tau)=\mathfrak{f}_1(\tau)$.

Now let us use Theorem 12 to compute $\gamma_2(\tau_0)$ for those orders with discriminants prime to 3. As a consequence, we will be able to compute the singular moduli for those orders easily by raising the corresponding $\gamma_2(\tau_0)$ to the third power.

Theorem 13 Set $q=e^{-2\pi\sqrt{m}}$. Then for $D=-4m=-4,-8,-16,-28$, $$\gamma_2(\sqrt{-m})=\llbracket256q^{2/3}+q^{-1/3}\rrbracket$$ and for $D=-m=-7,-11,-19,-43,-67,-163$, $$\gamma_2((3+\sqrt{m})/2)=\llbracket-q^{-1/6}+256q^{1/3}\rrbracket,$$ where $\llbracket\cdot\rrbracket$ is the nearest integer function.
Proof First consider the case of even discriminant. By Theorem 12 (c), we know that 
\begin{equation*}
    \gamma_2(\sqrt{-m})=\mathfrak{f}_2(\sqrt{-m})^{16}+\frac{16}{\mathfrak{f}_2(\sqrt{-m})^8}.    \tag{1}
  \end{equation*}
Using the product formula, we get $$\mathfrak{f}_2(\sqrt{-m})=\sqrt{2}q^{1/24}\prod_{n=1}^\infty(1+q^n).$$ Now applying the inequality $1+x<e^x$ for $x>0$, we obtain $$1<\prod_{n=1}^\infty(1+q^n)<\prod_{n=1}^\infty e^{q^n}=e^{q/(1-q)}<e^{1.002q},$$ since $0<q\le e^{-2\pi}$. Using this estimate and plugging $\mathfrak{f}_2(\sqrt{-m})$ into Equation (1), we get $$256q^{2/3}+q^{-1/3}e^{-8.016q}<\gamma_2(\sqrt{-m})<256q^{2/3}e^{16.032q}+q^{-1/3}.$$ The difference of the upper bound and the lower bound is $$\delta=256q^{2/3}(e^{16.032q}-1)+q^{-1/3}(1-e^{-8.016q}).$$ Using the inequality $1-e^{-x}<x/(1-x)$ for $0<x<1$, we have $$\delta<256q^{2/3}(e^{16.032q}-1)+8.016q^{2/3}/(1-8.016q).$$ The right hand side is an increasing function in $q$, so $q\le e^{-2\pi}$ implies $\delta<0.25$. But $\gamma_2(\tau)$ is an integer by Theorem 11, so $\gamma_2(\sqrt{-m})=\llbracket256q^{2/3}+q^{-1/3}\rrbracket$.

Next let us consider the case of odd discriminant. The above computation fails, since $e^{2\pi i(3+\sqrt{-m})/2}=-e^{-\pi\sqrt{m}}$ is now negative. However, we can translate $(3+\sqrt{-m})/2$ to $\sqrt{-m}$ as follows. By Theorem 12 (b) and (d), we know that $$\mathfrak{f}(\tau_0)=\frac{\sqrt{2}}{\mathfrak{f}_1(2\tau_0)},$$ and $$\mathfrak{f}_1(2\tau_0)=\mathfrak{f}_1(3+\sqrt{-m})=e^{-\pi i/24}\mathfrak{f}(2+\sqrt{-m})=e^{-\pi i/12}\mathfrak{f}_1(1+\sqrt{-m})=e^{-\pi i/8}\mathfrak{f}(\sqrt{-m}).$$ Therefore $$\gamma_2(\tau_0)=\frac{256}{\mathfrak{f}(\sqrt{-m})^{16}}-\mathfrak{f}(\sqrt{-m})^8.$$ Now a similar argument shows the desired result $\gamma_2((3+\sqrt{m})/2)=\llbracket-q^{-1/6}+256q^{1/3}\rrbracket$. ¡õ

Example 4 Consider $K=\mathbb{Q}(\sqrt{-163})$. Then $D=m=163$, so by Theorem 11 and Theorem 13, we can compute the singular modulus 
\begin{align*}
      j\left(\frac{1+\sqrt{163}}{2}\right)&=j\left(\frac{3+\sqrt{163}}{2}\right)=\gamma_2\left(\frac{3+\sqrt{163}}{2}\right)^3\\&=\llbracket-e^{\pi\sqrt{163}/3}+256e^{2\pi\sqrt{163}/3}\rrbracket^3=\llbracket-640319.99999999998\rrbracket^3\\&=-640320^3=-(2^6\cdot3\cdot5\cdot23\cdot29)^3.
  \end{align*}
It agrees with the result in Table 1 . We will come back to this example using the powerful Gross-Zagier's theorem in the next section.

TopGross-Zagier's theorem on singular moduli

Gross and Zagier [8] proved a result which completely determines the prime factorization of the norm of the difference between two singular moduli, which in turn justified many classical conjectures on the congruences of singular moduli proposed by Berwick [9]. They provide two proofs of different natures: The first proof, an algebraic proof, is based on Deuring's work on endomorphism rings of elliptic curves mentioned in Chapter 2. The second analytic proof relies on the calculation of the Fourier coefficients of the restriction to the diagonal ${\cal H}\subseteq{\cal H}\times{\cal H}$ of an Eisenstein series of the Hilbert modular group of $\mathbb{Q}(\sqrt{D})$. As the authors remarked, these two methods can be viewed as the special case $N=1$ of the theory of local heights of Heegner points on $X_0(N)$, which generalizes to the groundbreaking Gross-Zagier formula [10].

In this section, we will first state Gross-Zagier's theorem, then use it to compute several examples and derive some consequences. At the end, we will discuss a bit of the algebraic proof of Gross-Zagier's theorem.

Now consider two orders with discriminants $d_1$ and $d_2$ satisfying $\gcd(d_1,d_2)=1$. Let $w_1, w_2$ be the numbers of their units and $h_1,h_2$ be their class numbers. Let $\mathfrak{a}_i\ (1\le i\le h_1)$ and $\mathfrak{b}_k\ (1\le k\le h_2)$ be the representatives of their ideal class groups. Define $$J(d_1,d_2)=\left(\prod_{i=1}^{h_1}\prod_{k=1}^{h_2}(j(\mathfrak{a}_i)-j(\mathfrak{b}_k))\right)^{4/w_1w_2}.$$ Notice that when $w_1w_2=4$ (e.g., $d_1,d_2<-4$), $J(d_1,d_2)$ is just the norm of any of the differences $j(\mathfrak{a}_i)-j(\mathfrak{b}_k)$. In general, $J(d_1,d_2)$ is a certain power of this norm and $J(d_1,d_2)^2$ is always an integer.

To state Gross-Zagier's theorem, let us introduce some notation. Let $D=d_1d_2$. For a prime $p $, define $$\epsilon(p)=
\begin{cases}
  \displaystyle\legendre{d_1}{p}, & p\nmid d_1, \\
  \displaystyle\legendre{d_2}{p}, & p\nmid d_2.
\end{cases}$$ This is well-defined whenever $\legendre{D}{p}\ne-1$. More generally, if $n$ has the prime factorization $n=\prod\limits_{i=1}^rp_i^{a_i}$ with $\legendre{D}{p_i}\ne-1$, we define $$\epsilon(n)=\prod_{i=1}^r\epsilon(p_i)^{a_i}.$$ Finally, set $$F(m)=\prod_{nn'{}=m,\atop n,n'>0} n^{\epsilon(n')}.$$ This is well-defined whenever all primes $p $ dividing $m$ satisfy $\legendre{D}{p}\ne-1$. Now the main theorem is as follows.

Theorem 14 (Gross-Zagier) With the above notation, $$J(d_1,d_2)^2=\pm\prod_{x^2<d_1d_2\atop x^2\equiv d_1d_2\pmod{4}}F\left(\frac{d_1d_2-x^2}{4}\right).$$
Example 5 When $d_1=-3$, we know the corresponding $w_1=6$ and $j\left(\frac{1+\sqrt{-3}}{2}\right)=0$. So in this case, $$J(-3, d_2)=N\left(j\left(\frac{d_2+\sqrt{d_2}}{2}\right)\right)^{2/(3w_2) }.$$ In particular, for $d_2=-163$, $w_2=1$ and $h_2=1$, so we have $j\left(\frac{1+\sqrt{-163}}{2}\right)=J(-3, -163)^3$. The factors of $J(-3,-163)^2$ are tabulated in Table 2 , so we can conclude (after figuring out the sign) that $$j\left(\frac{1+\sqrt{-163}}{2}\right)=-(2^6\cdot3\cdot5\cdot23\cdot29)^3,$$ which agrees with our computation in Example 4. Table 2
Example 6 Similarly, when $d_1=-4$, we know the corresponding $\omega_1=4$ and $j(i)=1728$. So in this case, $$J(-4,d_2)=N\left(j\left(\frac{d_2+\sqrt{d_2}}{2}\right)-1728\right)^{1/w_2}.$$ In particular, for $d_2=-163$, we have $j\left(\frac{1+\sqrt{-163}}{2}\right)-1728=J(-4, -163)^2$. The factors of $J(-4,-163)^2$ are tabulated in Table 3 , so we can conclude (after figuring out the sign) that $$j\left(\frac{1+\sqrt{-163}}{2}\right)=-2^6\cdot3^6\cdot7^2\cdot11^2\cdot19^2\cdot127^2\cdot163+1728,$$ which also agrees with our computation in Example 4. Table 3

As we have noticed, the prime factor of $F\left(\frac{D-x^2}{4}\right)$ is always a factor of $\frac{D-x^2}{4}$. In fact, we have the following interesting result concerning the function $F(m)$ ([3, Exercise 13.15, 13.16]).

Lemma 4 $F(m)$ is 1 unless $m$ can be written in the form $$m=p^{2a+1}p_r^{2a_1}\cdots p_r^{2a_r} q_1^{b_1}\cdots q_s^{b_s},$$ where $\epsilon(p)=\epsilon(p_i)=-1$ and $\epsilon(q_i)=1$. In this case, $$F(m)=p^{(a+1)(b_1+1)\cdots(b_s+1)}.$$
Corollary 1 Let $p $ be a prime dividing $J(d_1,d_2)^2$, then $p $ divides a positive integer of the form $\frac{D-x^2}{4}$. In particular, $p\le D/4$. Moreover, $\legendre{d_1}{p}\ne1$ and $\legendre{d_1}{p}\ne1$.
Proof The first part follows immediately from Lemma 4. For the second part, by Lemma 4, we have $\epsilon(p)=-1$ for such $p $. Without loss of generality, we may assume $\legendre{d_1}{p}=-1$. But $\legendre{D}{p}\ne-1$ since $p\mid (D-x^2)$ for some $x$, therefore $\legendre{d_2}{p}\ne1$. ¡õ

Now we can explain the phenomenon we observed in Table 1 . Suppose $p $ is a prime dividing an integer singular modulus of discriminant $d_2$, or equivalently, dividing $J(-3,d_2)^2$, then by Corollary 1, we have $p\le 3d_2$. So these singular moduli have relatively small prime factors, though their own values can be fairly huge.

Finally, let us come to the algebraic proof of Gross-Zagier's theorem. The proof proceeds locally. As the first step, Gross and Zagier relate the valuation of the difference of two $j$-values to the geometry of elliptic curves and reduce it to a counting problem of isomorphisms between elliptic curves. Next, a generalization of Deuring's lifting theorem will allow one to reduce the problem to counting certain subrings of the endomorphism ring of a supersingular elliptic curve. To complete the proof, Gross and Zagier give a convenient description of a maximal order and its subrings in the rational quaternion algebra ramified at $\infty$ and a prime for explicit computation.

The first step can be viewed as an interesting geometrical interpretation of the difference of $j$-values.

Theorem 15 Let $W$ be a complete discrete valuation ring whose quotient field has characteristic zero and whose residue field is algebraically closed and has characteristic $\ell>0$ (e.g., $W(\overline{\mathbb{F}_\ell})$). Let $\pi$ be its uniformizer and $v$ be its normalized valuation. Let $E, E'$ be elliptic curves defined over $W$ with good reduction and $j$-invariants $j, j'$. Denote the set of isomorphisms from $E$ to $E'$ defined over $W/\pi^n$ by $\Iso_n(E, E')$. Then $$v(j-j')=\frac{1}{2}\sum_{n\ge1}\#\Iso_n(E, E').$$
Proof We may assume that $E, E'$ are isomorphic over the algebraically closed field $W/\pi$, otherwise both sides are zero. Denote $i(n)=\frac{1}{2}\#\Iso_n(E,E')$, then $i(1)\ge1$.

Let us consider the case when $\ell\ne 2,3$ for simplicity. Change models for $E, E'$ with simplified Weierstrass equations $$y^2=x^3+a_4x+a_6,\quad y^2=x^3+a_4'x+a_6'.$$

By definition, we have $i(n)\ge1$ if and only if we can solve the congruences 
  \begin{equation*}
    \left\{
      \begin{aligned}
        a_4\equiv u^4 a_4' \\
        a_6\equiv u^6 a_6'
      \end{aligned}
      \pmod{\pi^n}\right.
  \end{equation*}
simultaneously for some unit $u\in (W/\pi^n)^*$. In this case $\Delta=-16(4a_4^3+27a_6^2)$, and at least one of $a_4$ and $a_6$ is a unit in $W^*$ since $E$ has good reduction mod $\pi$.

If $a_4$ is a unit in $W^*$, then $a_4'$ is also a unit. By changing models we may assume that $a_4=a_4'=1$. Then $$v(j-j')=v(a_6^2-a_6'^2)=v(a_6-a_6')+v(a_6+a_6').$$ On the other hand, the congruences become 
 \begin{equation*}
    \left\{
      \begin{aligned}
        u^4&\equiv 1 \\
        a_6&\equiv u^6 a_6'
      \end{aligned}
      \pmod{\pi^n}\right..
  \end{equation*}
We may possibly modify $(a_6,a_6')$ by $\pm 1$ so that $v(a_6-a_6')$ is maximal. Then 
 \begin{equation*}i(n)=
    \begin{cases}
      0\ (\text{no solution}), & n> v(a_6-a_6'),  \\
      1\ (u=\pm1), & v(a_6+a_6')< n\le v(a_6-a_6'), \\
      2\ (u=\pm1,\pm i), & n\le v(a_6+a_6').
    \end{cases}
  \end{equation*}
We get $$\sum_{n\ge1} i(n)=v(a_6-a_6')+v(a_6+a_6').$$ So the theorem holds in this case.

If $a_6$ is a unit in $W^*$, then $a_6'$ is also a unit. Similarly by changing models we may assume that $a_6=a_6'{}=1$. Then 
  \begin{align*}
    v(j-j')&=v(a_4^3-a_4'^3)=v(a_4-a_4')+v(a_4-\rho a_4')+v(a_4-\rho^2a_4')\\
    &=v(a_4-a_4')+2v(a_4-\rho a_4'),
\end{align*}
where $\rho$ is a primitive cube root of unity in $W^*$. On the other hand, the congruences become 
\begin{equation*}
  \left\{
    \begin{aligned}
      a_4&\equiv u^4a_4' \\
      u^6&\equiv 1
    \end{aligned}
    \pmod{\pi^n}\right..
\end{equation*}
We may possibly modify $(a_4,a_4')$ by $\rho$ or $\rho^2$ so that $v(a_4-a_4')$ is maximal. Then 
\begin{equation*}i(n)=
    \begin{cases}
      0\ (\text{no solution}), & n> v(a_4-a_4'),  \\
      1\ (u=\pm1), & v(a_4-\rho a_4')< n\le v(a_4-a_4'), \\
      3\ (u=\pm1,\pm\rho,\pm\rho^2), & n\le v(a_4-\rho a_4').
    \end{cases}
  \end{equation*}
We get $$\sum_{n\ge1} i(n)=v(a_4-a_4')+2v(a_4-\rho a_4').$$ This completes the proof. ¡õ

For simplicity, we will assume $d_1=-p$ is a prime from now on (for the general case, see [11]). Let ${\cal O}_K$ be the ring of integers of $K=\mathbb{Q}(\sqrt{-p})$. Let $E$ be an elliptic curve over $W$ with complex multiplication by ${\cal O}_K$ and with $j$-invariant $j=j({\cal O}_K)$. For our purpose, we need to calculate $\#\Iso_n(E,E')$ where $E'$ is an elliptic curve over $W$ with complex multiplication by some ring $\mathbb{Z}[w]$ of discriminant $d_2$. We can rewrite $\#\Iso_n(E,E')$ in a manner which only depends on $E$. Suppose $f\in \Iso_n(E,E')$, then $w_f=f^{-1}\circ w\circ f\in \End_n(E)$ is an endomorphism of $E$ mod $\pi^n$, which has the same norm, trace and action on tangent space as $w$. Namely, $w_f$ belongs to the set $$S_n=\{\alpha_0\in \End_n(E)\mid \mathrm{T}(\alpha_0)=\mathrm{T}(w), \mathrm{N}(\alpha_0)=\mathrm{N}(w), \alpha_0=w \text{ on } \mathrm{Lie}(E)\},$$ Conversely, every element of $S_n$ is of the form $w_f$ for some unique $f$ ensured by the following lifting theorem, which is a refinement of Deuring's lifting theorem ([12, 14.14]).

Theorem 16 Let $E_0$ be an elliptic curve over $W/\pi^n$ and $\alpha_0\in \End(E_0)$. Assume that $\mathbb{Z}[\alpha_0]$ is a $\mathbb{Z}$-module of rank 2 and is integrally closed in its quotient field. Suppose $\alpha_0$ induces multiplication by a quadratic element $w_0$ on $\mathrm{Lie}(E_0)$. If there exists $w\in W$ such that $$w\equiv w_0\pmod{\pi^n},\qquad w^2-\mathrm{T}(w_0)w+\mathrm{N}(w_0)=0,$$ then there exists an elliptic curve $E$ over $W$ and $\alpha\in\End(E)$, such that $(E, \alpha)$ reduces to $(E_0, \alpha_0)$ mod $\pi^n$ and $\alpha$ induces multiplication by $w$ on $\mathrm{Lie}(E)$. Moreover, if $(E',\alpha')$ is another lifting, then there is a commutative diagram $$\xymatrix{E \ar[r]^\alpha\ar[d]_{\cong} & E \ar[d]^{\cong}\\ E'\ar[r]^{\alpha'} & E'.}$$

Now by Theorem 16, we reduce to the counting problem of $S_n$.

When $\legendre{\ell}{p}=1$, $\ell$ splits in $K=\End(E)\otimes\mathbb{Q}$, so $E$ has ordinary reduction mod $\pi$ and $\End_n(E)=\End(E)={\cal O}_K$ ([12, 13.12]). But ${\cal O}_K$ contains no elements of discriminant $d_2$, so $S_n$ is empty for all $n\ge1$. (Another way to say this: if two elliptic curves $E$ and $E'$ with complex multiplication have the isomorphic reduction $\tilde E$, then the reduction $\tilde E$ must be supersingular, since two different orders $\End(E)$ and $\End(E')$ have to embed into $\End(\tilde E)$ simultaneously.)

So we only need to consider the case $\legendre{\ell}{p}\ne1$ and $E$ has supersingular reduction. Then $\End_1(E)$ is a maximal order in the rational quaternion algebra $B$ ramified at $\ell$ and $\infty$ by Theorem 8. The algebra $B$ can be desribed explicitly as a subring of $M_2(K)$, $$B=\left\{
\begin{bmatrix}
  \alpha & \beta \\
  -\ell \bar\beta & \bar\alpha
\end{bmatrix}: \alpha,\beta\in K\right\}.$$ The subrings $\End_n(E)$ can also be desribed explicitly. Using these descriptions, it turns out that in many cases $\#S_n$ equals to $w_1/2$ times the number of the solutions $(x,\mathfrak{b})$ (under certain conditions on $\mathfrak{b}$) of the equation $$x^2+4\ell^{2n-1}\mathrm{N}(\mathfrak{b})=pq,$$ where we assume $d_2=-q$ is a prime . The more precise result is the following.

Theorem 17 Let $\lambda$ be a prime of ${\cal O}_K$ over $\ell$, then 
  \begin{equation*}
    \ord_{\lambda}(J(-p,-q))=\frac{1}{2}\sum_{x\in\mathbb{Z}}\sum_{n\ge1}\delta(x)R\left(\frac{pq-x^2}{4\ell^n}\right), \tag{2}
  \end{equation*}
where $$\delta(x)=
  \begin{cases}
    2, & x\equiv0\pmod{p}, \\
    1, &\text{otherwise},
  \end{cases}$$ and $R(m)$ is the number of ideals of ${\cal O}_K$ of norm $m$.

The main Theorem 14 now can be derived directly from Equation 2using the formula $$R(m)=\sum_{n\mid m, n>0}\legendre{n}{p}.$$ Unfortunately, we will omit the details here.

References

[1]Goro Shimura, Introduction to the Arithmetic Theory of Automorphic Functions, Princeton University Press, 1971.

[2]Jean-Pierre Serre, Complex multimplication, Algebraic Number Theory, London Mathematical Society, 1967, 292-296.

[3]David A. Cox, Primes of the Form $X^2 + ny^2$: Fermat, Class Field Theory, and Complex Multiplication, John Wiley \& Sons, 1989.

[4]Serge Lang, Algebraic Number Theory, Springer, 1994.

[5]Krian S. Kedlaya, Complex multimplication and explicit class field theory, 1996, Senior thesis, Harvard University.

[6]Joseph H. Silverman, Advanced Topics in the Arithmetic of Elliptic Curves, Springer, 1994.

[7]Fred Diamond and Jerry Shurman, A First Course in Modular Forms, Springer, 2010.

[8]Gross, B. and Zagier, D., On singular moduli, J. reine angew. Math 355 (1985), no.2, 191--220.

[9]Berwick, W. E. H, Modular Invariants Expressible in Terms of Quadratic and Cubic Irrationalities, Proc. London Math. Soc. 28 (1927), 53-69.

[10]Gross, B. and Zagier, D., Heegner points and derivatives of L-series, Invent. math 84 (1986), no.2, 225--320.

[11]D. Dorman, Prime factorization of singular moduli, Brown University, 1984.

[12]Serge Lang, Elliptic Functions, Springer, 1987.