How to | Factor a Polynomial
The Wolfram Language includes functionality to factor polynomials symbolically.
If you are concerned with factoring a polynomial, Factor is the appropriate command:
Factor[x ^ 3 - 3x ^ 2 - 2x + 6]If you would like to specify an extension in which to factor, say one with
, use the Extension option:
Factor[x ^ 3 - 3x ^ 2 - 2x + 6, Extension -> Sqrt[2]]If you would like to specify a modulus for the factorization, like 3, use the Modulus option:
Factor[x ^ 3 - 3x ^ 2 - 2x + 6, Modulus -> 3]For a polynomial of multiple variables, Factor will still try to decompose it:
Factor[x ^ 3y ^ 2 - 3x ^ 2y - 2x y ^ 3 + 6y ^ 2]Sometimes, it is more important to find whether the polynomial is irreducible than to try to find its factors explicitly. You can find out with IrreduciblePolynomialQ; for example, this checks if
is irreducible:
IrreduciblePolynomialQ[x ^ 2 + x + 1]To get the largest factor of a collection of polynomials, say
, use the PolynomialGCD command:
PolynomialGCD[x ^ 2 - 1, x ^ 2 + 2x + 1, x ^ 3 - x ^ 2 - x + 1]