Bijection between the set of classes of positive definite quadratic forms and the set of classes of quadratic numbers in the upper half plane

Let $\Gamma = SL_2(\mathbb{Z})$. Let $\mathfrak{F}$ be the set of binary quadratic forms over $\mathbb{Z}$. Let $f(x, y) = ax^2 + bxy + cy^2 \in \mathfrak{F}$. Let $\alpha = \left( \begin{array}{ccc} p & q \\ r & s \end{array} \right)$ be an element of $\Gamma$. We write $f^\alpha(x, y) = f(px + qy, rx + sy)$. Since $(f^\alpha)^\beta$ = $f^{\alpha\beta}$, $\Gamma$ acts on $\mathfrak{F}$. Let $f, g \in \mathfrak{F}$. If $f$ and $g$ belong to the same $\Gamma$-orbit, we say $f$ and $g$ are equivalent.

Let $f = ax^2 + bxy + cy^2 \in \mathfrak{F}$. We say $D = b^2 - 4ac$ is the discriminant of $f$. It is easy to see that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). If $D$ is not a square integer and gcd($a, b, c) = 1$, we say $f$ is primitive. If $D < 0$ and $a > 0$, we say $f$ is positive definite.

We denote the set of positive definite primitive binary quadratic forms of discriminant $D$ by $\mathfrak{F}^+_0(D)$. By this question, $\mathfrak{F}^+_0(D)$ is $\Gamma$-invariant. We denote the set of $\Gamma$-orbits on $\mathfrak{F}^+_0(D)$ by $\mathfrak{F}^+_0(D)/\Gamma$.

Let $\mathcal{H} = \{z \in \mathbb{C}; Im(z) > 0\}$ be the upper half complex plane. Let $\alpha = \left( \begin{array}{ccc} p & q \\ r & s \end{array} \right)$ be an element of $\Gamma$. Let $z \in \mathcal{H}$. We write $$\alpha z = \frac{pz + q}{rz + s}$$

It is easy to see that $\alpha z \in \mathcal{H}$ and $\Gamma$ acts on $\mathcal{H}$ from left.

Let $\alpha \in \mathbb{C}$ be an algebraic number. If the minimal plynomial of $\alpha$ over $\mathbb{Q}$ has degree $2$, we say $\alpha$ is a quadratic number. Let $\alpha$ be a quadratic number. There exists the unique polynomial $ax^2 + bx + c \in \mathbb{Z}[x]$ such that $a > 0$ and gcd$(a, b, c) = 1$. $D = b^2 - 4ac$ is called the discriminant of $\alpha$.

Let $\alpha \in \mathcal{H}$ be a quadratic number. There exists the unique polynomial $ax^2 + bx + c \in \mathbb{Z}[x]$ such that $a > 0$ and gcd$(a, b, c) = 1$. Let $D = b^2 - 4ac$. Clearly $D < 0$ and $D$ is not a square integer. It is easy to see that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). Conversly suppose $D$ is a negative non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). Then there exists a quadratic number $\alpha \in \mathcal{H}$ whose discriminant is $D$. We denote by $\mathcal{H}(D)$ the set of quadratic numbers of discriminant $D$ in $\mathcal{H}$. It is easy to see that $\mathcal{H}(D)$ is $\Gamma$-invariant. Hence $\Gamma$ acts on $\mathcal{H}(D)$ from left. We denote the set of $\Gamma$-orbits on $\mathcal{H}(D)$ by $\mathcal{H}(D)/\Gamma$.

Let $f = ax^2 + bxy + cy^2 \in \mathfrak{F}^+_0(D)$. We denote $\phi(f) = (-b + \sqrt{D})/2a$, where $\sqrt{D} = i\sqrt{|D|}$. It is clear that $\phi(f) \in \mathcal{H}(D)$. Hence we get a map $\phi\colon \mathfrak{F}^+_0(D) \rightarrow \mathcal{H}(D)$.

My question Is the following proposition true? If yes, how do we prove it?

Proposition Let $D$ be a negative non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). Then the following assertions hold.

(1) $\phi\colon \mathfrak{F}^+_0(D) \rightarrow \mathcal{H}(D)$ is a bijection.

(2) $\phi(f^\sigma) = \sigma^{-1}\phi(f)$ for $f \in \mathfrak{F}^+_0(D), \sigma \in \Gamma$.

Corollary $\phi$ induces a bijection $\mathfrak{F}^+_0(D)/\Gamma \rightarrow \mathcal{H}(D)/\Gamma$.

-

Proof of (1) We define a map $\psi\colon \mathcal{H}(D) \rightarrow \mathfrak{F}^+_0(D)$ as follows. Let $\theta \in \mathcal{H}(D)$. $\theta$ is a root of the unique polynomial $ax^2 + bx + c \in \mathbb{Z}[x]$ such that $a > 0$ and gcd$(a, b, c) = 1$. $D = b^2 - 4ac$. We define $\psi(\theta) = ax^2 + bxy + cy^2$. Clearly $\psi$ is the inverse map of $\phi$.
Proof of (2) Let $f = ax^2 + bxy + cy^2$. Let $\sigma = \left( \begin{array}{ccc} p & q \\ r & s \end{array} \right) \in \Gamma$. Let $f^\sigma = kx^2 + lxy + my^2$. Let $\theta = \phi(f)$. Let $\gamma = \sigma^{-1}\theta$. Then $\theta = \sigma \gamma$. $a\theta^2 + b\theta + c = 0$. Hence $a(p\gamma + q)^2 + b(p\gamma + q)(r\gamma + s) + c(r\gamma + s)^2 = 0$. The left hand side of this equation is $f(p\gamma + q, r\gamma + s) = k\gamma^2 + l\gamma + m$. Since $f^\sigma$ is positive definite by this question, $k \gt 0$. Since gcd$(k, l, m)$ = 1 by the same question, $\psi(\gamma) = f^\sigma$. Hence $\phi(f^\sigma) = \gamma = \sigma^{-1}\theta$. This proves (2).