Relations between fractional ideals of an order of a quadratic number field and binary quadratic forms Let $\mathfrak{F}$ be the set of binary quadratic forms over $\mathbb{Z}$.
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$).
Let $\Gamma =SL_2(\mathbb{Z})$.
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}$ from right.
Let $D$ be a non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$).
We denote the set of binary quadratic forms of discriminant $D$ by $\mathfrak{F}(D)$.
It is easy to see that $\Gamma$ acts on $\mathfrak{F}(D)$ from right.
Let $\sigma = \left( \begin{array}{ccc}
1 & 1 \\
0 & 1 \end{array} \right) \in \Gamma$.
Let $\Gamma_{\infty} = \{\sigma^n; n \in \mathbb{Z}\}$.
$\Gamma_{\infty}$ also acts on $\mathfrak{F}(D)$ from right.
We denote the set of $\Gamma_{\infty}$-orbits on $\mathfrak{F}(D)$ by $\mathfrak{F}(D)/\Gamma_{\infty}$.
Let $K$ be a quadratic number field.
Let $R$ be an order of $K$.
Let $D$ be its discriminant.
It is easy to see that $D$ is not not a square integer and $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$).
We denote the group of invertible elements of the ring $\mathbb{Z}$ by $\mathbb{Z}^\times$.
Namely $\mathbb{Z}^\times = \{-1, 1\}$.
Let $F = ax^2 + bxy + cy^2 \in \mathfrak{F}(D)$.
By this question, $I = \mathbb{Z}a + \mathbb{Z}\frac{(-b + \sqrt{D})}{2}$ is an ideal of $R$.
Hence we get a map $\psi_0\colon \mathfrak{F}(D) \rightarrow \mathfrak{i}(R)$, where $\mathfrak{i}(R)$ is the set of fractional ideals of $R$.
We define a map $\psi_1\colon \mathfrak{F}(D) \rightarrow \mathfrak{i}(R)\times\mathbb{Z}^\times$
by $\psi_1(F) = (\psi_0(F), sgn(a))$, where  $sgn(a)$ is the sign of $a$.
It is easy to see that $\psi_1$ induces a map $\mathfrak{F}(D)/\Gamma_{\infty} \rightarrow \mathfrak{i}(R)\times\mathbb{Z}^\times$.
Hence this map induces a map $$\psi\colon\mathfrak{F}(D)/\Gamma_{\infty} \rightarrow (\mathfrak{i}(R)/\mathbb{Q}^\times)\times\mathbb{Z}^\times$$
Next we would like to define a map $(\mathfrak{i}(R)/\mathbb{Q}^\times)\times\mathbb{Z}^\times \rightarrow \mathfrak{F}(D)/\Gamma_{\infty}$
Let $I \in \mathfrak{i}(R)$.
$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 $\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 $\{\alpha, \beta\}$ be $\mathbb{Z}$-basis of $I \in \mathfrak{i}(R)$.
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.
Let $\{\alpha, \beta\}$ be positively oriented basis of $I \in \mathfrak{i}(R)$.
We can assume that $\alpha \in \mathbb{Q}$. 
Let $x, y$ be indeterminates.
Let $s \in \mathbb{Z}^\times$.
We write $f(\alpha, \beta, s; x, y) = sN_{K/\mathbb{Q}}(x\alpha - sy\beta)/N(I)$.
Namely $f(\alpha, \beta, s; x, y) = s(x\alpha - sy\beta)(x\alpha' - sy\beta')/N(I)$.
It is easy to see that $f(\alpha, \beta, s; x, y)$ is a binary quadratic form of discriminant $D$.
My question
Are the following propositions true?
If yes, how do we prove them?
Proposition 1
The class of $\mathfrak{F}(D)/\Gamma_{\infty}$ represented by $f(\alpha, \beta, s; x, y)$ is determined only by the class of $(\mathfrak{i}(R)/\mathbb{Q}^\times)$ represented by $I$ and $s$.
Proposition 2
By proposition 1, we can define a map $$\phi\colon (\mathfrak{i}(R)/\mathbb{Q}^\times)\times\mathbb{Z}^\times \rightarrow \mathfrak{F}(D)/\Gamma_{\infty}$$ by $\phi(([I], s)) = [f(\alpha, \beta, s; x, y)]$, where $[I]$(resp. $[f(\alpha, \beta, s; x, y)]$) denotes the class represented by $I$(resp. $f(\alpha, \beta, s; x, y)$).
Then $\psi$ and $\phi$ are inverses of each other.
Corollary
Let $\mathfrak{F}_0(D)$ be the set of primitive binary quadratic forms of discriminant $D$.
Let $\mathfrak{I}(R)$ be the group of invertible fractional ideals of $R$.
Then the map $\psi$ induces a bijection:
$$\mathfrak{F}_0(D)/\Gamma_{\infty} \rightarrow (\mathfrak{I}(R)/\mathbb{Q}^\times)\times\mathbb{Z}^\times$$
Proof:
This follows immediately from proposition 2 and the proposition of this question.
 A: Notations
We denote a binary quadrtic form $ax^2 + bxy + cy^2$ also by $(a, b, c)$.
Let $x_1,\cdots,x_n$ be elements of $K$.
We denote by $[x_1,\cdots,x_n]$ the subgroup of $K$ generated by the set $\{x_1,\cdots,x_n\}$.
First we prove that the map $\psi\colon\mathfrak{F}(D)/\Gamma_{\infty} \rightarrow (\mathfrak{i}(R)/\mathbb{Q}^\times)\times\mathbb{Z}^\times$ is well-defined.
It suffices to prove the following lemma.
Lemma 1
Let $\psi_0\colon \mathfrak{F}(D) \rightarrow \mathfrak{i}(R)$ be the map defined in the question.
Let $(a, b, c) \in \mathfrak{F}(D)$.
Then $\psi_0((a,b,c)^{\sigma^n}) = \psi_0((a, b, c))$, where $\sigma = \left( \begin{array}{ccc}
1 & 1 \\
0 & 1 \end{array} \right) \in \Gamma$ and $n \in \mathbb{Z}$.
Proof:
Note that $\sigma^n = \left( \begin{array}{ccc}
1 & n \\
0 & 1 \end{array} \right) \in \Gamma$.
$a(x + ny)^2 + b(x + ny)y + cy^2 = ax^2 + (2an + b)xy + an^2 + bn + c$.
Hence $(a,b,c)^{\sigma^n} = (a, 2an + b, an^2 + bn + c)$.
Hence $\psi_0((a,b,c)^{\sigma^n}) = [a, (-2an - b + \sqrt D)/2] = [a, -an + (-b + \sqrt D)/2] = [a, (-b + \sqrt D)/2] = \psi_0((a, b, c)).$
QED
Definition 1
Let $I$ be a fractional ideal of $R$.
Let $\alpha, \beta$ be $\mathbb{Z}$-basis of $I$.
It is easy to see that $\Delta(\alpha, \beta)^2$ is a non-zero rational number and independent of the choice of the $\mathbb{Z}$-basis(see Lemma 7 of my answer to this question).
We denote it by $d(I)$.
Lemma 2
Let $I$ be a fractional ideal of $R$.
Let $\gamma \in I$.
Then $N(\gamma)/N(I)$ is a rational integer.
Proof:
We may suppose $\gamma \ne 0$.
By Proposition 13 of my answer to this question, $N(\gamma R)/N(I)$ is a rational integer. On the other hand, by Proposition 11 of the same answer, $N(\gamma R) = |N(\gamma)|$.
QED
Definition 2
Let $I = [\alpha, \beta]$ be a fractional ideal of $R$.
Let $x, y$ be indeterminates.
Let $s \in \mathbb{Z}^\times$.
We write $f(\alpha, \beta, s; x, y) = sN_{K/\mathbb{Q}}(x\alpha - sy\beta)/N(I)$.
Namely $f(\alpha, \beta, s; x, y) = s(x\alpha - sy\beta)(x\alpha' - sy\beta')/N(I)$.
Lemma 3
Let $I = [\alpha, \beta]$ be a fractional ideal of $R$.
Then $f(\alpha, \beta, s; x, y)$ is an integral binary quadratic form of discriminant $D$,
i.e. $f(\alpha, \beta, s; x, y) \in \mathfrak{F}(D)$.
Proof:
We first prove that $f(\alpha, \beta, s; x, y)$ has integral coefficients.
$N(x\alpha - sy\beta) = (x\alpha - sy\beta)(x\alpha' - sy\beta')
= (\alpha \alpha')x^2 - s(\alpha\beta' + \beta\alpha')xy + (\beta\beta')y^2$.
Hence $f(\alpha, \beta, s; x, y) = ax^2 + bxy + cy^2$,
where
$a = s(\alpha \alpha')/N(I)$
$b = -(\alpha\beta' + \beta\alpha')/N(I)$
$c = s(\beta\beta')/N(I).$
By Lemma 2, $a, c \in \mathbb{Z}$.
$N(\alpha + \beta) = (\alpha + \beta)(\alpha' + \beta')
= \alpha \alpha' + (\alpha\beta' + \beta\alpha') + \beta\beta'$.
Hence $(\alpha\beta' + \beta\alpha')/N(I) = N(\alpha + \beta)/N(I) - N(\alpha) /N(I) - N(\beta)/N(I)$.
Hence, by Lemma 2, $b \in \mathbb{Z}$.
It remains to prove that the discriminant of $f(\alpha, \beta, s; x, y)$ is $D$.
Since $(\alpha\beta' + \beta\alpha')^2 - 4\alpha \alpha'\beta\alpha' = (\alpha\beta' - \beta\alpha')^2 = \Delta(\alpha, \beta)^2 = d(I), b^2 - 4ac = d(I)/N(I)^2$.
Hence, by the corollary of Proposition 12 of my answer to this question, $b^2 - 4ac = D$.
QED
Lemma 4
Let $I = [\alpha, \beta]$ be a fractional ideal of $R$.
Let $r \ne 0$ be a rational number.
Then $f(r\alpha, r\beta, s; x, y) = f(\alpha, \beta, s; x, y)$.
Proof:
$f(r\alpha, r\beta, s; x, y) = sN(xr\alpha - syr\beta)/N(rI) = sN(r)N(x\alpha - sy\beta)/|N(r)|N(I) = sr^2N(x\alpha - sy\beta)/r^2N(I) = f(\alpha, \beta, s; x, y).$
QED
Lemma 5
Let $I$ be a fractional ideal of $R$.
Then there exists $r \in \mathbb{Q}$ and a primitive ideal(see here) $I_0$ such that $I = rI_0$.
Proof:
There exists $\gamma \ne 0 \in K$ such that $\gamma I \subset R$.
We may suppose $\gamma \in R$.
Let $c = N(\gamma)$.
Then $cI = \gamma'\gamma I \subset \gamma'R \subset R$.
There exist $d \in \mathbb{Z}$ and a primitive ideal $I_0$ such that $cI = dI_0$.
Hence $I = rI_0$, where $r = d/c$.
QED
Lemma 6
Let $I$ be a primitive ideal of $R$.
Suppose $I = [c, \beta]$, where $c$ is a rational integer.
Then $\beta$ can be written as $\beta = d \pm \omega$, where $d \in \mathbb{Z}, \omega = (D + \sqrt D)/2$.
Proof:
Let $a, b + \omega$ be the canonical basis of $I$(see here).
Since $I \cap \mathbb{Z} = a\mathbb{Z} = c\mathbb{Z}$, $c = \pm a$.
Since $R = [1, \omega]$, $\beta$ can be written as $\beta = d + e\omega, d, e \in \mathbb{Z}$.
Then $N(I) = a = |ce| = a|e|$.
Hence $e = \pm 1$.
QED
Lemma 7
Let $I$ be a primitive ideal of $R$.
Suppose $I = [a, \beta] = [a, \gamma]$, where $a \gt 0$ is a rational integer and both $\{a, \beta\}$ and $\{a, \gamma\}$ are positively oriented.
Then $\beta - \gamma \in a\mathbb{Z}$.
Proof:
By Lemma 6, there exists $d \in \mathbb{Z}$ such that $\beta = d \pm \omega$.
If $\beta = d + \omega, \Delta(-a, \beta) = -a(d + \omega') + a(d + \omega) = a(\omega - \omega') = a\sqrt D$.
If $\beta = d - \omega, \Delta(-a, \beta) = -a(d - \omega') + a(d - \omega) = a(\omega' - \omega) = -a\sqrt D$.
Since $\{a, \beta\}$ is positively oriented, $\beta$ must be $d + \omega$.
Similarly $\gamma = c + \omega$.
Hence $\beta - \gamma = d - c \in I \cap \mathbb{Z} = a\mathbb{Z}$.
QED
Lemma 8
Let $I$ be a fractional ideal of $R$.
Suppose $\{\alpha, \beta\}$ is a positively oriented $\mathbb{Z}$-basis of $I$.
Then $\{\alpha, \beta+n\alpha\}$ is also a positively oriented $\mathbb{Z}$-basis of $I$ for any $n \in \mathbb{Z}$
and $f(\alpha, \beta+n\alpha, s; x, y) = f(\alpha, \beta, s; x, y)^{\sigma^{-sn}}$.
Proof:
Clearly $I = [\alpha, \beta+n\alpha]$.
$\Delta(-\alpha, \beta + n\alpha) = -\alpha(\beta' + n\alpha') + \alpha'(\beta + n\alpha)
= \Delta(\alpha, \beta)$.
Hence $\{\alpha, \beta+n\alpha\}$ is positively oriented.
Suppose $f(\alpha, \beta, s; x, y) = (a, b, c)$.
$a = s(\alpha \alpha')/N(I)$
$b = -(\alpha\beta' + \beta\alpha')/N(I)$
$c = s(\beta\beta')/N(I).$
Suppose $f(\alpha, \beta+n\alpha, s; x, y) = (k, l, m)$.
$k = s(\alpha \alpha')/N(I) = a$
$l = -(\alpha(\beta+ n\alpha)' + (\beta + n\alpha)\alpha')/N(I) = b - 2sna$
$m = s(\beta+n\alpha)(\beta'+n\alpha')/N(I)
= s(\beta\beta' + n(\beta\alpha' + \alpha\beta') + n^2\alpha\alpha')/N(I)
= c - snb + an^2$
Hence $(k, l, m) = (a, b, c)^{\sigma^{-sn}}$.
QED
Proof of Proposition 1
Let $I, J$ be fractional ideals of $R$.
Suppose $I = [\alpha, \beta], J = [\gamma, \delta]$,
where $\alpha, \gamma \in \mathbb{Q}$ and 
$\{\alpha, \beta\}$ and$\{\gamma, \delta\}$ are positively oriented bases of $I$ and $J$ respectively.
Suppose $J = rI$ for some $r \in \mathbb{Q}$.
We need to prove that $f(\gamma, \delta, s; x, y) = f(\alpha, \beta, s; x, y)^{\sigma^n}$
for some $n \in \mathbb{Z}$.
By Lemma 5, there exists $q \in \mathbb{Q}$ and a primitive ideal $I_0$ such that $I = qI_0$.
Then $J = rqI_0$.
Hence $I_0 = [(1/q)\alpha, (1/q)\beta] = [(1/rq)\gamma, (1/rq)\delta]$.
Hence, by Lemma 4, we may suppose that $I$ is a primitive ideal and $I = J$.
Since $I = [-\alpha, -\beta]$, we may suppose $\alpha \gt 0$ by Lemma 4.
Similarly we may suppose $\gamma \gt 0$.
Since $I \cap \mathbb{Z} = \alpha \mathbb{Z} = \gamma \mathbb{Z}$, $\alpha = \gamma$.
Hence, by Lemma 7 and Lemma 8, we are done.
QED
Proof of Proposition 2
We first prove that $\phi\circ \psi = 1$.
Let $(a, b, c) \in \mathfrak{F}(D)$.
Let $I = [a, (-b + \sqrt D)/2] = [a, - (D + b)/2 + \omega]$, where $\omega = (D + \sqrt D)/2$.
Note that $I$ is a primitive ideal.
Suppose $a \gt 0$.
Note that $N(I) = a$.
Let $\alpha = a, \beta = (-b + \sqrt D)/2$.
$\{\alpha, \beta\}$ is positively oriented.
Suppose $f(\alpha, \beta, 1; x, y) = (k, l, m)$.
$k = (\alpha \alpha')/N(I) = a^2/a = a$
$l = -(\alpha\beta' + \beta\alpha')/N(I) = ab/a = b$
$m = (\beta\beta')/N(I) = (b^2 - D)/4a = 4ac/4a = c$
Suppose $a \lt 0$.
Note that $I = [-a, (-b + \sqrt D)/2$ and $N(I) = -a$.
Let $\alpha = -a, \beta = (-b + \sqrt D)/2$.
$\{\alpha, \beta\}$ is positively oriented.
Suppose $f(\alpha, \beta, -1; x, y) = (k, l, m)$.
$k = -(\alpha \alpha')/N(I) = a^2/a = a$
$l = -(\alpha\beta' + \beta\alpha')/N(I) = ab/a = b$
$m = -(\beta\beta')/N(I) = (b^2 - D)/4a = 4ac/4a = c$
Hence $\phi\circ \psi = 1$ in either case.
It remains to prove that $\psi\circ \phi = 1$.
Let $I = [a, b + \omega]$ be a primitive ideal of $R$, where $a \gt 0, b \in \mathbb{Z}, \omega = (D + \sqrt D)/2$.
Let $\alpha = a, \beta = b + \omega$.
Let $s \in \mathbb{Z}^\times$.
Let us compute $f(\alpha, \beta, s; x, y)$.
Let $f(\alpha, \beta, s; x, y) = (k, l, m)$.
$k = s(\alpha \alpha')/N(I) = sa$
$l = -(\alpha\beta' + \beta\alpha')/N(I) = -(2b + D)$
$m = s(\beta\beta')/N(I) = s(b^2 + bD + (d^2 - d)/4)/a.$
Hence $\psi\circ\phi([I], s) = ([[sa, b + (D + \sqrt D)/2]], s) = ([I], s)$.
QED
