Let $j$ be the Klein modular invariant and let $\Gamma=SL_2(\mathbb Z)$ be the modular group. Consider the set of primitive quadratic forms $ax^2+bxy+cy^2$ of discriminant $d<0$.

The *root* of a quadratic form $f(x,y)$ is the unique complex number $\omega$ from the upper half-plane such that $f(\omega, 1)=0$. It follows, that two quadratic forms are equivalent, if and only if their respective roots are in the same orbit of the action of $\Gamma$ on the upper half plane.

Therefore we may associate to each equivalence class of quadratic forms of the discriminant $d$ a unique value of the $j$-invariant. Now choose a root from every equivalence class, say $\omega_1,...,\omega_h$, where $h=h(d)$ is the class number and consider the *class equation*

$$H(x)=(x-j(\omega_1))\cdots(x-j(\omega_h)).$$

**Why should this polynomial have integral coefficients?**

I am seeking some simple reason why $j(\omega)$, where $\omega$ is a root of a quadratic form of discriminant $d$, should be an algebraic integer of degree at most $h(d)$. The modular equation shows, that $j(\omega)$ is an algebraic integer, see my question Singular values of the j-invariant.

I am aware that more advanced theory shows that the degree of $j(\omega)$ is actually $h(d)$. Also there is an elementary proof of the weaker statement in the Cox's book *Primes of the form $x^2+ny^2$*, but this requires a lot of work.

On the other hand Weber in his *Lehrbuch der Algebra* proves that $H(x)$ has rational coefficients by some sort of induction. However, this is scarcely readable.

My ultimate goal is to understand the proof of Heegner-Stark theorem as described in Stark's article. I asked a question about it before: Modular functions of the type $\mathfrak f(\cdot)^{k}\mathfrak f(\cdot)^{23nk}$, but got no response. Fortunately I had resolved that problem and now this is the next question to be answered.