Discriminant of a binary quadratic form (source code)

= Discriminant of a binary quadratic form
{title2=$D=b^2-4ac$}

The <discriminant of a binary quadratic form> $[a,b,c]$ is $D=b^2-4ac$. For integer <polynomial coefficients>, $D$ is congruent to zero or one <modulo> four. Completing the square gives
$$
4a\,f(x,y)=(2ax+by)^2-Dy^2.
$$
Thus for real <polynomial coefficients> with $a>0$, <positive definiteness> holds exactly when $D<0$. For $D>0$ the form is an <indefinite quadratic form>, taking values of both signs; for $D=0$ it is degenerate. For example, $x^2+y^2$ has $D=-4$, whereas $x^2-y^2$ has $D=4$.

Over the <real numbers>, use the <symmetric matrix> $A=\begin{pmatrix}a&b/2\\b/2&c\end{pmatrix}$. Its <determinant> is $-D/4$. An integer coordinate change $M$ gives $A'=M^TAM$, so
$$
D(f\circ M)=\det(M)^2D(f).
$$
In particular <unimodular matrices> preserve $D$, proving its invariance under <proper equivalence>. Changes with other determinants can change the discriminant. For instance, replacing $x$ by $2x$ takes $x^2+y^2$ to $4x^2+y^2$ and multiplies $D$ by four. The chosen half-coefficient matrix convention matters in this calculation.