{
  "id": "rational-zero-theorem",
  "version": "cd3ebf4ca501",
  "status": "published",
  "name": "Rational Zero Theorem Calculator",
  "question": "What is the rational zero theorem?",
  "summary": "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.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/rational-zero-theorem-calculator",
  "markdown": "https://www.acalculator.org/math/rational-zero-theorem-calculator.md",
  "kind": "function",
  "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.",
  "assumptions": [
    "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."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "f": {
        "title": "Polynomial f(x)",
        "description": "A polynomial in one letter, such as 2x^3 + x^2 − 4x + 1.",
        "type": "string",
        "maxLength": 160
      }
    }
  },
  "outputs": {
    "zeros": {
      "label": "Rational zeros",
      "description": "The candidates (and 0) that make f(x) = 0, smallest first.",
      "format": "text"
    },
    "candidates": {
      "label": "Possible rational zeros",
      "description": "Every ±p/q with p a factor of the constant term and q a factor of the leading coefficient.",
      "format": "text"
    },
    "count": {
      "label": "Number of candidates",
      "description": "How many possible rational zeros there are.",
      "format": "integer"
    },
    "p": {
      "label": "Factors p of the constant term",
      "description": "The positive factors of the constant term.",
      "format": "text"
    },
    "q": {
      "label": "Factors q of the leading coefficient",
      "description": "The positive factors of the leading coefficient.",
      "format": "text"
    },
    "polynomial": {
      "label": "Polynomial used",
      "description": "f(x) multiplied out, with fractions cleared and any factor of x divided out.",
      "format": "math"
    },
    "steps": {
      "label": "Steps",
      "description": "The factors, the candidates, and the tests.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "f": "2x^3 + x^2 - 4x + 1"
    },
    "outputs": {
      "zeros": "1",
      "candidates": "±1, ±1/2",
      "count": 4,
      "p": "1",
      "q": "1, 2",
      "polynomial": "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"
    },
    "text": "Rational zeros of f: 1."
  },
  "examples": [
    {
      "given": {
        "f": "2x^3 + x^2 - 4x + 1"
      },
      "expect": {
        "zeros": "1",
        "candidates": "±1, ±1/2",
        "count": 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"
    },
    {
      "given": {
        "f": "2x^4 - 5x^3 + x^2 - 4"
      },
      "expect": {
        "candidates": "±1, ±2, ±4, ±1/2",
        "count": 8,
        "p": "1, 2, 4",
        "q": "1, 2",
        "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; zeros: Python 3 test of the 8 candidates (none gives 0)"
    },
    {
      "given": {
        "f": "-x^3 + 3x^2 + 4x - 12"
      },
      "expect": {
        "zeros": "−2, 2, 3",
        "candidates": "±1, ±2, ±3, ±4, ±6, ±12",
        "count": 12
      },
      "source": "hand calculation in content.mdx: −x³ + 3x² + 4x − 12 = −(x − 3)(x − 2)(x + 2)"
    },
    {
      "given": {
        "f": "x^4/2 - x^2/2"
      },
      "expect": {
        "zeros": "−1, 0, 1",
        "polynomial": "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"
      },
      "source": "hand calculation in content.mdx: × 2 gives x⁴ − x² = x²(x − 1)(x + 1)"
    }
  ],
  "sources": [
    "OpenStax, Algebra and Trigonometry 2e, §5.5 Zeros of Polynomial Functions (the Rational Zero Theorem: for f(x) with integer coefficients, every rational zero has the form p/q with p a factor of a₀ and q a factor of aₙ; Example 3: 2x⁴ − 5x³ + x² − 4 has possible zeros ±1, ±2, ±4, ±1/2; Example 4: 2x³ + x² − 4x + 1 has possible zeros ±1 and ±1/2, and 1 is the only rational zero). https://openstax.org/books/algebra-and-trigonometry-2e/pages/5-5-zeros-of-polynomial-functions (retrieved 2026-10-05)"
  ],
  "related": [
    "polynomial",
    "factoring",
    "synthetic-division",
    "polynomial-division",
    "root"
  ],
  "changelog": []
}
