Factoring Calculator

Factor a polynomial completely over the rationals, with every step shown and the answer multiplied back out to prove it. Exact fractions throughout — and a straight answer when a polynomial does not factor at all.

Try:

Factors completely into linear factors

x² − 5x + 6 = (x − 2)(x − 3)

The factors

FactorDegreeAppearsZero at
x − 211x = 2
x − 311x = 3

Checked: multiplying these back out gives the original polynomial exactly, in exact fractions rather than decimals.

How it was factored

  1. Find the rational rootsBy the rational root theorem, every rational root p/q has p dividing the constant term and q dividing the leading coefficient. Each root found divides out: x = 2 gives x − 2; x = 3 gives x − 3.

Factoring is not the same as finding the roots

Most factoring calculators find the roots of the polynomial and then write the answer as a product of (x − r) for each one. For the polynomials in a first algebra course that works, because those polynomials are built from linear factors in the first place. It stops working the moment a factor is not linear.

The clearest example is x⁴ + 3x² + 2. It has no real root, let alone a rational one — substitute any number and the result is at least 2. A root-finder therefore reports it as irreducible. But it factors, and easily: treat x² as a single quantity and it is u² + 3u + 2 = (u + 1)(u + 2), so the polynomial is (x² + 1)(x² + 2). Multiply it out and check.

So factoring and root-finding are different problems, and the second is not a way of doing the first. This tool factors: it looks for factors of every degree, not only degree one. The equation solver is the one to use when what you want is the solutions.

How it factors

Four steps, in order, each one cheap enough to be worth trying first.

  1. Take out the common factor. Any number multiplying every term comes out first, including a fraction. 3x² − 12 becomes 3(x² − 4), and the sign comes out too so that what is left has a positive leading coefficient. This matters more than it looks: once the leading coefficient and the content are cleared, the polynomial is primitive, and a primitive polynomial factors over the rationals exactly when it factors over the whole numbers. That is Gauss's lemma, and it is what makes the search in step four finite.
  2. Take out the lowest power of x. If every term has an x in it, that x is a factor. x⁵ − x is x(x⁴ − 1) before anything else happens.
  3. Find the rational roots. By the rational root theorem, any root p/q of a polynomial with whole-number coefficients has p dividing the constant term and q dividing the leading coefficient. That is a short list, every candidate is tested exactly, and each root found is divided out — repeatedly, so a repeated root is found with its multiplicity rather than once.
  4. Search for the factors that are left. What survives step three has no rational root, so it has no linear factor. In degree 2 or 3 that settles it: a cubic that factored would have to have a linear factor, and a linear factor is a rational root. From degree 4 up it can still split into two quadratics, and that is where the real work happens.

The search, and why "irreducible" is a result

The fourth step uses Kronecker's method, which is exhaustive rather than clever. The idea is short enough to state: a factor g of degree s is completely determined by its values at s + 1 points, and at any whole number p the value g(p) has to divide f(p). So evaluate f at a few whole numbers, list the divisors of each result, and interpolate a polynomial through every combination of those divisors. Every possible factor of that degree is somewhere in that list. If none of them divides f, then f has no factor of that degree — not "none was found", but none exists.

That is why this tool will tell you a polynomial is irreducible and mean it. x⁴ + 1 is the standard example: it has no real roots, it is not a difference of squares, and it genuinely does not factor over the rationals. Compare x⁴ + 4, which looks almost identical and factors as (x² − 2x + 2)(x² + 2x + 2) — the Sophie Germain identity. No amount of looking at those two will tell you which is which; the search will.

The method is exponential in the number of divisors, so it has a budget. If the budget runs out the page says so, rather than reporting "irreducible" and letting you assume the search finished. The factors shown are always correct; only the claim that there are no others can be withheld.

The standard identities, named

Most factoring exercises are really identity recognition. The tool names the one it sees, because the name is what the exercise is teaching and an answer that appears without it is not much use for learning.

Name Pattern Example
Difference of squares a² − b² = (a − b)(a + b) 100x² − 1 = (10x − 1)(10x + 1)
Sum of cubes a³ + b³ = (a + b)(a² − ab + b²) x³ + 8 = (x + 2)(x² − 2x + 4)
Difference of cubes a³ − b³ = (a − b)(a² + ab + b²) x³ − 27 = (x − 3)(x² + 3x + 9)
Perfect square trinomial a² ± 2ab + b² = (a ± b)² 4x² − 12x + 9 = (2x − 3)²
Grouping ax³ + bx² + cx + d, when ad = bc 2x³ + 3x² − 2x − 3 = (x − 1)(x + 1)(2x + 3)

The grouping condition is worth knowing because it is exact rather than a matter of trying. A four-term cubic ax³ + bx² + cx + d splits into pairs with a common bracket precisely when ad = bc. For 2x³ + 3x² − 2x − 3 that is 2 × (−3) = 3 × (−2), both −6, so grouping works. For x³ − 6x² + 11x − 6 it is −6 against −66, so grouping will not work however the terms are arranged, and you need the rational root theorem instead. A minute of checking saves ten minutes of rearranging.

Why exact arithmetic is not a detail

Every number here is a fraction held as a pair of whole numbers of unlimited size. Nothing is ever a decimal, at any point.

That is not fussiness. Factoring rests entirely on exact comparisons: is this remainder zero, is this value a perfect square, does this candidate divide that one. In floating point, dividing x³ − 6x² + 11x − 6 by (x − 3) leaves a remainder of about 1.8 × 10⁻¹⁵ rather than zero, and the whole procedure then rests on a threshold someone picked. Set it too tight and real factors are missed; too loose and x² − 2 is reported as (x − 1.41421356)² multiplied by nothing in particular.

The same exactness is why the check under every answer is worth running. Multiplying the factors back out and comparing with the input is only a meaningful test if the comparison is exact.

Mistakes this will catch

  1. Stopping too early. x⁴ − 1 is a difference of squares, so (x² − 1)(x² + 1) — and then the first bracket is a difference of squares again. The complete answer is (x − 1)(x + 1)(x² + 1), and the half-finished version is the most common wrong answer there is.
  2. Forgetting the common factor. 6x⁴ − 6 is not (x − 1)(x + 1)(x² + 1); the 6 has to be there.
  3. Missing a repeated factor. x³ − x² − x + 1 is (x − 1)²(x + 1), not three distinct brackets. The factor table lists how many times each one appears.
  4. Factoring a sum of squares. x² + 9 does not factor over the rationals, or over the reals. Only the difference of squares does.
  5. Treating "no rational root" as "irreducible". The quartics above are the counterexample, and this is as common among calculators as among students.

What it does not do

Questions

What does "factor completely" actually mean?

Write the polynomial as a product that cannot be broken down any further, using the kind of numbers you are allowed. Here that is the rational numbers, which is what every school course means by factoring unless it says otherwise. x⁴ − 4 factors completely as (x² − 2)(x² + 2) over the rationals; if surds were allowed it would go on to (x − √2)(x + √2)(x² + 2). Both answers are right under their own rules, which is why the rule has to be stated.

Why does it say a polynomial is irreducible instead of giving me decimals?

Because decimals would be a different question. x² − 2 does not factor over the rationals — that is a fact about the polynomial, not a limitation of the search. Writing it as (x − 1.414)(x + 1.414) is not a factorisation: multiply it back out and you get x² − 1.999396, which is a different polynomial. If you want the zeros rather than the factors, the equation solver gives them as exact surds.

How can a polynomial factor if it has no roots?

Because a factor does not have to be linear. x⁴ + 3x² + 2 has no real root at all, and it factors as (x² + 1)(x² + 2). This is the case most factoring calculators get wrong: they find the roots and build the answer out of them, so a polynomial whose factors are quadratic comes back marked irreducible. This one searches for factors of every degree, not only for roots.

Can it factor expressions with two variables, like x²y + xy²?

No. It works in one variable at a time. Multi-variable factoring needs a different algorithm and a different interface, and doing it badly would be worse than not doing it. For an expression like that one, taking out the common factor xy by hand leaves xy(x + y), which is the whole answer.

What is the check underneath the answer?

The factors multiplied back out, compared with what you typed, in exact fractions. It is the only test that cannot be fooled by a formatting mistake, and it runs on every answer. If it ever says the check failed, that is a bug and worth reporting.

Does it show the working?

Yes — the common factor taken out, the rational roots found and what each one contributes, and what is left over. It also names the standard identity when the polynomial is one: a difference of squares, a sum or difference of cubes, a perfect square trinomial, or the four-term case that factors by grouping. Those names are most of what the exercise is teaching.