Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Factoring Polynomials






From Product to Pieces

Multiplying (x+2)(x+3)(x + 2)(x + 3) to get x2+5x+6x^2 + 5x + 6 is a mechanical process — distribute, combine, done. But going the other direction — starting with x2+5x+6x^2 + 5x + 6 and recovering the factors that built it — requires pattern recognition, strategy, and a toolkit of techniques that grows with the complexity of the polynomial.

That reverse process is factoring, and it underpins much of algebra. Solving polynomial equations, simplifying rational expressions, and analyzing how polynomials behave all depend on the ability to decompose a polynomial into simpler multiplicative pieces. The sections that follow develop the methods for doing so, from extracting common factors through recognizing special patterns to handling polynomials of any degree.

Key Terms

Core Concepts

Factoring— writing a polynomial as a product of lower-degree factors
Greatest Common Factor (GCF)— the largest expression dividing every term
Irreducible Polynomial— cannot be factored further over a given number system

Named Patterns

Difference of Squares— a2−b2=(a+b)(a−b)a^2 - b^2 = (a+b)(a-b)
Perfect Square Trinomial— a2±2ab+b2=(a±b)2a^2 \pm 2ab + b^2 = (a \pm b)^2
Sum and Difference of Cubes— a3±b3a^3 \pm b^3

Supporting Concepts

Root (of a Polynomial)— each factor (x−r)(x-r) reveals a root at x=rx = r
Trinomial— three-term polynomials are the most common factoring targets
Factor Theorem— P(c)=0P(c) = 0 confirms (x−c)(x-c) is a factor

Formulas Used on This Page

Difference of Squares— a2−b2=(a+b)(a−b)a^2 - b^2 = (a + b)(a - b)
Trinomial Factoring Pattern— x2+(a+b)x+ab=(x+a)(x+b)x^2 + (a + b)x + ab = (x + a)(x + b)
Sum of Cubes— a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2)
Difference of Cubes— a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a - b)(a^2 + ab + b^2)
General Difference of Even Powers— x2n−a2n=(xn−an)(xn+an)x^{2n} - a^{2n} = (x^n - a^n)(x^n + a^n)
General Difference of Powers (odd n)— xn−an=(x−a)(xn−1+axn−2+⋯+an−1)x^n - a^n = (x - a)(x^{n-1} + ax^{n-2} + \cdots + a^{n-1})
General Sum of Powers (odd n)— xn+an=(x+a)(xn−1−axn−2+⋯+an−1)x^n + a^n = (x + a)(x^{n-1} - ax^{n-2} + \cdots + a^{n-1})

See All Algebra Definitions →

See All Algebra Formulas →


What is Factoring?

The same polynomial can be written as a sum of terms or as a product of factors.
x2+5x+6x^2 + 5x + 6 and (x+2)(x+3)(x + 2)(x + 3) look nothing alike. Do they describe the same thing?
Evaluated at the same inputs, the two forms agree every time.
xx² + 5x + 6(x + 2)(x + 3)
−39 − 15 + 6 = 0(−1)(0) = 0
−24 − 10 + 6 = 0(0)(1) = 0
06(2)(3) = 6
112(3)(4) = 12
220(4)(5) = 20
The values match row by row. Only the product form shows at a glance why x=−3x = -3 and x=−2x = -2 give 00: one of its factors is 00 there.
A product is zero exactly when one of its factors is zero, so the factored form puts the roots on display.
Consider x2+5x+6x^2 + 5x + 6. Written this way, the polynomial is a sum of three terms. Factored as (x+2)(x+3)(x + 2)(x + 3), the same expression becomes a product of two linear factors, making it immediately clear that the polynomial equals zero when x=−2x = -2 or x=−3x = -3. This connection between factors and roots is one of the main reasons factoring matters.
The definition
To factor a polynomial is to write it as a product of polynomials of lower degree, equal to it for every input.
To factor a polynomial means to write it as a product of two or more polynomials of lower degree. The original polynomial and its factored form are equivalent expressions — they produce the same value for every input — but the factored form reveals structure that the expanded form conceals.
So x2+5x+6=(x+2)(x+3)x^2 + 5x + 6 = (x + 2)(x + 3) is a factorization: two linear factors whose product equals the original at every xx.
Factoring is multiplication run backwards.
(x + 2)(x + 3), all four cells deliveredx3xx²3x22x6LIKE-TERM BUCKETSx² terms 1sum: x²x terms 3 + 2sum: 5xconstants 6sum: 6P(x) · Q(x) = x² + 5x + 6
(x + 2)(x + 3): the product that factoring undoes

Multiplying the section's factors cell by cell gives x², 3x, 2x and 6; the two x-terms collect into 5x, giving x² + 5x + 6. Factoring runs this grid backwards: from the trinomial, find the two numbers, 2 and 3, that fill the corner cells and add to the middle coefficient. Fill other grids on the polynomial multiplication visualizer.

Every factoring technique on this page reverses one way of filling such a grid.
When a polynomial counts as fully factored depends on the numbers allowed in the factors.
A polynomial is fully factored when none of its factors can be broken down further. The expression 2x(x2−9)2x(x^2 - 9) is not fully factored because x2−9x^2 - 9 splits into (x+3)(x−3)(x + 3)(x - 3). The complete factorization is 2x(x+3)(x−3)2x(x + 3)(x - 3).
What counts as "fully factored" depends on the number system in play. Over the integers, x2+1x^2 + 1 cannot be factored — no pair of integer-coefficient linear factors multiplies to give x2+1x^2 + 1. Over the reals, it remains irreducible because it has no real roots. Over the complex numbers, however, x2+1=(x+i)(x−i)x^2 + 1 = (x + i)(x - i), and every polynomial of degree nn factors into exactly nn linear factors.
Polynomials that cannot be split further are treated in irreducible polynomials.
The rest of the page covers the greatest common factor, grouping, trinomials, the special patterns, higher-degree polynomials, a factoring strategy, irreducible polynomials, common mistakes and a decision tree.

Greatest Common Factor (GCF)

The first step in any factoring problem is to check whether all terms share a common factor. The greatest common factor is the largest expression — including both numerical and variable parts — that divides evenly into every term of the polynomial.

For 6x3+9x2−3x6x^3 + 9x^2 - 3x, each term is divisible by 3x3x. Factoring it out gives 3x(2x2+3x−1)3x(2x^2 + 3x - 1). The original three-term polynomial now appears as a product of a monomial and a simpler trinomial.

RULE
When variables carry different exponents, the GCF takes the lowest power present across all terms.

Example
In 4x2y+8xy24x^2y + 8xy^2, the numerical GCF is 44, the lowest power of xx is x1x^1, and the lowest power of yy is y1y^1, so the GCF is 4xy4xy. Factoring yields 4xy(x+2y)4xy(x + 2y).

Pitfall: Losing the term that equals the GCF
Writing 6x3+9x2−3x6x^3 + 9x^2 - 3x as 3x(2x2+3x)3x(2x^2 + 3x) drops the last term: that product is only 6x3+9x26x^3 + 9x^2. The term −3x-3x leaves −1-1 behind, so the factorization is 3x(2x2+3x−1)3x(2x^2 + 3x - 1).

Extracting the GCF should become automatic — it simplifies the remaining expression and often makes subsequent factoring steps far more manageable. A polynomial like 2x3+8x2+8x2x^3 + 8x^2 + 8x looks like a difficult cubic until the GCF of 2x2x is removed, leaving 2x(x2+4x+4)2x(x^2 + 4x + 4), which is a recognizable perfect square trinomial: 2x(x+2)22x(x + 2)^2.
The closing example of this section, one move at a time. The GCF comes out first.
DownloadPNG2×PDF
Greatest common factor

Taking out the GCF first

A cubic that looks difficult becomes a recognizable pattern once the GCF of 2x2x is removed.
01
CubicBefore
2x3+8x2+8x2x^3 + 8x^2 + 8x
↓Remove the GCF— 2x2x divides every term
02
GCF out
2x(x2+4x+4)2x(x^2 + 4x + 4)
↓Perfect square trinomial— x2+4x+4=(x+2)2x^2 + 4x + 4 = (x + 2)^2
03
Fully factoredAfter
2x(x+2)22x(x + 2)^2
Factoring 2x³ + 8x² + 8x·/algebra/polynomials/factoringLearn Math Class
After the GCF is removed, the trinomial left behind is a perfect square trinomial, and the cubic is fully factored in one more move.

Factoring by Grouping

When a polynomial has four or more terms and no single GCF spans all of them, grouping offers a path forward. The idea is to split the polynomial into pairs of terms, factor each pair separately, and then look for a common binomial factor across the groups.

Example
Take x3+2x2+3x+6x^3 + 2x^2 + 3x + 6. Grouping the first two terms and the last two gives (x3+2x2)+(3x+6)(x^3 + 2x^2) + (3x + 6). Factoring each group produces x2(x+2)+3(x+2)x^2(x + 2) + 3(x + 2). The binomial (x+2)(x + 2) now appears in both pieces, so it factors out: (x2+3)(x+2)(x^2 + 3)(x + 2).

The method depends on the right grouping — and the original order of terms does not always produce one that works. Rearranging may be necessary. For ax+by+ay+bxax + by + ay + bx, the natural left-to-right pairing yields (ax+by)+(ay+bx)(ax + by) + (ay + bx), which leads nowhere useful. Rearranging to ax+bx+ay+byax + bx + ay + by and grouping as (ax+bx)+(ay+by)(ax + bx) + (ay + by) gives x(a+b)+y(a+b)=(x+y)(a+b)x(a + b) + y(a + b) = (x + y)(a + b).

Grouping also plays a role inside other techniques. The AC method for factoring trinomials with a leading coefficient other than 11 rewrites the middle term as two terms, creating a four-term polynomial that is then factored by grouping.
The example of this section, one step at a time. Press Next to carry out each step.
DownloadPNG2×PDF
x3+2x2+3x+6x^3 + 2x^2 + 3x + 6Step 1 of 3
Step
x3+2x2+3x+6x^3 + 2x^2 + 3x + 6
1
Split the polynomial into pairs of terms
(x3+2x2)+(3x+6)(x^3 + 2x^2) + (3x + 6)
2
Factor each pair separately
x2(x+2)+3(x+2)x^2(x + 2) + 3(x + 2)
3
Factor out the common binomial
(x2+3)(x+2)(x^2 + 3)(x + 2)
Grouping on one polynomialLearn Math Class

Factoring Trinomials — Simple Case

A trinomial of the form x2+bx+cx^2 + bx + c has a leading coefficient of 11, which makes the factoring process straightforward. The goal is to find two numbers mm and nn such that m⋅n=cm \cdot n = c and m+n=bm + n = b. If such a pair exists, the trinomial factors as (x+m)(x+n)(x + m)(x + n).

Formally:

Trinomial Factoring Pattern
x2+(a+b)x+ab=(x+a)(x+b)x^2 + (a + b)x + ab = (x + a)(x + b)
Learn more about this formula: Trinomial Factoring Pattern →


Example
For x2+7x+12x^2 + 7x + 12, the task is to find two numbers that multiply to 1212 and add to 77. The pair 33 and 44 satisfies both conditions: 3⋅4=123 \cdot 4 = 12 and 3+4=73 + 4 = 7. So x2+7x+12=(x+3)(x+4)x^2 + 7x + 12 = (x + 3)(x + 4).

Pitfall: Choosing the wrong signs
Writing x2−5x+6x^2 - 5x + 6 as (x+2)(x−3)(x + 2)(x - 3) gets the sizes 22 and 33 right but not the signs: it expands to x2−x−6x^2 - x - 6. With c>0c > 0 and b<0b < 0 both numbers are negative: (x−2)(x−3)(x - 2)(x - 3).

The signs of bb and cc guide the search. When cc is positive and bb is positive, both numbers are positive. When cc is positive and bb is negative, both numbers are negative — for instance, x2−9x+20=(x−4)(x−5)x^2 - 9x + 20 = (x - 4)(x - 5) since (−4)(−5)=20(-4)(-5) = 20 and (−4)+(−5)=−9(-4) + (-5) = -9. When cc is negative, the two numbers have opposite signs: x2+2x−15=(x+5)(x−3)x^2 + 2x - 15 = (x + 5)(x - 3) because 5⋅(−3)=−155 \cdot (-3) = -15 and 5+(−3)=25 + (-3) = 2.

Not every trinomial of this form factors over the integers. The polynomial x2+x+1x^2 + x + 1 requires two integers that multiply to 11 and add to 11 — no such pair exists.

THEOREM
The discriminant b2−4cb^2 - 4c determines factorability: with integer bb and cc, the trinomial factors over the integers exactly when b2−4cb^2 - 4c is a perfect square.
DownloadPNG2×PDF
Layout
Sign of cSign of bSigns of m and nExample
c > 0b > 0both positivex² + 7x + 12 = (x + 3)(x + 4)
c > 0b < 0both negativex² − 9x + 20 = (x − 4)(x − 5)
c < 0b > 0opposite signs; the positive one has the larger absolute valuex² + 2x − 15 = (x + 5)(x − 3)
c < 0b < 0opposite signs; the negative one has the larger absolute valuex² − 2x − 15 = (x − 5)(x + 3)
Factoring Trinomials — Simple CaseLearn Math Class

Factoring Trinomials — General Case

When the leading coefficient is not 11, the trinomial takes the form ax2+bx+cax^2 + bx + c and requires a more systematic approach. The AC method handles this by converting the problem into a grouping problem.

Multiply aa and cc to get the product acac. Then find two numbers mm and nn such that m⋅n=acm \cdot n = ac and m+n=bm + n = b. Use these numbers to split the middle term into two terms, creating a four-term polynomial that can be factored by grouping.

Example
For 6x2+11x+46x^2 + 11x + 4, compute ac=6⋅4=24ac = 6 \cdot 4 = 24. The pair 33 and 88 satisfies 3⋅8=243 \cdot 8 = 24 and 3+8=113 + 8 = 11. Rewrite the middle term: 6x2+3x+8x+46x^2 + 3x + 8x + 4. Group and factor: 3x(2x+1)+4(2x+1)=(3x+4)(2x+1)3x(2x + 1) + 4(2x + 1) = (3x + 4)(2x + 1).

Pitfall: Using the AC pair as the factors
Writing 6x2+11x+46x^2 + 11x + 4 as (x+3)(x+8)(x + 3)(x + 8) treats the pair for ac=24ac = 24 as if aa were 11; that product is x2+11x+24x^2 + 11x + 24. The pair only splits the middle term, and grouping gives (3x+4)(2x+1)(3x + 4)(2x + 1).

The order in which the split terms are written does not affect the final result. Writing 6x2+8x+3x+46x^2 + 8x + 3x + 4 instead leads to 2x(3x+4)+1(3x+4)=(2x+1)(3x+4)2x(3x + 4) + 1(3x + 4) = (2x + 1)(3x + 4) — the same factors in a different order.

As with the simple case, the discriminant b2−4acb^2 - 4ac determines whether the trinomial factors over the integers. When b2−4acb^2 - 4ac is negative, the polynomial has no real roots and is irreducible over the reals.
The example of this section, one step at a time. Press Next to carry out each step.
DownloadPNG2×PDF
6x2+11x+46x^2 + 11x + 4Step 1 of 4
Step
6x2+11x+46x^2 + 11x + 4
1
Multiply aa and cc
ac=6⋅4=24ac = 6 \cdot 4 = 24
2
Find mm and nn with m⋅n=acm \cdot n = ac and m+n=bm + n = b
3⋅8=243 \cdot 8 = 24 and 3+8=113 + 8 = 11
3
Split the middle term
6x2+3x+8x+46x^2 + 3x + 8x + 4
4
Factor by grouping
3x(2x+1)+4(2x+1)=(3x+4)(2x+1)3x(2x + 1) + 4(2x + 1) = (3x + 4)(2x + 1)
The AC method on one trinomialLearn Math Class

Difference of Squares

One of the most frequently used factoring patterns is the difference of squares:

Difference of Squares
a2−b2=(a+b)(a−b)a^2 - b^2 = (a + b)(a - b)
Learn more about this formula: Difference of Squares →


It applies whenever a polynomial consists of two perfect square terms separated by subtraction.

Recognizing perfect squares is the key skill. The term 9x29x^2 is (3x)2(3x)^2, the term 1616 is 424^2, and the term x4x^4 is (x2)2(x^2)^2. So 9x2−16=(3x+4)(3x−4)9x^2 - 16 = (3x + 4)(3x - 4), and x4−1=(x2+1)(x2−1)=(x2+1)(x+1)(x−1)x^4 - 1 = (x^2 + 1)(x^2 - 1) = (x^2 + 1)(x + 1)(x - 1) after factoring the second factor further.

The pattern extends to less obvious cases. The expression x2−5x^2 - 5 is a difference of squares if reals are permitted: x2−(5)2=(x+5)(x−5)x^2 - (\sqrt{5})^2 = (x + \sqrt{5})(x - \sqrt{5}). Over the integers alone, x2−5x^2 - 5 does not factor.

THEOREM
The sum of squares a2+b2a^2 + b^2 has no factorization over the real numbers.

No real values of mm and nn satisfy (a+m)(a+n)=a2+b2(a + m)(a + n) = a^2 + b^2. Over the complex numbers, however, the factorization exists: a2+b2=(a+bi)(a−bi)a^2 + b^2 = (a + bi)(a - bi), using the fact that i2=−1i^2 = -1.
a · (a − b)(a − b) · ba + ba − bab
a² − b² as a rearranged area

Cutting a b-by-b square out of an a-by-a square leaves an L-shaped region of area a² − b². Slicing the L and moving one strip turns it into a single rectangle with sides a + b and a − b, so the area is also (a + b)(a − b). That is the difference of squares, read as geometry. Step through the rearrangement on the difference of squares explorer.

The sum a² + b² has no such rearrangement, and over the reals it does not factor.

Perfect Square Trinomials

Two closely related patterns arise when a binomial is squared:

Perfect Square Trinomials
a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a + b)^2

Perfect Square Trinomials
a2−2ab+b2=(a−b)2a^2 - 2ab + b^2 = (a - b)^2

The test for a perfect square trinomial has three parts: the first term must be a perfect square, the last term must be a perfect square, and the middle term must equal twice the product of their square roots. If all three conditions hold, the trinomial is the square of a binomial.

Example
For x2+10x+25x^2 + 10x + 25, the first term is x2x^2, the last is 525^2, and the middle term 10x=2⋅x⋅510x = 2 \cdot x \cdot 5. All conditions are met, so x2+10x+25=(x+5)2x^2 + 10x + 25 = (x + 5)^2.

Example
For 4x2−12x+94x^2 - 12x + 9, the first term is (2x)2(2x)^2, the last is 323^2, and the middle term 12x=2⋅2x⋅312x = 2 \cdot 2x \cdot 3. The subtraction sign carries through: 4x2−12x+9=(2x−3)24x^2 - 12x + 9 = (2x - 3)^2.

A common error is assuming any trinomial with perfect square first and last terms must be a perfect square trinomial. The expression x2+7x+9x^2 + 7x + 9 has x2x^2 and 323^2 at the ends, but the middle term 7x7x does not equal 2⋅x⋅3=6x2 \cdot x \cdot 3 = 6x. This trinomial is not a perfect square.
x²3x3x5corner needs3 × 3 = 9x3x3
x² + 6x + 9: the corner that completes the square

The x² block and two 3x strips leave a square-shaped hole at the corner, and the constant 9 = 3 × 3 fills it exactly: the trinomial is a perfect square, (x + 3)², because its constant is the square of half the middle coefficient. A different constant leaves a gap or an overflow instead. Test any trinomial for the corner fit on the completing the square visualizer.

The test in the text is the algebraic form of checking whether the corner fits.

Sum and Difference of Cubes

Two factoring identities handle cubic terms:

Sum of Cubes
a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2)
Learn more about this formula: Sum of Cubes →

Difference of Cubes
a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a - b)(a^2 + ab + b^2)
Learn more about this formula: Difference of Cubes →


Each factors a two-term cubic into a linear factor and a quadratic factor. The linear factor shares the same sign as the original expression. The quadratic factor follows the pattern: square the first term, take the opposite sign for the product term, then square the last term. The mnemonic SOAP — Same, Opposite, Always Positive — captures the sign sequence.

Pitfall: Keeping the sign in the middle term
Writing x3+27x^3 + 27 as (x+3)(x2+3x+9)(x + 3)(x^2 + 3x + 9) copies the plus sign into the quadratic factor; that product is x3+6x2+18x+27x^3 + 6x^2 + 18x + 27. The middle sign is the opposite one: (x+3)(x2−3x+9)(x + 3)(x^2 - 3x + 9).

Example
For x3+8x^3 + 8, recognize 8=238 = 2^3. The sum of cubes formula gives x3+23=(x+2)(x2−2x+4)x^3 + 2^3 = (x + 2)(x^2 - 2x + 4). The linear factor (x+2)(x + 2) takes the same sign as the original sum. The quadratic factor has a negative middle term (opposite) and a positive constant (always positive).

Example
For 27x3−127x^3 - 1, recognize 27x3=(3x)327x^3 = (3x)^3 and 1=131 = 1^3. The difference of cubes formula gives (3x−1)(9x2+3x+1)(3x - 1)(9x^2 + 3x + 1). The linear factor takes the minus sign (same as the original difference), the middle term is positive (opposite), and the constant remains positive.

THEOREM
The quadratic factors a2−ab+b2a^2 - ab + b^2 and a2+ab+b2a^2 + ab + b^2 that arise from these formulas are irreducible over the reals.

Their discriminants are −3b2-3b^2 and −3b2-3b^2 respectively — both negative — so neither factors further into real linear terms.

The three named patterns introduced across this and the preceding sections — difference of squares, perfect square trinomials, and sum and difference of cubes — together form the most heavily used factoring identities. The reference card below collects them in one place along with the recognition cue for each.
DownloadPNG2×PDF
Layout
PatternOriginal formFactored formHow to spot it
Difference of squaresa² − b²(a + b)(a − b)two terms, both perfect squares, joined by a minus sign
Sum of squaresa² + b²irreducible over ℝ; (a + bi)(a − bi) over ℂtwo terms, both perfect squares, joined by a plus sign
Perfect square trinomial (+)a² + 2ab + b²(a + b)²first & last terms are perfect squares; middle = +2 · √first · √last
Perfect square trinomial (−)a² − 2ab + b²(a − b)²same as above with middle = −2 · √first · √last
Sum of cubesa³ + b³(a + b)(a² − ab + b²)two terms, both perfect cubes, joined by a plus (SOAP signs)
Difference of cubesa³ − b³(a − b)(a² + ab + b²)two terms, both perfect cubes, joined by a minus (SOAP signs)
Sum and Difference of CubesLearn Math Class

Factoring Higher-Degree Polynomials

Polynomials of degree four and above often yield to the same techniques used on quadratics and cubics, provided the right structure is recognized.

A common pattern is the quadratic in disguise.

Example
The polynomial x4+5x2+6x^4 + 5x^2 + 6 contains only even powers of xx, which means substituting u=x2u = x^2 transforms it into u2+5u+6u^2 + 5u + 6. This factors as (u+2)(u+3)(u + 2)(u + 3), and substituting back gives (x2+2)(x2+3)(x^2 + 2)(x^2 + 3). Neither quadratic factor has real roots, so the factorization is complete over the reals.

Repeated application of earlier techniques handles layered structures. The polynomial x4−16x^4 - 16 is a difference of squares: (x2+4)(x2−4)(x^2 + 4)(x^2 - 4). The second factor is itself a difference of squares: (x2+4)(x+2)(x−2)(x^2 + 4)(x + 2)(x - 2). The first factor x2+4x^2 + 4 is irreducible over the reals, so the process stops here.

These specific patterns generalize to arbitrary degrees:

General Difference of Even Powers
x2n−a2n=(xn−an)(xn+an)x^{2n} - a^{2n} = (x^n - a^n)(x^n + a^n)
Learn more about this formula: General Difference of Even Powers →

General Difference of Powers (odd n)
xn−an=(x−a)(xn−1+axn−2+⋯+an−1)x^n - a^n = (x - a)(x^{n-1} + ax^{n-2} + \cdots + a^{n-1})
Learn more about this formula: General Difference of Powers (odd n) →

General Sum of Powers (odd n)
xn+an=(x+a)(xn−1−axn−2+⋯+an−1)x^n + a^n = (x + a)(x^{n-1} - ax^{n-2} + \cdots + a^{n-1})
Learn more about this formula: General Sum of Powers (odd n) →


Fact: Nothing but 00 and ±1\pm 1 until 105105
In the irreducible pieces of xn−1x^n - 1, every coefficient is 00, 11 or −1-1 for all nn up to 104104. At n=105=3⋅5⋅7n = 105 = 3 \cdot 5 \cdot 7, the first nn with three different odd prime factors, a piece of degree 4848 has the coefficient −2-2.

With a=1a = 1 these formulas take apart xn−1x^n - 1. For n=6n = 6, the even-power formula gives x6−1=(x3−1)(x3+1)x^6 - 1 = (x^3 - 1)(x^3 + 1), and the odd-power formulas split each factor again: x6−1=(x−1)(x2+x+1)(x+1)(x2−x+1)x^6 - 1 = (x - 1)(x^2 + x + 1)(x + 1)(x^2 - x + 1). None of the four pieces factors further over the integers. Fully factored over the integers, every xn−1x^n - 1 breaks into such pieces, one for each divisor of nn: here 11, 22, 33 and 66.

Known roots provide another entry point. If rr is a root of a polynomial P(x)P(x), then (x−r)(x - r) is a factor, and polynomial division produces the remaining quotient. For instance, if direct substitution shows that P(2)=0P(2) = 0, then (x−2)(x - 2) divides P(x)P(x) evenly, and the quotient can be factored further using any applicable technique.

THEOREMFundamental Theorem of Algebra
The Fundamental Theorem of Algebra guarantees that every polynomial of degree nn has exactly nn roots over the complex numbers, counted with multiplicity.

This means complete factorization into linear factors is always possible in that setting.

A higher-degree polynomial is factored by spotting a structure that turns it into a case already known.

Factoring Strategy

With multiple techniques available, a systematic approach prevents wasted effort and missed factors.

The first move is always to extract the greatest common factor. Even when a GCF seems small — a single factor of 22 or a lone xx — removing it simplifies everything that follows. Skipping this step is the most common source of incomplete factorizations.

Next, count the terms. A two-term polynomial calls for checking special patterns: difference of squares, sum or difference of cubes. A three-term polynomial is a candidate for trinomial factoring — simple case if the leading coefficient is 11, the AC method otherwise. A polynomial with four or more terms suggests grouping.

After each factoring step, examine every factor to determine whether it can be broken down further. The expression x4−81x^4 - 81 factors as (x2+9)(x2−9)(x^2 + 9)(x^2 - 9), but stopping here misses the difference of squares hiding in the second factor: (x2+9)(x+3)(x−3)(x^2 + 9)(x + 3)(x - 3).

The final check is verification. Multiplying the factors back together must reproduce the original polynomial. This catches sign errors, arithmetic mistakes, and overlooked terms. If the product does not match, at least one factoring step contains an error.

Not every polynomial factors neatly over the integers. When no technique produces integer-coefficient factors, the polynomial may be irreducible over the integers — or it may factor over the reals or complex numbers using roots found through the quadratic formula or numerical methods.
The same strategy as a map. The GCF comes out first, and from there the number of terms decides the route. Switch to Walk it to answer one question at a time for a polynomial of your own.
DownloadPNG2×PDF
every route at once
factoring strategy

Which factoring technique?

Count the terms after taking out the GCF; the count points to the technique.
Always firstTake out the greatest common factor, even a lone 22 or xx.
2a² − b²a³ ± b³neither3yesno4 or more
Difference of squares
a2−b2=(a−b)(a+b)a^2 - b^2 = (a - b)(a + b)→ Difference of squares
Sum or difference of cubes
a3±b3=(a±b)(a2∓ab+b2)a^3 \pm b^3 = (a \pm b)(a^2 \mp ab + b^2)→ Cubes
Maybe irreducible
no integer factors; try roots over the reals→ Irreducible polynomials
Which pattern?
Simple trinomial
find two numbers that multiply to cc and add to bb→ Simple case
AC method
split the middle term using acac, then group→ General case
Leading coefficient 1?
Grouping
pair the terms and factor each pair→ Grouping
StartHow many terms?after the GCF is out
ThenCheck every factor: x4−81=(x2+9)(x2−9)x^4 - 81 = (x^2 + 9)(x^2 - 9) still hides (x+3)(x−3)(x + 3)(x - 3).
FinallyMultiply the factors back together; the product must be the original polynomial.
Which factoring technique?·/algebra/polynomials/factoringLearn Math Class
Every route ends with the same two checks: inspect each factor again, then multiply back. A route that ends at Maybe irreducible is not a dead end; whether a polynomial factors depends on the numbers allowed, as the next section shows.

Irreducible Polynomials

A polynomial is irreducible over a given number system when it cannot be written as a product of lower-degree polynomials with coefficients in that system. Irreducibility is not an absolute property — it depends entirely on what numbers are allowed.

The polynomial x2−2x^2 - 2 is irreducible over the integers because no pair of integer-coefficient linear factors produces it. Over the reals, it factors as (x+2)(x−2)(x + \sqrt{2})(x - \sqrt{2}). The polynomial x2+1x^2 + 1 goes further: it is irreducible over both the integers and the reals, since its roots ±i\pm i are not real numbers. Over the complex numbers, it factors as (x+i)(x−i)(x + i)(x - i).

The Fundamental Theorem of Algebra settles the question at the deepest level: every polynomial of degree n≥1n \geq 1 with complex coefficients factors completely into nn linear factors over the complex numbers. This means the only irreducible polynomials over the complex numbers are linear — degree 11.

THEOREM
Over the reals, the irreducible building blocks are linear polynomials and quadratic polynomials with negative discriminant (b2−4ac<0b^2 - 4ac < 0). Every real polynomial factors into a product of such pieces.

Fact: No real roots, yet x4+1x^4 + 1 factors
Adding and taking away 2x22x^2 makes a difference of squares: x4+1=(x2+1)2−(2x)2=(x2+2x+1)(x2−2x+1)x^4 + 1 = (x^2 + 1)^2 - (\sqrt{2}x)^2 = (x^2 + \sqrt{2}x + 1)(x^2 - \sqrt{2}x + 1). Over the integers, x4+1x^4 + 1 does not factor at all.

The rule above has a consequence for polynomials with no real roots at all. A real polynomial without real roots has no linear factor, so its pieces over the reals must all be quadratics with negative discriminant. Its complex roots come in conjugate pairs zz and zˉ\bar{z}, and each pair gives one such real quadratic, (x−z)(x−zˉ)(x - z)(x - \bar{z}).

Over the integers, identifying irreducibility is harder and no single test covers all cases, though the discriminant and the rational root theorem from the rules page offer useful starting points.
x^2 - 2 has irrational roots; x^2 + 1 has no real rootsxy−3−2−1123−3−2−1123456x² + 1 never reaches 0: irreducible over ℝx² − 2 = (x + √2)(x − √2): roots ±√2, not rationalx² − 2 factors over ℝ but not over ℤ; x² + 1 factors over neither
Irreducible depends on the number system

The section's two examples. x² − 2 crosses the axis at ±√2: it has real roots, so over the real numbers it factors as (x + √2)(x − √2), but those roots are not rational, so over the integers it cannot be factored. x² + 1 never reaches the axis at all: it has no real roots and stays irreducible over the real numbers, factoring only over the complex numbers as (x + i)(x − i).

Real roots are what a quadratic needs to factor over ℝ; rational roots are what it needs over ℤ.

Formula Summary

This summary collects the factoring patterns of the page, sorted by the number of terms, which is how the page chooses a technique. Each family carries a line linking to the sections that explain it, and each pattern a short note on how to recognize it or what to watch for. The buttons above the cards show one family at a time.

Three-term polynomials factor through the simple trinomial pattern or, when the ends are squares, as a perfect square. Two-term polynomials factor as a difference of squares or as a sum or difference of cubes. The last family generalizes both to higher powers: an even power reduces to a difference of squares, and odd powers split off one linear factor.
DownloadPNG2×PDF
Three terms3 formulas
x2+(a+b)x+ab=(x+a)(x+b)x^2 + (a + b)x + ab = (x + a)(x + b)
Find two numbers whose product is the constant and whose sum is the middle coefficient.
a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a + b)^2
The first and last terms are squares and the middle is twice their product.
a2−2ab+b2=(a−b)2a^2 - 2ab + b^2 = (a - b)^2
The same pattern with a minus middle term.
Two terms3 formulas
a2−b2=(a+b)(a−b)a^2 - b^2 = (a + b)(a - b)
A difference of two squares always factors; a sum of two squares does not over the reals.
a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2)
The binomial factor keeps the sign of the sum.
a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a - b)(a^2 + ab + b^2)
The binomial factor keeps the minus; the trinomial has all plus signs.
Higher powers3 formulas
The general patterns in factoring higher-degree polynomials.
x2n−a2n=(xn−an)(xn+an)x^{2n} - a^{2n} = (x^n - a^n)(x^n + a^n)
An even power is a difference of squares, and the first factor may split again.
xn−an=(x−a)(xn−1+axn−2+⋯+an−1)x^n - a^n = (x - a)(x^{n-1} + ax^{n-2} + \cdots + a^{n-1})
For odd nn, the second factor has all plus signs.
xn+an=(x+a)(xn−1−axn−2+⋯+an−1)x^n + a^n = (x + a)(x^{n-1} - ax^{n-2} + \cdots + a^{n-1})
For odd nn, the signs in the second factor alternate.
Factoring patterns·All algebra formulasLearn Math Class
Each pattern is checked the same way, by multiplying the factors back together. After any pattern is used, every factor deserves a second look, since a difference of squares or of cubes often hides inside the result.

Common Mistakes

Certain errors appear repeatedly in factoring work, and awareness of them is the simplest way to avoid them.

Skipping the GCF check is the most frequent. The polynomial 3x3−12x3x^3 - 12x looks like it might require advanced techniques, but extracting 3x3x first gives 3x(x2−4)=3x(x+2)(x−2)3x(x^2 - 4) = 3x(x + 2)(x - 2). Without that initial step, the factorization becomes unnecessarily difficult or incomplete.

Sign errors plague trinomial factoring. In x2−5x+6x^2 - 5x + 6, both numbers must be negative: (−2)(−3)=6(-2)(-3) = 6 and (−2)+(−3)=−5(-2) + (-3) = -5. Writing (x+2)(x−3)(x + 2)(x - 3) instead of (x−2)(x−3)(x - 2)(x - 3) gives a middle term of −x-x, not −5x-5x. Verification by expanding catches this immediately.

Confusing the sum and difference of squares is another trap. The difference a2−b2a^2 - b^2 factors as (a+b)(a−b)(a + b)(a - b). The sum a2+b2a^2 + b^2 does not factor over the reals — attempting to write it as (a+b)(a−b)(a + b)(a - b) produces a2−b2a^2 - b^2, not a2+b2a^2 + b^2.

With cube formulas, the most common error is mishandling signs in the quadratic factor. For a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2), the middle term of the quadratic factor is −ab-ab, not +ab+ab. Mixing this up produces an incorrect factorization that fails verification.

Stopping too early leaves factors on the table. After obtaining (x2+4)(x2−4)(x^2 + 4)(x^2 - 4) from x4−16x^4 - 16, the second factor is itself a difference of squares. Every factor must be inspected for further decomposition before the factorization is considered complete.
DownloadPNG2×PDF
Layout
MistakeWhy it goes wrongCorrect approach
Skipping the GCFfactoring 3x³ − 12x without first pulling 3x; misses or mangles the restextract GCF first → 3x(x + 2)(x − 2)
Wrong signs in trinomialx² − 5x + 6 = (x + 2)(x − 3) gives middle term −x, not −5xmatch sign rules (m·n = c, m + n = b); verify by expanding
Factoring a sum of squareswriting a² + b² = (a + b)(a − b) gives a² − b²a² + b² is irreducible over ℝ (factors only over ℂ)
Wrong middle-term sign in cubeswriting a³ + b³ = (a + b)(a² + ab + b²) (should be −ab)SOAP: Same / Opposite / Always Positive
Stopping too earlyx⁴ − 16 = (x² + 4)(x² − 4); leaves a hidden diff. of squaresre-inspect every factor for further decomposition
Common MistakesLearn Math Class
DownloadPNG2×PDF
1Losing the term that equals the GCF
When one term of the polynomial is the GCF itself, or its negative, dividing that term by the GCF leaves 11 or −1-1. That quotient is easy to overlook, and the term vanishes from the parentheses.
Start
6x3+9x2−3x6x^3 + 9x^2 - 3x
Wrong turn
Error here
=3x(2x2+3x)= 3x(2x^2 + 3x)
Right path
Divide every term by 3x3x. The quotients are 6x3÷3x=2x26x^3 \div 3x = 2x^2, 9x2÷3x=3x9x^2 \div 3x = 3x and −3x÷3x=−1-3x \div 3x = -1, so
=3x(2x2+3x−1)= 3x(2x^2 + 3x - 1)
Why it happensDividing a term by itself feels like it leaves nothing behind, so the −1-1 is never written down.
How to checkThe parentheses must hold as many terms as the original polynomial. Substituting x=1x = 1 also catches it: the original gives 6+9−3=126 + 9 - 3 = 12, the wrong form 3⋅5=153 \cdot 5 = 15, and the right form 3⋅4=123 \cdot 4 = 12.
2Using the AC pair as the factors
In the AC method, the two numbers are found for the product acac and then written straight into (x+m)(x+n)(x + m)(x + n), as in the simple case. The step where the pair splits the middle term is skipped, and the leading coefficient is lost.
Start
For 6x2+11x+46x^2 + 11x + 4, ac=24ac = 24 and the pair 33, 88 gives 3⋅8=243 \cdot 8 = 24, 3+8=113 + 8 = 11, so
Wrong turn
Error here
6x2+11x+4=(x+3)(x+8)6x^2 + 11x + 4 = (x + 3)(x + 8)
Right path
Use the pair to split the middle term, then group.
6x2+3x+8x+46x^2 + 3x + 8x + 4

=3x(2x+1)+4(2x+1)= 3x(2x + 1) + 4(2x + 1)

=(3x+4)(2x+1)= (3x + 4)(2x + 1)
Why it happensThe search for two numbers looks exactly like the one in the simple case, where the pair goes directly into the factors.
How to checkExpand the answer. (x+3)(x+8)=x2+11x+24(x + 3)(x + 8) = x^2 + 11x + 24 has leading coefficient 11 and constant 2424, not 66 and 44. The right answer gives (3x+4)(2x+1)=6x2+3x+8x+4=6x2+11x+4(3x + 4)(2x + 1) = 6x^2 + 3x + 8x + 4 = 6x^2 + 11x + 4.
Common pitfalls in factoring polynomials·/algebra/polynomials/factoringLearn Math Class
Most factoring slips, including the two worked above, are caught by multiplying the factors back out and comparing with the original, or by substituting a small value such as x=1x = 1 into both forms. One slip escapes that test: stopping too early gives a correct but incomplete factorization, so each factor still has to be checked for further factoring.

Summary: A Factoring Decision Tree

Factoring becomes routine once each polynomial is mapped to a technique by its structure — primarily the number of terms and the form of the leading coefficient. The table below collects the situations encountered above, the technique each calls for, and a worked example for every case. Run through it in order from top to bottom for any factoring problem.
DownloadPNG2×PDF
Layout
SituationTechnique to tryExample
Any polynomial (first move)extract the GCF6x³ + 9x² − 3x → 3x(2x² + 3x − 1)
Two termsdifference of squares; sum or difference of cubes9x² − 16 → (3x + 4)(3x − 4)
Three terms, leading coeff 1simple trinomial: find m, n with m·n = c, m + n = bx² + 7x + 12 → (x + 3)(x + 4)
Three terms, leading coeff ≠ 1AC method: split middle term, then group6x² + 11x + 4 → (3x + 4)(2x + 1)
Four or more termsfactoring by grouping (rearrange if needed)x³ + 2x² + 3x + 6 → (x² + 3)(x + 2)
Higher degree, only even powerssubstitute u = x²; factor in u; substitute backx⁴ + 5x² + 6 → (x² + 2)(x² + 3)
Higher degree, known root rdivide by (x − r); factor the quotient furtherP(2) = 0 → P(x) = (x − 2) · Q(x)
After any stepre-inspect every factor; verify by re-expansionx⁴ − 16 = (x² + 4)(x² − 4) → (x² + 4)(x + 2)(x − 2)
Summary: A Factoring Decision TreeLearn Math Class
DownloadPNG2×PDF
Before you read
Read the structure, pick the technique
Factoring always starts with the greatest common factor; after that, the number of terms and the leading coefficient point to the technique.
  • L0Factoring a polynomial
    • L1First move: extract the GCFany polynomial6x³ + 9x² − 3x → 3x(2x² + 3x − 1)
    • L1Two termsdifference of squares, sum or difference of cubes9x² − 16 → (3x + 4)(3x − 4)
    • L1Three terms
      • L2Leading coefficient 1find m·n = c and m + n = bx² + 7x + 12
      • L2Leading coefficient ≠ 1AC method6x² + 11x + 4
    • L1Four or more termsgroupingx³ + 2x² + 3x + 6
    • L1Higher degree
      • L2Only even powerssubstitute u = x²x⁴ + 5x² + 6
      • L2Known root rdivide by (x − r)
Takeaway
Inspect again after every step
After any step, re-inspect each factor for further factoring, and verify by expanding back.
A factoring decision tree·/algebra/polynomials/factoringLearn Math Class

Skills You Should Learn

Each skill opens its step-by-step method page. Skills marked "On this page" are taught above.
Taught on this page
More polynomial methods
Equation methods
Limit methods

Factoring Polynomials FAQ

What is the most common factoring mistake?

+
Skipping the greatest common factor. 3x3−12x3x^3 - 12x looks like it needs a clever technique until you pull out 3x3x, leaving 3x(x2−4)=3x(x+2)(x−2)3x(x^2 - 4) = 3x(x + 2)(x - 2). Without that first step the work becomes needlessly hard, and the factorization often ends up incomplete. Always check for a common factor before reaching for any pattern.Read more →

Why doesn't a2+b2a^2 + b^2 factor over the reals?

+
Because there is no pair of real factors whose product returns a sum of squares. The tempting move is to borrow the difference of squares and write (a+b)(a−b)(a + b)(a - b), but expanding that gives a2−b2a^2 - b^2, the wrong sign entirely. A sum of squares is irreducible over the reals, and only factors once complex numbers are allowed.Read more →

How do you know when a factorization is finished?

+
When no factor can be broken down further, which is easy to declare too early. Factoring x4−16x^4 - 16 as (x2+4)(x2−4)(x^2 + 4)(x^2 - 4) looks complete, but the second factor is itself a difference of squares and splits again into (x+2)(x−2)(x + 2)(x - 2). Inspect every factor you produce, not just the original expression.Read more →

How can you tell whether a trinomial factors over the integers?

+
Check the discriminant before hunting for the pair. With integer coefficients, ax2+bx+cax^2 + bx + c factors into integer linear factors exactly when b2−4acb^2 - 4ac is a perfect square, 00 included; otherwise no pair of numbers exists and the search can only fail. For 6x2+11x+46x^2 + 11x + 4 it is 121−96=25=52121 - 96 = 25 = 5^2, so it factors, while for x2+x+1x^2 + x + 1 it is −3-3, so it does not.Read more →

Can the quadratic factor in a sum or difference of cubes be factored further?

+
No, not over the reals. Read as quadratics in aa, both a2−ab+b2a^2 - ab + b^2 and a2+ab+b2a^2 + ab + b^2 have discriminant b2−4b2=−3b2b^2 - 4b^2 = -3b^2, which is negative for every b≠0b \neq 0, so neither has a real root. That is why x3+8x^3 + 8 stops at (x+2)(x2−2x+4)(x + 2)(x^2 - 2x + 4): splitting the quadratic factor would take complex numbers.Read more →

Can a polynomial with no real roots still be factored over the reals?

+
Yes, whenever its degree is 44 or more. x4+1x^4 + 1 is never zero, yet adding and taking away 2x22x^2 makes a difference of squares: (x2+1)2−(2x)2=(x2+2x+1)(x2−2x+1)(x^2 + 1)^2 - (\sqrt{2}x)^2 = (x^2 + \sqrt{2}x + 1)(x^2 - \sqrt{2}x + 1). No real roots only rules out linear factors; quadratic pieces with negative discriminant are still allowed. Over the integers, x4+1x^4 + 1 does not factor at all.Read more →

Do the factors of xn−1x^n - 1 always have coefficients 00, 11 or −1-1?

+
No, but the first exception comes late. For every nn up to 104104, each irreducible piece of xn−1x^n - 1 over the integers uses only 00, 11 and −1-1, as in x6−1=(x−1)(x+1)(x2+x+1)(x2−x+1)x^6 - 1 = (x - 1)(x + 1)(x^2 + x + 1)(x^2 - x + 1). At n=105=3⋅5⋅7n = 105 = 3 \cdot 5 \cdot 7, the first nn with three different odd prime factors, the piece of degree 4848 contains the coefficient −2-2.Read more →