# Rational root theorem

In algebra, the rational root theorem (or rational root test, rational zero theorem, rational zero test or p/q theorem) states a constraint on rational solutions of a polynomial equation

${\displaystyle a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots +a_{0}=0\,\!}$

with integer coefficients. These solutions are the possible roots (equivalently, zeroes) of the polynomial on the left side of the equation.

If a0 and an are nonzero, then each rational solution x, when written as a fraction x = p/q in lowest terms (i.e., the greatest common divisor of p and q is 1), satisfies

The rational root theorem is a special case (for a single linear factor) of Gauss's lemma on the factorization of polynomials. The integral root theorem is a special case of the rational root theorem if the leading coefficient an = 1.

## Application

The theorem is used in order to determine whether a polynomial has any rational roots, and if so to find them. Since the theorem gives constraints on the numerator and denominator of the fully reduced rational roots as being divisors of certain numbers, all possible combinations of divisors can be checked and either the rational roots will be found or it will be determined that there are none. If one or more are found, they can be factored out of the polynomial, resulting in a polynomial of lower degree whose roots are also roots of the original polynomial.

### Cubic equation

The general cubic equation

${\displaystyle ax^{3}+bx^{2}+cx+d=0}$

with integer coefficients has three solutions in the complex plane. If it is found by the rational root test that there are no rational solutions, then the only way to express the solutions algebraically is to use cube roots. But if the test finds three rational solutions, then the cube roots are avoided. And if precisely one rational solution r is found to exist, then (xr) can be factored out of the cubic polynomial using polynomial long division, leaving a quadratic polynomial whose two roots are the remaining two roots of the cubic; and these can be found using the quadratic formula, again avoiding the use of cube roots.

## Proofs

### First proof

Let P(x) = anxn + an−1xn−1 + ... + a1x + a0 for some a0, ..., anZ, and suppose P(p/q) = 0 for some coprime p, qZ:

${\displaystyle P\left({\tfrac {p}{q}}\right)=a_{n}\left({\tfrac {p}{q}}\right)^{n}+a_{n-1}\left({\tfrac {p}{q}}\right)^{n-1}+\cdots +a_{1}\left({\tfrac {p}{q}}\right)+a_{0}=0.}$

If we multiply both sides by qn, shift the constant term to the right hand side, and factor out p on the left hand side, we get

${\displaystyle \qquad p(a_{n}p^{n-1}+a_{n-1}qp^{n-2}+\cdots +a_{1}q^{n-1})=-a_{0}q^{n}.}$

We see that p times the integer quantity in parentheses equals −a0qn, so p divides a0qn. But p is coprime to q and therefore to qn, so by (the generalized form of) Euclid's lemma it must divide the remaining factor a0 of the product.

If we instead shift the leading term to the right hand side and factor out q on the left hand side, we get

${\displaystyle \qquad q(a_{n-1}p^{n-1}+a_{n-2}qp^{n-2}+\cdots +a_{0}q^{n-1})=-a_{n}p^{n}.}$

And for similar reasons, we can conclude that q divides an.[1]

### Proof using Gauss's lemma

Should there be a nontrivial factor dividing all the coefficients of the polynomial, then one can divide by the greatest common divisor of the coefficients so as to obtain a primitive polynomial in the sense of Gauss's lemma; this does not alter the set of rational roots and only strengthens the divisibility conditions. That lemma says that if the polynomial factors in ℚ[X], then it also factors in ℤ[X] as a product of primitive polynomials. Now any rational root p/q corresponds to a factor of degree 1 in ℚ[X] of the polynomial, and its primitive representative is then qxp, assuming that p and q are coprime. But any multiple in ℤ[X] of qxp has leading term divisible by q and constant term divisible by p, which proves the statement. This argument shows that more generally, any irreducible factor of P can be supposed to have integer coefficients, and leading and constant coefficients dividing the corresponding coefficients of P.

## Examples

### First

In the polynomial

${\displaystyle 2x^{3}+x-1,}$

any rational root fully reduced would have to have a numerator that divides evenly into 1 and a denominator that divides evenly into 2. Hence the only possible rational roots are ±1/2 and ±1; since neither of these equates the polynomial to zero, it has no rational roots.

### Second

In the polynomial

${\displaystyle x^{3}-7x+6}$

the only possible rational roots would have a numerator that divides 6 and a denominator that divides 1, limiting the possibilities to ±1, ±2, ±3, and ±6. of these, 1, 2, and –3 equate the polynomial to zero, and hence are its rational roots. (In fact these are its only roots since a cubic has only three roots; in general, a polynomial could have some rational and some irrational roots.)

### Third

Every rational root of the polynomial

${\displaystyle 3x^{3}-5x^{2}+5x-2\,\!}$

must be among the numbers symbolically indicated by

${\displaystyle \pm {\frac {1,2}{1,3}}\,,}$

which gives the list of 8 possible answers:

${\displaystyle \pm \{1,2,{\frac {1}{3}},{\frac {2}{3}}\}.}$

These root candidates can be tested using Horner's method (for instance). In this particular case there is exactly one rational root. If a root candidate does not cause the polynomial to equal zero, it can be used to shorten the list of remaining candidates.[2] For example, x = 1 does not work, as the polynomial then equals 1. This means that substituting x = 1 + t yields a polynomial in t with constant term 1, while the coefficient of t3 remains the same as the coefficient of x3. Applying the rational root theorem thus yields the following possible roots for t:

${\displaystyle t=\pm {\frac {1}{1,3}}.}$

Therefore,

${\displaystyle x=1+t=2,0,{\frac {4}{3}},{\frac {2}{3}}.}$

Root candidates that do not occur on both lists are ruled out. The list of rational root candidates has thus shrunk to just x = 2 and x = 2/3.

If k rational roots are found (k ≥ 1), Horner's method will also yield a polynomial of degree n − k whose roots, together with the rational roots, are exactly the roots of the original polynomial. It may also be the case that none of the candidates is a solution; in this case the equation setting the polynomial equal to 0 has no rational solution. If the equation lacks a constant term a0, then 0 is one of the rational solutions of the equation.