Bijection between an ideal class group and a set of classes of binary quadratic forms. Let $F = ax^2 + bxy + cy^2$ be a binary quadratic form over $\mathbb{Z}$.
We say $D = b^2 - 4ac$ is the discriminant of $F$.
If $D$ is not a square integer and gcd($a, b, c) = 1$, we say $ax^2 + bxy + cy^2$ is primitive.
If $D < 0$ and $a > 0$, we say $ax^2 + bxy + cy^2$ is positive definite.
Let $K$ be a quadratic number field.
Let $R$ be an order of $K$.
Let $D$ be its discriminant.
Let $I$ be a fractional ideal of $R$.
If there exists a fractional ideal $J$ of $R$ such that $IJ = R$, $I$ is called an invertible fractional ideal of $R$.
The set of invertible fractional ideals of $R$ forms a group $\mathfrak{I}(R)$ with the multiplications. We call $\mathfrak{I}(R)$ the group of invertible fractional ideals of $R$.
We denote by $\mathfrak{P}(R)$ the group of principal fractional ideals of $R$.
$\mathfrak{P}(R)$ is a subgroup of $\mathfrak{I}(R)$.
We denote $\mathfrak{I}(R)/\mathfrak{P}(R)$ by $Cl(R)$.
$Cl(R)$ is called the ideal class group of $R$.
Let $\mathfrak{P}^+(R) = \{\alpha R; \alpha \in K, N_{K/\mathbb{Q}}(\alpha) > 0\}$.
$\mathfrak{P}^+(R)$ is a subgroup of $\mathfrak{P}(R)$.
We denote $\mathfrak{I}(R)/\mathfrak{P}^+(R)$ by $Cl^+(R)$.
If $K$ is a imaginary quadratic field, $Cl(R) = Cl^+(R)$.
We would like to establish a bijection between $Cl^+(R)$ and the set of classes of primitive binary quadratic forms of discriminant $D$.
Let $\alpha, \beta \in K$.
We denote $\alpha\beta' - \alpha'\beta$ by $\Delta(\alpha, \beta)$, where $\alpha'$(resp. $\beta'$) is the conjugate of $\alpha$(resp. $\beta$).
$\Delta(\alpha, \beta) \neq 0$ if and only if $\alpha, \beta$ are linearly independent over $\mathbb{Q}$.
If $D < 0$, we define $\sqrt{D}$ as i$\sqrt{|D|}$
Let $I \neq 0$ be a fractional ideal of $R$.
Let $\{\alpha, \beta\}$ be $\mathbb{Z}$-basis of $I$.
If $\Delta(-\alpha, \beta)/\sqrt{D} > 0$, we say the basis $\{\alpha, \beta\}$ is positively oriented.
If $\Delta(-\alpha, \beta)/\sqrt{D} < 0$, we say the basis $\{\alpha, \beta\}$ is negatively oriented.
Suppose $\{\alpha, \beta\}$ and $\{\gamma, \delta\}$ are two positively oriented bases of $I$.
There exist integers $p,q,r,s$ such that
$\alpha = p\gamma + q\delta$
$\beta = r\delta + s\delta$
It is easy to see that $ps - qr = 1$.
$I$ can be written as $I = J/\lambda$, where $J$ is an ideal of $R$ and $\lambda \in R$.
We define the norm of $I$ as $N(I) = N(J)/N(\lambda R)$.
It is easy to see that this is well defined.
Let $x, y$ be indeterminates.
Let $\{\alpha, \beta\}$ be a positively oriented basis of $I$.
We write $f(\alpha, \beta; x, y) = N_{K/\mathbb{Q}}(x\alpha - y\beta)/N(I)$.
Namely $f(\alpha, \beta; x, y) = (x\alpha - y\beta)(x\alpha' - y\beta')/N(I)$.
It is easy to see that $f(\alpha, \beta; x, y)$ is a binary quadratic form of discriminant $D$. It is also easy to see that $f(\alpha, \beta; x, y)$ is positive definite if $D < 0$.
Suppose $\{\alpha, \beta\}$ and $\{\gamma, \delta\}$ are two positively oriented bases of $I$.
It is a routine to check that $f(\alpha, \beta; x, y)$ and $f(\gamma, \delta; x, y)$ are equivalent under the action of $SL_2(\mathbb{Z})$.
By the corollary of proposition 2 of this question, if $I$ is invertible, $f(\alpha, \beta; x, y)$ is primitive.
Let $\{\alpha, \beta\}$ be a positively oriented basis of $I$.
Let $\delta$ be an element of $K$ such that $N_{K/\mathbb{Q}}(\delta) > 0$.
Then $\{\delta\alpha, \delta\beta\}$ is a positively oriented basis of the farctional ideal $\delta I$.
$f(\delta\alpha, \delta\beta; x, y) = N_{K/\mathbb{Q}}(x\delta\alpha - y\delta\beta)/N(\delta I) = (N_{K/\mathbb{Q}}(\delta)/|N_{K/\mathbb{Q}}(\delta)|)f(\alpha, \beta; x, y)$
Hence $f(\delta\alpha, \delta\beta; x, y) = f(\alpha, \beta; x, y)$
Hence we get a map $\psi\colon Cl^+(R) \rightarrow \mathfrak{F}^+_0(D)/SL_2(\mathbb{Z})$ if $D < 0$ and $\psi\colon Cl^+(R) \rightarrow \mathfrak{F}_0(D)/SL_2(\mathbb{Z})$ if $D > 0$,
where $\mathfrak{F}_0(D)$ is the set of primitive binary quadratic forms of discriminant $D$
and $\mathfrak{F}^+_0(D)$ is the set of positive definate primitive binary quadratic forms of discriminant $D$.
My question
Is the following proposition true? If yes, how do we prove it?
Proposition
(1) If $D < 0$,$\psi\colon Cl^+(R) \rightarrow \mathfrak{F}^+_0(D)/SL_2(\mathbb{Z})$ is a bijection.
The inverse map $\phi$ is defined as follows.
Let $F = ax^2 + bxy + cy^2 \in \mathfrak{F}^+_0(D)$.
$\phi([F]) = [\mathbb{Z}a + \mathbb{Z}\frac{(-b + \sqrt{D})}{2}]$.
(2) If $D > 0$, $\psi\colon Cl^+(R) \rightarrow \mathfrak{F}_0(D)/SL_2(\mathbb{Z})$ is a bijection.
The inverse map $\phi$ is defined as follows.
Let $F = ax^2 + bxy + cy^2 \in \mathfrak{F}_0(D)$.
$\phi([F]) = [\alpha(\mathbb{Z}a + \mathbb{Z}\frac{(-b + \sqrt{D})}{2})]$, where $\alpha$ is any element of $K$ such that $sgn(N_{K/\mathbb{Q}}(\alpha)) = sgn(a)$.
 A: We prove Proposition (2).
We use the same notation as that of the proof of Proposition (1).
Lemma 2
The map $\phi$ of Proposition (2) is well-defined.
Proof:
We define a map $\Phi\colon \mathfrak{F}_0(D) \rightarrow Cl^+(R)$ by
$\Phi((a, b, c)) = [\alpha[a, (-b + \sqrt{D})/2]]$, where $\alpha$ is any element of $K$ such that sgn$(N(\alpha)) =$ sgn$(a)$.
This is clearly well-defined.
Let $G = \{\sigma \in SL_2(\mathbb{Z})\ |\ \Phi((a, b, c)^{\sigma}) = \Phi((a, b, c))$ for all $(a, b, c) \in \mathfrak{F}_0(D)\}$.
Clearly $G$ is a subgroup of $SL_2(\mathbb{Z})$.
Since $SL_2(\mathbb{Z})$ is generated by $S = \left( \begin{array}{ccc}0 & -1 \\1 & 0 \end{array} \right)$ and $T = \left( \begin{array}{ccc}1 & 1 \\0 & 1 \end{array} \right)$(see this question), it suffices to prove that $S, T \in G$.
Let $(a, b, c) \in \mathfrak{F}_0(D)$.
Then $\Phi((a, b, c)) = [\alpha [a, (-b + \sqrt D)/2]]$, where $\alpha$ is any element of $K$ such that sgn$(N(\alpha)) =$ sgn$(a)$.
Since $(a, b, c)^S = (c, -b, a), \Phi((a, b, c)^S) = [\beta [c, (b + \sqrt D)/2]]$, where $\beta$ is any element of $K$ such that sgn$(N(\beta)) =$ sgn$(c)$.
Let $I = [a, (-b + \sqrt D)/2], J = [c, (b + \sqrt D)/2], \theta = (-b + \sqrt D)/2$.
Then $\theta'I = [a\theta', \theta\theta'] = [a(-b - \sqrt D)/2, ac] = a[(-b - \sqrt D)/2, c] = a[c, (b + \sqrt D)/2] = aJ$.
Hence $\alpha I = (\alpha a/\theta')J = (\alpha a/\beta\theta')\beta J$.
$N(\alpha a/\beta \theta') = N(\alpha)a^2/N(\beta)ac = N(\alpha)a/N(\beta)c \gt 0$. Hence $[\alpha I] = [\beta J]$.
Hence $S \in G$.
It remains to prove that $T \in G$.
Since $(a, b, c)^T = (a, 2a + b, a + b + c), \Phi((a, b, c)^T) = [\alpha[a, -a + (-b + √D)/2]]= [\alpha[a, (-b + √D)/2]] = \Phi(a, b, c).$
QED
Proof of Proposition (2)
We fist prove that $\psi\phi = 1$.
Let $(a, b, c) \in \mathfrak{F}_0(D)$.
$\phi([ (a, b, c) ]) = [ [a, (-b + \sqrt D)/2]\delta ]$, where $\delta$ is any element of $K$ such that sgn$(N(\delta)) =$ sgn$(a)$.
Let $I = [a, (-b + \sqrt D)/2]\delta$.
Let $\alpha = a\delta, \beta = (-b + \sqrt D)\delta/2$.
Then $I = [\alpha, \beta]$.
$\Delta(-\alpha, \beta) = -a\delta(-b - \sqrt D)\delta'/2 + a\delta'(-b + \sqrt D)\delta/2 = aN(\delta)\sqrt D$. Hence the base $\{\alpha, \beta\}$ of $I$ is positively oriented.
$\alpha\alpha'/N(I) = N(\delta)a^2/|N(\delta)||a|$ = sgn$(N(\delta))$sgn$(a)a = a$
$-(\alpha\beta' + \alpha'\beta)/N(I) = N(\delta)(ab)/|N(\delta)||a| =$ sgn$(N(\delta))$sgn$(a)b = b$
$\beta\beta'/N(I) = N(\delta)ac/|N(\delta)||a| =$ sgn$(N(\delta))$sgn$(a)c = c$
Hence $N(x\alpha - y\beta)/N(I) = ax^2 + bxy + cy^2$.
Hence $\psi\phi = 1$.
It remains to prove that $\phi\psi = 1$.
Every class of $Cl^+(R)$ contains a primitive ideal.
Let $I = [a, b + \omega]$ be an invertible primitive ideal, where $a \gt 0, b$ are rational integers and $\omega = (D + \sqrt D)/2$.
Let $\theta = b + \omega$.
Since $\Delta(-a, \theta) = -a\theta' + a\theta = a\sqrt D$, $\{a, \theta\}$ is positively oriented.
$a^2/N(I) = a,\ -(a\theta' + a\theta)/N(I) = -a(2b + D)/a = -2b - D,\ \theta\theta'/N(I) = (b^2 + bD + (D^2 - D)/4)/a.$
Hence $\psi([I]) = [(a, -2b - D, (b^2 + bD + (D^2 - D)/4)/a)]$.
Hence $\phi\psi([I]) = [ \alpha[a, b + (D + \sqrt D)/2] ]$, where $\alpha$ is any element of $K$ such that sgn$(N(\alpha)) =$ sgn$(a)$.
Since $a \gt 0$, we may take $\alpha = 1$.
Hence $\phi\psi = 1$.
QED
A: We prove the assertion (1) of the proposition.
Notation
Let $\sigma$ be the unique non-identity automorphism of $K/\mathbb{Q}$.
We denote $\sigma(\alpha)$ by $\alpha'$ for $\alpha \in K$.
We denote a binary quadratic form $ax^2 + bxy + cy^2$ by $(a, b, c)$.
Let $x_1,\cdots,x_n \in K$. We denote by $[x_1,\cdots,x_n]$ the subgroup of $K$ generated by $x_1,\cdots,x_n$.
Let $I$ be an invertible fractional ideal of $R$.
We denote by $[I]$ the class of $Cl^+(R)$ which contains $I$.
Let $f \in \mathfrak{F}^+_0(D)$ or $\mathfrak{F}_0(D)$.
We denote by $[f]$ the class of $\mathfrak{F}^+_0(D)/SL_2(\mathbb{Z})$ or $\mathfrak{F}_0(D)/SL_2(\mathbb{Z})$ which contains $f$.
Lemma 1
Let $I$ be a fractional ideal of $R$.
Let $\{\alpha, \beta\}$ be a positively oriented basis of $I$.
Then $f(\alpha, \beta; x, y) = ax^2 + bxy + cy^2$, where
$a = αα'/N(I),
b = -(αβ' + βα')/N(I),
c = ββ'/N(I)$.
Proof:
$N(xα - yβ) = (xα - yβ)(xα' - yβ') = (αα')x^2 - (αβ' + βα')xy + (ββ')y^2$.
QED
Proof of (1)
We first prove that the map $\phi\colon \mathfrak{F}^+_0(D)/SL_2(\mathbb{Z}) \rightarrow Cl^+(R)$ is well-defined.
Let $f = (a, b, c), g = (k, l, m) \in \mathfrak{F}^+_0(D)$.
Suppose $f^{\sigma} = g$, where $\sigma = \left( \begin{array}{ccc}
p & q \\
r & s \end{array} \right) \in SL_2(\mathbb{Z})$, i.e.
$f(px + qy, rx + sy) = kx^2 + lxy + my^2$.
By this question, $I = [a, (-b + \sqrt{D})/2]$ and $J = [k, (-l + \sqrt{D})/2]$ are invertible ideals of $R$.
Let $\theta = (-b + \sqrt{D})/2a, \tau = (-l + \sqrt{D})/2k$.
By this question, $\theta = \sigma^{-1}\tau$.
Then, by this question, there exists $\alpha \in K$ such that $I = \alpha J$ .
Hence $\phi$ is well-defined.
Next we prove that $\psi\phi = 1$.
Let $(a, b, c) \in \mathfrak{F}^+_0(D)$.
Let $I = [a, \theta]$, where $\theta = (-b + \sqrt{D})/2]$.
Note that $N(I) = a$.
Hence
$a^2/N(I) = a,
-(a\theta' + \theta a)/N(I) = b,
\theta\theta'/N(I) = (b^2 - D)/4a = c$.
Hence, by Lemma 1, $f(a, \theta; x, y) = ax^2 + bxy + cy^2$.
Hence $\psi\phi = 1$ as desired.
It remains to prove that $\phi\psi = 1$.
Clearly every class of $Cl^+(R)$ contains a primitive ideal(see this question for the definition of a primitive ideal of $R$).
Let $I = [a, b + \omega]$ be an invertible primitive ideal, where $a \gt 0, b$ are rational integers and $\omega = (D + \sqrt D)/2$.
Let $\theta = b + \omega$.
Since $\Delta(-a, \theta) = -a\theta' + a\theta = a\sqrt D$, $\{a, \theta\}$ is positively oriented.
$a^2/N(I) = a,\ -(a\theta' + a\theta)/N(I) = -a(2b + D)/a = -2b - D,\ \theta\theta'/N(I) = (b^2 + bD + (D^2 - D)/4)/a.$
Hence $\phi([I]) = [(a, -2b - D, (b^2 + bD + (D^2 - D)/4)/a)]$.
Hence $\psi\phi([I]) = [ [a, b + (D + √D)/2] ] = [I]$.
QED
