acalculator

What is the rational zero theorem?

Type a polynomial such as 2x^3 + x^2 − 4x + 1. The rational zero theorem calculator lists the factors p of the constant term and q of the leading coefficient, every candidate ±p/q, and which candidates are actual zeros.

Your numbers

Rational zeros
1

Rational zeros of f: 1.

Possible rational zeros
±1, ±1/2
Number of candidates
4
Factors p of the constant term
1
Factors q of the leading coefficient
1, 2
Polynomial used
2x^3 + x^2 - 4x + 1
Steps
Polynomial: 2x³ + x² − 4x + 1; Factors p of the constant term 1: 1; Factors q of the leading coefficient 2: 1, 2; Possible rational zeros ±p/q: ±1, ±1/2; Test each: f(r) = 0 for r = 1

Rational zeros: 1. Rational zeros of f: 1.

How to calculate

Lists every possible rational zero ±p/q of a polynomial by the rational zero theorem, then tests each one exactly to find the actual rational zeros.

Example with the default inputs (Polynomial f(x) 2x^3 + x^2 - 4x + 1): Rational zeros of f: 1.

Method: Clear fractions, divide out the lowest power of x (0 is then a zero), list ±p/q with p dividing the constant term and q the leading coefficient, and test each exactly.

  • f is a polynomial in one letter with whole powers 0 to 20; fractions are cleared by multiplying by the least common multiple of the bottoms.
  • The constant term and leading coefficient (after clearing) are each at most 1,000,000 in size.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Polynomial f(x) 2x^3 + x^2 - 4x + 1 gives Rational zeros 1, Possible rational zeros ±1, ±1/2, Number of candidates 4, Steps Polynomial: 2x³ + x² − 4x + 1; Factors p of the constant term 1: 1; Factors q of the leading coefficient 2: 1, 2; Possible rational zeros ±p/q: ±1, ±1/2; Test each: f(r) = 0 for r = 1.Source: OpenStax, Algebra and Trigonometry 2e, §5.5 Zeros of Polynomial Functions, Example 4 (f(x) = 2x³ + x² − 4x + 1: candidates ±1 and ±1/2; 1 is the only rational zero), https://openstax.org/books/algebra-and-trigonometry-2e/pages/5-5-zeros-of-polynomial-functions
  2. Polynomial f(x) 2x^4 - 5x^3 + x^2 - 4 gives Possible rational zeros ±1, ±2, ±4, ±1/2, Number of candidates 8, Factors p of the constant term 1, 2, 4, Factors q of the leading coefficient 1, 2, Rational zeros None: f has no rational zeros.Source: OpenStax, Algebra and Trigonometry 2e, §5.5 Zeros of Polynomial Functions, Example 3 (f(x) = 2x⁴ − 5x³ + x² − 4: possible rational zeros ±1, ±2, ±4, ±1/2), https://openstax.org/books/algebra-and-trigonometry-2e/pages/5-5-zeros-of-polynomial-functions
  3. Polynomial f(x) -x^3 + 3x^2 + 4x - 12 gives Rational zeros −2, 2, 3, Possible rational zeros ±1, ±2, ±3, ±4, ±6, ±12, Number of candidates 12.
  4. Polynomial f(x) x^4/2 - x^2/2 gives Rational zeros −1, 0, 1, Polynomial used x^2 - 1, Steps Multiply by 2 to clear fractions; Divide out x²: x = 0 is a zero; Polynomial: x² − 1; Factors p of the constant term −1: 1; Factors q of the leading coefficient 1: 1; Possible rational zeros ±p/q: ±1; Test each: f(r) = 0 for r = −1, 0, 1.

How it works

  1. Multiply out the typed polynomial and combine like terms (exact fractions).
  2. Clear fractions: multiply every coefficient by the least common multiple of their bottoms, so all coefficients are whole numbers.
  3. Divide out x^m, where m is the lowest power with a coefficient that is not 0. If m > 0, x = 0 is a zero. The constant term a₀ is then the coefficient of x^m, and the leading coefficient aₙ the coefficient of the highest power.
  4. Factors: p runs over the positive factors of |a₀| and q over the positive factors of |aₙ|.
  5. Candidates: every ±p/q in lowest terms, without repeats.
  6. Test: r = p/q is a zero exactly when Σ aᵢ p^(i−m) q^(n−i) = 0 (f(r) × q^(n−m), all whole numbers), checked for +p/q and −p/q.

Input. A polynomial in one letter (a to z except e), with whole powers from 0 to 20 after it is multiplied out; brackets and fractions are allowed. It must have at least one power of the letter that is not 0. After clearing fractions and dividing out x^m, |a₀| and |aₙ| must each be at most 1,000,000. Anything else gets a message.

Output format. Fractions in lowest terms with a true minus sign. The rational zeros are listed smallest first, each once, including 0 when it is a zero; when there is none the page says "None: f has no rational zeros". The candidates are written ±p/q ordered by q, then by p, each pair once (OpenStax’s order: ±1, ±2, ±4, ±1/2). Only the first 100 pairs are written; a longer list ends with ", … (N in all)". The number of candidates counts + and − separately. Factors are listed smallest first. The polynomial used is the whole-number polynomial after steps 2 and 3. In the steps powers show as superscripts and minus signs are true minus signs.

Worked examples by hand

2x³ + x² − 4x + 1 (OpenStax Example 4). p: 1. q: 1, 2. Candidates ±1, ±1/2 (4 in all). f(1) = 2 + 1 − 4 + 1 = 0; f(−1) = 4, f(1/2) = −1/2, f(−1/2) = 3. The only rational zero is 1.

2x⁴ − 5x³ + x² − 4 (OpenStax Example 3). p: 1, 2, 4. q: 1, 2. Candidates ±1, ±2, ±4, ±1/2 (8). None gives 0 (f(1) = −6, f(−1) = 4, f(2) = −8, f(−2) = 72, …), so there is no rational zero.

−x³ + 3x² + 4x − 12. a₀ = −12, aₙ = −1. Candidates ±1, ±2, ±3, ±4, ±6, ±12 (12). It factors as −(x − 3)(x − 2)(x + 2), so the zeros are −2, 2, 3.

x⁴/2 − x²/2. Multiply by 2: x⁴ − x². Divide out x²: x = 0 is a zero, leaving x² − 1, with candidates ±1, both zeros. Rational zeros: −1, 0, 1.

Other questions people ask

What does the rational zero theorem say?

If a polynomial has whole-number coefficients, every rational zero, written p/q in lowest terms, has p a factor of the constant term and q a factor of the leading coefficient. So the list of ±p/q holds every rational zero there can be.

How do I list the possible rational zeros?

List the factors p of the constant term and the factors q of the leading coefficient, then form every ±p/q and drop repeats. For 2x^4 − 5x^3 + x^2 − 4: p is 1, 2 or 4; q is 1 or 2; the candidates are ±1, ±2, ±4, ±1/2.

Does every candidate have to be a zero?

No. The theorem only narrows the search. Test each candidate: put it into f(x), or divide by synthetic division, and keep those that give 0. For 2x^3 + x^2 − 4x + 1 the candidates are ±1 and ±1/2, and only 1 is a zero.

What if the polynomial has fractions?

Multiply by the least common multiple of the denominators first. The zeros do not change. x^3/2 − x/3 + 1 becomes 3x^3 − 2x + 6.

What if the constant term is 0?

Then x = 0 is a zero. Divide out the lowest power of x, and use the theorem on what is left. x^4 − x^2 = x^2(x^2 − 1), so the zeros are −1, 0 and 1.

Can a polynomial have no rational zeros?

Yes. Its zeros may be irrational or complex. x^2 − 2 has candidates ±1 and ±2, none of which give 0; its zeros are ±√2.