For a general quadratic equation with rational coefficients

the two solutions are:

where D is the determinant.
Clearly, a solution will a rational number as long as
is rational. However, it can be shown that a square root of an integer is only rational if its value is an integer. In other words,
is rational if and only if the determinant is a perfect square,
, otherwise the square root is irrational. Therefore the coefficients of quadratic equations that are to have rational solutions must satisfy the following condition:
