Polynomials and Factorization
A polynomial is a sum of powers, and factorization rewrites it as multiplied brackets, exposing every root at a glance. Taylor series, kernels and error surfaces are all polynomials in disguise.
Why Does This Exist?
Polynomials are the sums of powers that approximate everything smooth. Taylor series replace stranger functions with polynomials. Kernel features smuggle polynomial interactions into linear models. Splines stitch polynomial pieces into curves through data. And every one of these is easier to read in factored form, where the roots show instead of hide.
Factorization is the rewrite from added terms to multiplied brackets: . The left side hides its zeros; the right side announces them, and . This page covers degrees, evaluation and the three factoring patterns that handle nearly everything. Approximation by polynomials graduates to Taylor series and approximation; fitting them through points is interpolation methods.
The one idea you need first. A product is zero exactly when some factor is zero. So a factored polynomial hands you its roots for free, one per bracket. Expanding multiplies the brackets back out; factoring runs the film backwards.
Think of It Like This
Breaking a number into prime boxes
is opaque until written : suddenly its divisors, its multiples and its structure are all visible. Nothing about the value changed, only the representation, and the factored form is the useful one.
Factoring a polynomial does the same to an expression. is a pile of terms; is its prime boxes, each bracket a root waiting to be read. Multiplying back checks the work, just as checks the primes.
Where it stops: integers always factor into primes, while most polynomials do not factor over the rationals at all. The analogy shows the value of the form; the patterns below show when the form exists.
How It Actually Works
A polynomial adds terms . The degree is the highest power: has degree 3. The leading coefficient is its multiplier, . Evaluate by substitution, innermost powers first, or with nested Horner form for stability on high degrees.
Three patterns factor most of what appears. Greatest common factor first: . Difference of squares: . Trinomials : two numbers with sum and product , as in quadratic equations.
Worked example: factor, root, and verify at 10
Factor . Need sum , product : the numbers and . So . Roots: and .
Verify at both ways. Expanded: . Factored: . Both give , and is ordinary arithmetic confirming the algebra. The diagram above shows the same identity as one rectangle's area, computed two ways.
Code
import numpy as np
coeffs: list[float] = [1.0, 5.0, 6.0] # x^2 + 5x + 6, highest power firstroots: np.ndarray = np.roots(coeffs)print(roots) # -> [-3. -2.]print(10**2 + 5 * 10 + 6) # -> 156print((10 + 2) * (10 + 3)) # -> 156np.roots takes highest-power-first coefficients and returns the factored form's zeros directly. The last two prints are the two verifications agreeing at 156, the check that makes factoring trustworthy.
Watch Out For
Dropping the cross terms when expanding
is not . Each term of the left bracket multiplies each term of the right: , and the middle pair merges to . The dropped is the most common algebra slip in feature-cross derivations, and it changes every root.
Multiply term by term on small cases until it is automatic. Then verify by evaluating at one number, like the 156 above, which catches the slip instantly.
Assuming every polynomial factors nicely
has no real roots and no real factorization; over the integers most polynomials are prime-like. Code that pattern-matches brackets onto unfactorable expressions produces confident nonsense, and students burn hours hunting factors that provably do not exist.
Check the discriminant first for quadratics. For higher degrees, reach for numerical roots instead of exact brackets.
The Quick Version
- Degree is the highest power; leading coefficient multiplies it; evaluate by substitution.
- Factor out the greatest common factor first, then try squares-difference and sum-product patterns.
- with roots and ; both forms give 156 at .
- Expanding multiplies every term by every term; the cross terms merge, never vanish.
- No real roots means no real factorization: check before hunting brackets.