Zagiers Class Number Definition of Binary Quadratic Forms If I understood the definition of class numbers of discriminant $D$ for binary quadratic forms (b.q.f.) correctly, the class number $h(D)$ for a given discriminant $D$ is the number of equivalence classes $(*)$ of b.q.f. with discriminant $D$. 
$(*)$ Two binary quadratic forms $f_1, f_2$ are equivalent if there exists $M \in \text{SL}(2 \times 2, \mathbb{Z})$ such that $f_1(x, y) = f_2(M\cdot(x, y)^t)$.
I'm currently reading Don Zagiers "Zetafunktionen and quadratische Körper". He writes that there are two more very imported invariants of binary quadratic forms and is going to use them to further refine the classification. Namely:


*

*the gcd of the coefficients of the b.q.F.

*the sign of the first coefficient


In the case $D<0$ the first coefficients of two equivalent b.q.f. have the same sign. He writes: In the case $D < 0 $ we therefore only need to look at b.q.f with positive first coefficient (positive definite). He also writes, that we only need to consider b.q.f. where the gcd of the coefficients equals $1$ (a primitive b.q.f), since a b.q.f. of Discriminant $D$, where the gcd equals $r$ is $r$ times a primitive b.q.f of Discriminant $\frac{D}{r}$. He than defines the class number for discriminant $D$ as:
$$h(D) := 
\begin{cases}
      \text{number of equivalence classes of primitive b.q.f.} \\ \text{with discriminant $D$ if $D>0$} \\[10pt]
      \text{number of equivalence classes of primitive, positive definite b.q.f.} \\ \text{with discriminant $D$ if $D < 0$} 
\end{cases}$$
Somehow this isn't clear to me. Is this definition equivalent to the original definition I gave in the first paragraph. Is the statement here that we can find a representative of a specific form? Or do we truly refine the number of equivalence classes? 
 A: the class number is always for primitive forms. Among other things, this allows Gauss composition to make the set of classes into a group. 
For definite forms, the negative definite forms are just a copy of the positive definite forms, each negated. Furthermore, the composition of two positive forms is positive. So, we always take the positive definite forms.
He does automorphism group page 63. Finally he does reduction page 120, for indefinite forms 122 (6) (this is his version, different from Gauss/Lagrange). 
I suggest you fill in with other sources for the quadratic form parts. From about 1929, Introduction to the Theory of Numbers by Leonard Eugene Dickson. For composition, genera, Primes of the Form $x^2 + n y^2$ by David A. Cox. This has a very clean presentation of Dirichlet's method of computing composition, which has the advantage of actually resembling a mulitplication

A: The answer is NO. You gave two (different) definitions of the class number $h(D).$ They are not necessarily the equivalent. Here is one counterexample:
Consider $D=-12.$ On the one hand, there are TWO many binary quadratic forms of discriminant $-12$ up to equivalence, namely $q_1=x^2+3y^2$ and $q_2=2x^2+2xy+2y^2.$ Note that $q_2$ is not primitive.
On the other hand, there is only ONE primitive, binary quadratic form of discriminant $-12$ up to equivalence, namely $q_1.$
