The Polynomial Toolkit, Explained

After reading this you can factor a polynomial over the rationals, expand a product back into standard form, and divide one polynomial by another to get a quotient and remainder, checking each result by hand.

What the toolkit does

A polynomial is a sum of terms like 3x^2, -5x and 4, each a coefficient times a power of the variable. The toolkit works on these expressions symbolically, which means it manipulates the letters and coefficients exactly, not as decimal approximations.

Three operations are available. Factoring rewrites x^4 - 5*x^2 + 4 as the product (x-1)(x+1)(x-2)(x+2). Expanding runs the process backward: given (x-1)(x+1)(x-2)(x+2) it returns x^4 - 5x^2 + 4. Division splits one polynomial by another into a quotient plus a remainder, the same idea as 17 / 5 = 3 remainder 2.

Every result is exact. If a factor has irrational or complex roots, the toolkit keeps the factor whole rather than approximating its zeros.

When to use each mode, and when not to

Reach for factor when you want the roots or when you plan to cancel common factors in a fraction. A factored form shows the zeros directly: (x-2) as a factor means x = 2 is a root.

Reach for expand when you need standard form for adding polynomials, matching coefficients, or reading off the leading term and degree.

Reach for divide when a divisor does not go in evenly and you want the leftover, or when you are checking whether one polynomial is a factor of another (a zero remainder means yes).

Factoring here is over the rationals. The polynomial x^2 - 2 stays as x^2 - 2 because its roots \pm\sqrt{2} are irrational. If you need the numeric roots instead, use the Equation solver or, for degree two, the Quadratic solver.

The division algorithm

Polynomial long division rests on one identity. For a dividend f(x) and a nonzero divisor g(x), there is exactly one pair of polynomials q(x) (quotient) and r(x) (remainder) with:

f(x) = g(x)\,q(x) + r(x), \qquad \deg r \lt \deg g

Here \deg is the degree, the highest power present. The condition \deg r \lt \deg g forces the remainder to be smaller than the divisor, which is what makes the answer unique. If g(x) has degree 1, the remainder is a single constant.

Factoring uses the same identity in reverse. If g(x) divides f(x) with r(x) = 0, then g(x) is a factor. This links directly to roots through the factor theorem: x = a is a root of f exactly when (x-a) divides f with remainder 0.

Worked example: factoring the demo polynomial

Factor x^4 - 5x^2 + 4

This is the calculator's demo. Set Mode to Factor and leave the polynomial as x^4 - 5*x^2 + 4.

  1. Notice the polynomial only uses even powers. Substitute u = x^2 to get u^2 - 5u + 4.
  2. Factor the quadratic in u. You need two numbers multiplying to 4 and adding to -5: those are -1 and -4. So u^2 - 5u + 4 = (u-1)(u-4).
  3. Replace u with x^2: (x^2 - 1)(x^2 - 4).
  4. Each factor is a difference of squares. x^2 - 1 = (x-1)(x+1) and x^2 - 4 = (x-2)(x+2).
  5. The full factorization is (x-1)(x+1)(x-2)(x+2).

The four roots are 1, -1, 2 and -2. You can confirm by plugging in: 2^4 - 5\cdot 2^2 + 4 = 16 - 20 + 4 = 0.

The curve touches the x-axis at -2, -1, 1 and 2, the four roots read off the factored form.

Explore how a coefficient reshapes the factors

Small changes to a coefficient can move a polynomial from a clean rational factorization to one with no rational factors at all. The widget below lets you watch that boundary.

Consider x^4 - b x^2 + 4. When b = 5 it factors as (x-1)(x+1)(x-2)(x+2). When b = 4 it becomes (x^2-2)^2, which has no rational factors because \sqrt{2} is irrational. When b = 3 the graph never reaches zero and the polynomial has no real roots at all.

Worked example: division with a remainder

Divide x^4 - 5x^2 + 4 by x - 1

Switch Mode to Divide, keep the polynomial, and set the divisor to x - 1.

  1. Write the dividend with every power present: x^4 + 0x^3 - 5x^2 + 0x + 4. The zero terms keep the columns aligned.
  2. Divide the leading terms: x^4 \div x = x^3. Multiply back: x^3(x-1) = x^4 - x^3. Subtract to get x^3 - 5x^2.
  3. Repeat: x^3 \div x = x^2, subtract x^2(x-1) to get -4x^2 + 0x.
  4. Next: -4x^2 \div x = -4x, subtract to get -4x + 4.
  5. Last: -4x \div x = -4, subtract -4(x-1) to get 0.

The quotient is x^3 + x^2 - 4x - 4 and the remainder is 0. A zero remainder confirms that x = 1 is a root, which matches the factored form above.

Reading and checking the results

Whatever mode you use, verify the output the same way: multiply the factors or the quotient back and compare to the original.

For the division example, check (x-1)(x^3 + x^2 - 4x - 4) + 0. Expanding gives x^4 + x^3 - 4x^2 - 4x - x^3 - x^2 + 4x + 4 = x^4 - 5x^2 + 4, the dividend exactly.

A short check with a nonzero remainder shows the pattern more clearly. Dividing x^2 + 1 by x - 1 gives quotient x + 1 and remainder 2, so x^2 + 1 = (x-1)(x+1) + 2. At x = 1 both sides equal 2, and the remainder 2 is exactly the value f(1), an instance of the remainder theorem.

Sample divisions by x - 1, showing quotient and remainder
DividendQuotientRemainderf(1)
x^4 - 5x^2 + 4x^3 + x^2 - 4x - 400
x^2 + 1x + 122
x^3 - 8x^2 + x + 1-7-7

The remainder column and the f(1) column always match when the divisor is x - 1. That is the remainder theorem: dividing by x - a leaves the remainder f(a).

Common mistakes

The errors below account for most wrong answers.

Skipping zero terms in division
If you divide x^3 - 8 and forget the missing x^2 and x terms, the columns drift and the quotient comes out wrong. Always write x^3 + 0x^2 + 0x - 8.
Expecting rational factors that do not exist
x^2 - 2 and x^2 + 1 are already fully factored over the rationals. The first has irrational roots, the second has complex roots. Neither breaks into smaller rational-coefficient factors.
Confusing factoring with solving
Factoring rewrites the expression; solving finds the values of x. Factoring stops at x^2 - 2, but solving gives x = \pm\sqrt{2}. Different jobs, different tools.
Dropping a sign when subtracting
Each long-division step subtracts a product. Distribute the minus across every term. Turning -(x^4 - x^3) into -x^4 - x^3 instead of -x^4 + x^3 is the single most common slip.

Use * for multiplication and ^ for powers in the input. Writing 2x instead of 2*x, or x2 instead of x^2, changes the meaning or fails to parse.

Related tools

Once you have a factored or divided form, these calculators take the next step.

Frequently asked questions

Why does the toolkit leave x^2 + 1 unfactored?

Its roots are \pm i, which are complex, not rational. Over the rationals it is irreducible, so it stays as is. Factor over the complex numbers only if a tool explicitly offers that, and then it becomes (x-i)(x+i).

What does a zero remainder mean?

The divisor goes in evenly, so it is a factor of the dividend. For example, dividing x^4 - 5x^2 + 4 by x - 1 leaves remainder 0, which confirms x = 1 is a root.

How do I find the actual roots after factoring?

Read them from the linear factors: (x - a) gives root a. For factors that stay quadratic, feed them to the Quadratic solver to get exact roots including irrational or complex ones.

Can I divide by a polynomial of degree higher than one?

Yes. Dividing by x^2 - 1, for instance, gives a remainder of degree at most 1, that is, a term in x plus a constant. The degree rule \deg r \lt \deg g always holds.

Does the order of factors matter?

No. (x-1)(x+2) and (x+2)(x-1) are the same product and expand to the same x^2 + x - 2. The toolkit may list factors in a different order than you wrote them.