Skip to content
PercentPoint

Factoring Polynomials Calculator

Type a polynomial to factor it completely over the integers, with each step named: the greatest common factor, trinomials, special products, grouping, substitution and rational zeros. Every answer is multiplied back out and checked.

For planning only. Your school, syllabus or accountant has the final word. First published · Last reviewed by PercentPoint.

How to use the factoring calculator

  1. Type the polynomial. Use ^ for powers (x^3) or superscripts (x³). Multiplication can be implied, as in 3xy, and you can use parentheses, fractions and decimals: 3y(y + 7) − 4(y + 7) or 1/2x^2 − 2.
  2. Read the factored form in the results panel, with the greatest common factor in front and repeated factors written as powers, such as (3x + 2)².
  3. Follow the steps under the input. Each step names the method used, in the order a textbook would apply it, so you can copy the work rather than just the answer.

The preset factors 6x² + 7x − 3 into (2x + 3)(3x − 1) with the ac method. For one-variable polynomials, the results also list the rational zeros, the values of x that make each factor 0, which is the first step in solving an equation such as 6x² + 7x − 3 = 0. This page factors expressions with variables; to list the factors of a whole number such as 72, use the factor calculator.

The general strategy for factoring polynomials

OpenStax’s Intermediate Algebra 2e (section 6.4) sums up factoring as a short checklist, and the calculator works through it in the same order:

  1. Is there a greatest common factor? Factor it out first.
  2. How many terms are left? A binomial may be a difference of squares or a sum or difference of cubes. A trinomial may be x² + bx + c, ax² + bx + c or a perfect square. Four or more terms call for grouping.
  3. Is it factored completely? Check every factor again; a difference of squares often hides inside another factor.
  4. Check by multiplying the factors back together.

The book’s first example is 7x³ − 21x² − 70x. The GCF is 7x, leaving 7x(x² − 3x − 10). Two numbers that multiply to −10 and add to −3 are −5 and 2, so the answer is 7x(x − 5)(x + 2). The calculator lists the same factors, ordered by degree.

Start with the greatest common factor

The GCF of a polynomial is the largest number and highest power of each variable that divides every term. In 12x³y² + 75xy², the numbers share a factor of 3 and every term has at least one x and y², so the GCF is 3xy² and the polynomial is 3xy²(4x² + 25). The remaining 4x² + 25 is a sum of squares, which does not factor, so that is the final answer.

When the leading coefficient is negative, the textbook takes out a negative GCF so the polynomial inside starts with a positive term: −4a³ + 36a² − 8a = −4a(a² − 9a + 2). If the input has fractions or decimals, the calculator puts the fraction in the GCF so the factors keep whole-number coefficients: ½x² − 2 = ½(x² − 4) = ½(x + 2)(x − 2).

Factoring trinomials

For x² + bx + c, look for two numbers that multiply to c and add to b. In x² + 11x + 24, the pair is 3 and 8, so it factors as (x + 3)(x + 8). When the leading coefficient is not 1, the ac method from section 6.2 turns the problem into grouping:

Step6x² + 7x − 3
Multiply a × c6 × (−3) = −18
Find two numbers with product ac and sum b9 and −2
Split the middle term6x² + 9x − 2x − 3
Group and factor each pair3x(2x + 3) − 1(2x + 3)
Factor out the common binomial(2x + 3)(3x − 1)

If no such pair exists, the trinomial is prime over the integers. A quick test is the discriminant b² − 4ac: the trinomial factors with integer coefficients only when it is a perfect square. For 2x² + 3x − 1 it is 17, so that trinomial is prime. The same discriminant appears in the quadratic formula calculator, which finds the roots even when they are irrational.

Special products: squares and cubes

Section 6.3 gives four patterns worth recognizing on sight:

PatternFormulaExample
Perfect square trinomiala² + 2ab + b² = (a + b)²9x² + 12x + 4 = (3x + 2)²
Difference of squaresa² − b² = (a − b)(a + b)64y² − 1 = (8y − 1)(8y + 1)
Sum of cubesa³ + b³ = (a + b)(a² − ab + b²)x³ + 8 = (x + 2)(x² − 2x + 4)
Difference of cubesa³ − b³ = (a − b)(a² + ab + b²)8x³ − 27 = (2x − 3)(4x² + 6x + 9)

A sum of squares such as x² + 4 has no factorization over the integers once any GCF is removed. Patterns can stack: x⁴ − 16 is a difference of squares, (x² − 4)(x² + 4), and x² − 4 is another, so the complete answer is (x − 2)(x + 2)(x² + 4).

Grouping and substitution

With four terms, group them in pairs and take the GCF out of each pair. For x³ − 2x² − x + 2, the pairs give x²(x − 2) − 1(x − 2). The binomial x − 2 is now common, so the polynomial is (x − 2)(x² − 1), and the difference of squares finishes it: (x − 2)(x − 1)(x + 1). Grouping also works with several variables, as in the textbook’s 4x² + 8bx − 4ax − 8ab = 4(x + 2b)(x − a).

A trinomial whose first power is the square of the middle power can be treated as a quadratic. In x⁴ − 4x² − 5, let u = x²: u² − 4u − 5 = (u − 5)(u + 1), so x⁴ − 4x² − 5 = (x² − 5)(x² + 1).

Cubics and beyond: rational zeros

Some polynomials fit none of the patterns. For those, the calculator uses the Rational Zero Theorem from OpenStax College Algebra 2e (section 5.5): any rational zero p/q has p dividing the constant term and q dividing the leading coefficient. For 2x³ + x² − 4x + 1, the candidates are ±1 and ±½, and x = 1 works, so (x − 1) is a factor. Dividing it out, with the steps the polynomial division calculator shows, leaves 2x² + 3x − 1, which is prime.

A polynomial can have no rational zeros and still factor. x⁴ + 4 is a sum of squares, yet it equals (x² + 2x + 2)(x² − 2x + 2). To catch cases like this, the calculator also tests every integer factor of degree 2 and higher whose values divide the polynomial’s values at a few points (Kronecker’s method). When that search finishes, “prime” means no integer factorization exists. Factors such as x² − 2 can still split using irrational numbers, (x − √2)(x + √2), but that is outside factoring over the integers.

Polynomials with more than one variable

When every term has the same total degree, as in 4a² − 12ab + 9b² or 24x³ + 81y³, the calculator factors completely: (2a − 3b)² and 3(2x + 3y)(4x² − 6xy + 9y²). For other several-variable polynomials it takes out the GCF and tries grouping, then says plainly if a factor may factor further, as with 9x² − 12xy + 4y² − 49, which needs a perfect-square regrouping by hand: (3x − 2y)² − 49 = (3x − 2y − 7)(3x − 2y + 7).

Sources & assumptions

How this calculator gets its numbers. Full method: our methodology.

  • Factoring is over the integers: every factor has whole-number coefficients. Fractions and decimals in the input are cleared into the GCF first.
  • The GCF is taken out first, negative when the leading coefficient is negative; then the binomial, trinomial, substitution and grouping patterns are tried.
  • One-variable factors are finished with the Rational Zero Theorem and an exhaustive search for higher-degree integer factors, so a factor reported as prime has no integer factorization. Degree is limited to 12.
  • Polynomials in two variables are factored completely when every term has the same total degree; other several-variable inputs get the GCF and grouping only, and the result says so.
  • The answer is multiplied back out and checked against the input exactly.

Sources

  1. OpenStax (Rice University), Intermediate Algebra 2e, 6.1 Greatest Common Factor and Factor by Grouping. Factoring out the GCF of a polynomial, a negative GCF when the leading coefficient is negative, and factoring four terms by grouping.
  2. OpenStax (Rice University), Intermediate Algebra 2e, 6.2 Factor Trinomials. x² + bx + c (x² + 11x + 24 = (x + 3)(x + 8)), ax² + bx + c by trial and error and by the “ac” method, and factoring by substitution (x⁴ − 4x² − 5).
  3. OpenStax (Rice University), Intermediate Algebra 2e, 6.3 Factor Special Products. Perfect square trinomials, differences of squares, sums and differences of cubes, and the rule that a sum of squares a² + b² is prime after removing any GCF.
  4. OpenStax (Rice University), Intermediate Algebra 2e, 6.4 General Strategy for Factoring Polynomials. The order of checks (GCF, then binomial, trinomial or four-term patterns, then check that every factor is prime), with worked examples such as 24y² − 150 = 6(2y − 5)(2y + 5).
  5. OpenStax (Rice University), College Algebra 2e, 5.5 Zeros of Polynomial Functions. The Remainder Theorem, the Factor Theorem and the Rational Zero Theorem (possible zeros p/q, p a factor of the constant term and q of the leading coefficient; 2x³ + x² − 4x + 1 has the zero 1).

Last reviewed . Teachers may ask for factors in a different but equal order or sign arrangement, such as (x − 5)(x + 2) or −(5 − x)(x + 2).

Frequently asked questions

How do I factor a polynomial completely?

Take out the GCF, then use the pattern that fits the number of terms: special products for binomials, the ac method for trinomials, grouping for four terms. Check each factor again and multiply back to verify.

How do I factor a trinomial when a is not 1?

Use the ac method. For 6x² + 7x − 3, ac = −18; 9 and −2 multiply to −18 and add to 7. Split 7x into 9x − 2x and group to get (2x + 3)(3x − 1).

What does prime over the integers mean?

It means the polynomial has no factorization into polynomials with whole-number coefficients, other than pulling out a constant. x² + 4 and 2x² + 3x − 1 are prime in this sense.

Can a sum of squares be factored?

Not a degree-2 sum of squares such as x² + 4 or 4x² + 25, after any GCF is removed. Higher powers can be different: x⁴ + 4 factors as (x² + 2x + 2)(x² − 2x + 2).

How do I factor a cubic polynomial?

Look for a GCF, a sum or difference of cubes, or grouping. If none fits, test possible rational zeros p/q; each zero gives a factor, and dividing it out leaves a quadratic to factor.

Is (x − 5)(x + 2) the same as (x + 2)(x − 5)?

Yes. Multiplication is commutative, so factors can be written in any order. Signs can also be moved in pairs, so −(5 − x)(x + 2) is the same polynomial.