# Math Help - quadratic forms

Consider a quadratic form $f(x,y) = ax^2 + bxy + cy^2$ with $a,b,c \in \mathbb{Z}$ and discriminant $D = b^2 - 4ac$
We know that f factors as a product of linear forms $(ux+vy)(u'x+v'y)$ with rational coefficients if and only if D is a square.
Under which conditions for $a,b,c$ are $u,v,u',v' \in \mathbb{Z}$?