What are necessary and sufficient conditions on a binary quadratic form $ax^2+bxy+cy^2$, with integer coefficients and solution set in integers, to be equivalent to $x^2-y^2$, and separately to $x^2+y^2$?


The conditions would be in terms of $a,b,c$ but can we say anything about the transformation matrix? Since we are dealing with integers, the determinant is $\pm 1$, but can it be made $1$?


I'm new to binary quadratic forms, so if these questions are trivial, an accessible reference (which answers the questions) would be great. I think the answers are known from bits and pieces that I've read online.



Classification of these Binary Quadratic Forms
For $x^2 + y^2$, the discriminant $b^2 - 4ac$ is $-4$, and the class number $h(-4)$ is $1$. So the condition is just that the discriminant matches up: $b^2 - 4ac = -4$, and the form is positive definite ($a, c > 0$). For $x^2 - y^2$, I think you just have to differentiate it from $2xy$, which also has discriminant $4$. So the condition is $b^2 - 4ac = 4$, and $a,c$ not both even. You can make the determinant of the transformation matrix $1$ in both cases, because the form is improperly equivalent to itself, for instance by $(x,y) \to (-x,y)$. For an elementary introduction see Chapter 3 of Niven, Zuckerman and Montgomery. For a more advanced treatment of quadratic forms, Cassels book "Rational quadratic forms" is a good reference. There's also Chapter 15 of Conway and Sloane's book "Sphere packings, lattices and groups".


