# Equivalence of Semidefinite Binary Quadratic Form

I'm currently reading elementary number theory books, specifically in the chapter of binary quadratic forms. This problem got my attention.

Let $$f(x,y)=ax^2+bxy+cy^2$$ and $$g(x,y)=rx^2$$, where $$r=gcd(a,b,c)$$ and $$f$$ is a positive semidefinite quadratic form with discriminant $$d=0$$. Prove that $$f$$ is equivalent to $$g$$.

I know that $$f$$ can be expressed as $$f(x,y)=r(hx+ky)^2$$ since the dicriminant of $$f$$ is $$d=0$$. Then there exist integers $$x_0$$ and $$y_0$$ such that $$f(x_0,y_0)=0$$. Also $$gcd(h,k)=1$$ so there must be integers $$u$$ and $$v$$ with $$hu+kv=1$$. My guess is that the matrix $$M=\begin{pmatrix}u&x_0\\v&y_0 \end{pmatrix}$$ takes $$f$$ to $$g$$. Now, if $$g(x,y)=Ax^2+Bxy+Cy^2$$, then $$A=f(u,v)=r$$ and $$C=f(x_0,y_0)=0$$. But I'm not sure if this will make $$B=0$$ or if my assumption is right. Can someone help me to prove this? Thank you in advance.

With integers $$a,b,c$$ and $$b^2 = 4ac.$$
take $$g = \gcd(2a,b)$$ and solve Bezout equation $$\frac{2a}{g} \; u + \frac{b}{g} v = 1$$ in integers.
Now multiply out $$\left( \begin{array}{cc} u & v \\ - \frac{b}{g} & \frac{2a}{g} \\ \end{array} \right) \left( \begin{array}{cc} 2a & b \\ b & 2c \\ \end{array} \right) \left( \begin{array}{cc} u & -\frac{b}{g} \\ v & \frac{2a}{g} \\ \end{array} \right)$$ In case of trouble, note that the determinant of the product is the same as the original determinant, as we arranged the left and right matrices to have determinant $$1 \; . \;$$
• Sir how does this product be equal to $\begin{pmatrix}2r & 0 \\0 & 0\end{matrixp}$ ? Commented May 1, 2020 at 6:17