TITLE: On the equivalence of a pair of binary quadratic forms
QUESTION [8 upvotes]: Let $f,g, u,v \in \mathbb{Z}[x,y]$ be binary quadratic forms with co-prime coefficients. We say that the pair $(f,g)$ and $(u,v)$ are $\operatorname{GL}_2(\mathbb{Z})$-equivalent if there exists $T = \left(\begin{smallmatrix} t_1 & t_2 \\ t_3 & t_4 \end{smallmatrix} \right) \in \operatorname{GL}_2(\mathbb{Z})$ such that
$$\displaystyle f(t_1 x + t_2 y, t_3 x + t_4 y) = u(x,y).$$
and
$$\displaystyle g(t_1 x + t_2 y, t_3 x + t_4 y) = v(x,y).$$
Note that if the pair $(f,g)$ is equivalent to $(u,v)$, then $f$ is equivalent to $u$ and $g$ equivalent to $v$ as individual binary quadratic forms, but the converse need not be true, since it is not clear that there exists a common matrix $T$ that sends $f$ to $u$ and $g$ to $v$. 
Aside from the discriminants $\Delta(f), \Delta(g)$ of the individual forms $f$ and $g$, the pair $(f,g)$ has one more invariant which can be taken to be
$$\displaystyle \Delta(f,g) = 2 f_2 g_0 - f_1 g_1 + 2 f_0 g_2,$$
where $f(x,y) = f_2 x^2 + f_1 xy + f_0 y^2$ and $g(x,y) = g_2 x^2 + g_1 xy + g_0 y^2$. 
Denote by $h(d_1, d_2, d_3)$ to be the class number of $\operatorname{GL}_2(\mathbb{Z})$-equivalence classes of pairs of binary quadratic forms $(f,g)$ with $\Delta(f) = d_1, \Delta(g) = d_2$, and $\Delta(f,g) = d_3$. Are there any estimates for $h(d_1, d_2, d_3)$ in terms of $d_1$ and $d_2$, or average estimates with $0 < \max\{|d_1|, |d_2|,|d_3|\} \leq X$?
I have consulted an old paper by Dickson (https://www.jstor.org/stable/2370100?seq=1#page_scan_tab_contents) but he only treated the easier case of $\operatorname{GL}_2(\mathbb{Q})$-equivalence. 
Any help or reference would be appreciated!

REPLY [4 votes]: The exact class number formula was given by Jorge Morales in the following paper:
Jorge Morales. The classification of pairs of binary quadratic forms. Acta Arith., 59(2):105–121, 1991.
In particular, he showed that 
$$\displaystyle h(d_1, d_2, d_3) = m \sum_{n | 4(d_3^2 - d_1 d_2)} \left(\frac{d_1}{n}\right),$$
where $m = 1$ if $d_3^2 - d_1 d_1 \geq 1$ and $m = 2$ if $d_3^2 - d_1 d_1 < 0$, and $\left(\frac{\cdot}{n}\right)$ is the Jacobi symbol. 
The case when computing the class number $h(d_1, d_2, d_3)$ of pairs $(f,g)$ with $\Delta(f) = d_1, \Delta(g) = d_2, \Delta(f,g) = d_3$ and $f,g$ are both positive definite was resolved by an earlier paper by K. Hardy and K. Williams.