Jyrki Lahtonen has suggested I write a blog post relating binary quadratic forms to quadratic field class numbers, <https://math.stackexchange.com/questions/209512/binary-quadratic-forms-over-z-and-class-numbers-of-quadratic-%EF%AC%81elds/209543#comment1727526_209543>


The coincidence part of this is Jyrki bringing up this idea within a couple of weeks of Neil Sloane asking about programming for indefinite forms....


However, I remain a little uncertain about how this works with indefinite forms...from Buell, Binary Quadratic Forms, page 103, the group of binary form classes is isomorphic to the narrow class group of $\mathbb Q ( \sqrt \Delta)$ where $\Delta$ is the discriminant, where I suspect $\Delta$ must be a fundamental discriminant because multiplying by an integer square would not change a field extending $\mathbb Q.$


Then page 103, positive forms we are done, class group and narrow class group are isomorphic. Also done if there is a solution in rational integers to $u^2 - D v^2 = -4.$


Finally the problem: if there is no solution to $u^2 - D v^2 = -4,$ Buell says the class group is the squares of the narrow class group. Buchmann and Vollmer say, page 186, say the class group is a quotient of the narrow class group.


Let's see., examples. I put [Positive primes represented by indefinite binary quadratic form](https://mathoverflow.net/questions/171807/positive-primes-represented-by-indefinite-binary-quadratic-form) with this in mind. Cohen says that $\mathbb Q(\sqrt {205})$ has class number 2. There are four classes of indefinite binary forms of discriminant 205, and $u^2 - 205 y^2 = -4$ is impossible. So, we went from 4 to 2...


In the paper with Pete Clark, he deliberately made no distinction between indefinite form $f$ and the form $-f.$ So, one possibility here is that we are just dividing by 2 to go from 4 to 2..


Maybe this is the quick version: as far as I can tell, if $1$ and $-1$ are distinct as binary forms of discriminant $\Delta,$ the principal genus has even size, call that $E.$ Suppose there are $G$ genera, so that the total number of classes of binary forms of this discriminant is $EG.$ What is the class number of $\mathbb Q ( \sqrt \Delta)?$ So, **question**, are the numbers the same for positive forms and when the principal form also represents $-1,$ but if indefinite and the principal form does not represent $-1,$ divide by $2?$


Perhaps I can use this to publicize an elementary trick, **generally unknown**: an indefinite form $\langle a,b,c \rangle$ with positive $\Delta = b^2 - 4 a c$ not a square is reduced, in the sense of Lagrange, Gauss, and Buell, if and only if:
$$ ac < 0 \; \; \; \; \mbox{and} \; \; \; \; b > |a + c| $$ 


So, general Question: how to take the class number of binary forms of discriminant $\Delta,$ where either $\Delta \equiv 1 \pmod 4$ is squarefree, or $\Delta \equiv 0 \pmod 4$ and $\Delta/4 \equiv 2,3 \pmod 4$ and this time $\Delta/4$ is squarefree.


To repeat some examples (I've got programs out the wazoo)




---



```
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle_All_Reduced 5


Sun Jun 22 20:03:44 PDT 2014


5    factored    5

    1.             1           1          -1   cycle length             2
    2.            -1           1           1   cycle length             2


5    factored    5

    1.             1           1          -1   cycle length             2

  form class number is   1

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ 
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle_All_Reduced 12


Sun Jun 22 20:03:52 PDT 2014


12    factored   2^2 *  3

    1.             1           2          -2   cycle length             2
    2.            -1           2           2   cycle length             2
    3.             2           2          -1   cycle length             2
    4.            -2           2           1   cycle length             2


12    factored   2^2 *  3

    1.             1           2          -2   cycle length             2
    2.            -1           2           2   cycle length             2

  form class number is   2

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ 
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle_All_Reduced 85


Sun Jun 22 20:04:08 PDT 2014


85    factored   5 *  17

    1.             1           9          -1   cycle length             2
    2.            -1           9           1   cycle length             2
    3.             3           7          -3   cycle length             6
    4.            -3           7           3   cycle length             6
    5.             3           5          -5   cycle length             6
    6.            -3           5           5   cycle length             6
    7.             5           5          -3   cycle length             6
    8.            -5           5           3   cycle length             6


85    factored   5 *  17

    1.             1           9          -1   cycle length             2
    2.             3           7          -3   cycle length             6

  form class number is   2

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle_All_Reduced 136


Sun Jun 22 20:04:24 PDT 2014


136    factored   2^3 *  17

    1.             1          10          -9   cycle length             4
    2.            -1          10           9   cycle length             4
    3.             3          10          -3   cycle length             6
    4.            -3          10           3   cycle length             6
    5.             9          10          -1   cycle length             4
    6.            -9          10           1   cycle length             4
    7.             2           8          -9   cycle length             4
    8.            -2           8           9   cycle length             4
    9.             3           8          -6   cycle length             6
   10.            -3           8           6   cycle length             6
   11.             6           8          -3   cycle length             6
   12.            -6           8           3   cycle length             6
   13.             9           8          -2   cycle length             4
   14.            -9           8           2   cycle length             4
   15.             5           6          -5   cycle length             6
   16.            -5           6           5   cycle length             6
   17.             5           4          -6   cycle length             6
   18.            -5           4           6   cycle length             6
   19.             6           4          -5   cycle length             6
   20.            -6           4           5   cycle length             6


136    factored   2^3 *  17

    1.             1          10          -9   cycle length             4
    2.            -1          10           9   cycle length             4
    3.             3          10          -3   cycle length             6
    4.            -3          10           3   cycle length             6

  form class number is   4

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ 
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle_All_Reduced 205


Sun Jun 22 20:04:32 PDT 2014


205    factored   5 *  41

    1.             1          13          -9   cycle length             4
    2.            -1          13           9   cycle length             4
    3.             3          13          -3   cycle length             4
    4.            -3          13           3   cycle length             4
    5.             9          13          -1   cycle length             4
    6.            -9          13           1   cycle length             4
    7.             3          11          -7   cycle length             4
    8.            -3          11           7   cycle length             4
    9.             7          11          -3   cycle length             4
   10.            -7          11           3   cycle length             4
   11.             5           5          -9   cycle length             4
   12.            -5           5           9   cycle length             4
   13.             9           5          -5   cycle length             4
   14.            -9           5           5   cycle length             4
   15.             7           3          -7   cycle length             4
   16.            -7           3           7   cycle length             4


205    factored   5 *  41

    1.             1          13          -9   cycle length             4
    2.            -1          13           9   cycle length             4
    3.             3          13          -3   cycle length             4
    4.            -3          13           3   cycle length             4

  form class number is   4

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ 
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle_All_Reduced 221


Sun Jun 22 20:04:40 PDT 2014


221    factored   13 *  17

    1.             1          13         -13   cycle length             2
    2.            -1          13          13   cycle length             2
    3.            13          13          -1   cycle length             2
    4.           -13          13           1   cycle length             2
    5.             5          11          -5   cycle length             4
    6.            -5          11           5   cycle length             4
    7.             5           9          -7   cycle length             4
    8.            -5           9           7   cycle length             4
    9.             7           9          -5   cycle length             4
   10.            -7           9           5   cycle length             4
   11.             7           5          -7   cycle length             4
   12.            -7           5           7   cycle length             4


221    factored   13 *  17

    1.             1          13         -13   cycle length             2
    2.            -1          13          13   cycle length             2
    3.             5          11          -5   cycle length             4
    4.            -5          11           5   cycle length             4

  form class number is   4

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$

```



---



```
in brief, 210 * 4 = 840, 24 reduced forms but 8 SL2 classes,

840    factored   2^3 * 3 * 5 *  7

    1.             1          28         -14   cycle length             2
    2.            -1          28          14   cycle length             2
    3.             2          28          -7   cycle length             2
    4.            -2          28           7   cycle length             2
    5.             3          24         -22   cycle length             4
    6.            -3          24          22   cycle length             4
    7.             6          24         -11   cycle length             4
    8.            -6          24          11   cycle length             4

  form class number is   8

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ 

```



---



Class number for binary quadratic forms discriminant $\Delta$ to class number $\mathbb Q(\sqrt \Delta)$
It seems to me that what Buell says about the narrow class group is not quite right (it's hard for me to say, as I don't have a copy of it). Magma tells me that in $\mathbb{Q}(\sqrt{210})$, the narrow class group is $(\mathbb{Z}/2\mathbb{Z})^{3}$ and the ideal class group is $(\mathbb{Z}/2\mathbb{Z})^{2}$. The squares in the narrow class group would be trivial.


There is a short section (less than a page) in David Cox's "Primes of the form $x^2 + ny^2$" that starts on page 128 where he discusses what happens in the real quadratic case, leaving the task of checking the details to the reader (in a sequence of exercises). Cox states that if you want to stick with the traditional notion of equivalence of forms, then the group of forms is isomorphic to the narrow class group. On the other hand, you can change the notion of equivalence, and say that $f(x,y)$ and $g(x,y)$ are equivalent if
there is a matrix $\left(\begin{matrix} p & q \\ r & s \end{matrix} \right) \in {\rm GL}(2,\mathbb{Z})$ so that $f(x,y) = \det \left(\begin{matrix} p & q \\ r & s \end{matrix}\right) g(px+qy,rx+sy)$, then the group of forms is isomorphic to the class group.


Cox also shows that the class group is a quotient of the narrow class group, and the kernel of that map has order $1$ if there is the norm of the fundamental unit in $\mathcal{O}\_{K}$ is $-1$, and the kernel has order $2$ otherwise. In short the answer to your **question** is yes.


