Sub topic 10
Perfect-Square Discriminants and Rational Roots
Assume you can solve linear equations, expand simple polynomials, simplify square roots, and use the quadratic formula. This chapter focuses on what happens when the discriminant is a perfect square.
When the discriminant is a perfect square
For a quadratic equation in standard form,
\[ ax^2+bx+c=0,\qquad a\ne0, \]
the discriminant is
\[ D=b^2-4ac. \]
The quadratic formula is
\[ x=\frac{-b\pm\sqrt D}{2a}. \]
If \(a\), \(b\), and \(c\) are integers and \(D\) is a nonnegative perfect square, then \(\sqrt D\) is an integer. The numerator and denominator in the quadratic formula are therefore integers, so both roots are rational numbers.
A rational number is a number that can be written as a fraction of two integers, with a nonzero denominator.
For example, consider
\[ 6x^2-7x-3=0. \]
Here, \(a=6\), \(b=-7\), and \(c=-3\). The discriminant is
\[ D=(-7)^2-4(6)(-3)=49+72=121=11^2. \]
Substitute into the formula:
\[ x=\frac{-(-7)\pm\sqrt{121}}{2(6)} =\frac{7\pm11}{12}. \]
Thus,
\[ x=\frac{18}{12}=\frac32 \]
or
\[ x=\frac{-4}{12}=-\frac13. \]
Both roots are rational.
Perfect squares and factoring
A perfect-square discriminant often means that the quadratic can be factored over the integers or rational numbers. In the example above,
\[ 6x^2-7x-3=(3x+1)(2x-3). \]
Setting each factor equal to zero gives
\[ x=-\frac13 \quad\text{or}\quad x=\frac32. \]
Factoring can be faster when it is easy to see. The quadratic formula is more systematic because it works even when the factors are not obvious.
The following table summarizes the connection between the discriminant and the roots.
| Discriminant | Square-root behavior | Type of roots |
|---|---|---|
| \(D>0\) and a perfect square | \(\sqrt D\) is an integer | Two distinct rational roots |
| \(D=0\) | \(\sqrt D=0\) | One repeated rational root |
| \(D>0\), not a perfect square | \(\sqrt D\) is irrational | Two irrational real roots |
| \(D<0\) | \(\sqrt D\) is not real | Two complex roots |
The repeated-root case
If \(D=0\), the plus and minus versions of the formula produce the same value:
\[ x=\frac{-b}{2a}. \]
For example,
\[ x^2-6x+9=0 \]
has
\[ D=(-6)^2-4(1)(9)=36-36=0. \]
Its only root is
\[ x=\frac{-(-6)}{2(1)}=3. \]
The equation factors as
\[ (x-3)^2=0, \]
so \(x=3\) is a repeated rational root.
Exact computation with Python
Using Fraction keeps rational answers exact instead of converting them to decimal approximations.
from fractions import Fraction
from math import isqrt
def rational_roots(a, b, c):
if a == 0:
raise ValueError("a must be nonzero")
discriminant = b * b - 4 * a * c
if discriminant < 0:
raise ValueError("the roots are not real")
root = isqrt(discriminant)
if root * root != discriminant:
raise ValueError("the roots are not rational")
denominator = 2 * a
first = Fraction(-b - root, denominator)
if root == 0:
return [first]
second = Fraction(-b + root, denominator)
return [first, second]
print(rational_roots(6, -7, -3)) # [Fraction(-1, 3), Fraction(3, 2)]A quick decision process
Exercise
For 2x² + 5x - 3 = 0, determine whether the roots are rational and find them.
Show answer
D = 5² − 4(2)(−3) = 49 = 7², so the roots are rational. The roots are x = (−5 ± 7)/4, giving x = 1/2 and x = −3.