Factor
Details and Options
- Factor applies only to the top algebraic level in an expression. You may have to use Map, or apply Factor again, to reach other levels.
- Factor[poly,GaussianIntegers->True] factors allowing Gaussian integer coefficients.
- If any coefficients in poly are complex numbers, factoring is done allowing Gaussian integer coefficients.
- The exponents of variables need not be positive integers. Factor can deal with exponents that are linear combinations of symbolic expressions.
- When given a rational expression, Factor effectively first calls Together, then factors numerator and denominator.
- Factor takes the following options:
-
Extension None coefficient field to be used GaussianIntegers False whether to factor over Gaussian integers Modulus 0 modulus to assume for integers Trig False whether to do trigonometric as well as algebraic transformations - With the default setting Extension->None, Factor[poly] will treat algebraic number coefficients in poly like independent variables.
- Factor[poly,Extension->Automatic] will extend the domain of coefficients to include any algebraic numbers that appear in poly. »
- Factor automatically threads over lists, as well as equations, inequalities and logic functions.
Examples
open all close allBasic Examples (3)
Factor univariate polynomials:
Factor[1 + 2x + x ^ 2]Factor[x ^ 10 - 1]Factor multivariate polynomials:
Factor[x ^ 10 - y ^ 10]Factor polynomials over the integers modulo 2:
Factor[x ^ 10 - 1, Modulus -> 2]Scope (13)
Basic Uses (6)
Factor[x ^ 3 - 6x ^ 2 + 11x - 6]Factor[2x ^ 3 y - 2a ^ 2x y - 3a ^ 2x ^ 2 + 3a ^ 4]Factor[(x ^ 3 + 2x ^ 2) / (x ^ 2 - 4y ^ 2) - (x + 2) / (x ^ 2 - 4y ^ 2)]Factor[2 ^ (3x) - 1]Factor threads over lists:
Factor[{x ^ 2 - 1, x ^ 4 - 1, x ^ 8 - 1}]Factor threads over equations and inequalities:
Factor[1 < 1 + 2 x + x ^ 2 + 1 / (1 + x) < 2]Advanced Uses (7)
Factor a polynomial over the Gaussian integers:
Factor[x ^ 2 + 1, GaussianIntegers -> True]Factor a polynomial over an algebraic extension:
Factor[x ^ 4 - 2, Extension -> Sqrt[2]]Factor a polynomial over the integers modulo 3:
Factor[x ^ 3 + 1, Modulus -> 3]Factor polynomials over a finite field:
ℱ = FiniteField[17, 3];Factor[ℱ[3]x ^ 2 + ℱ[1771]]Factor[x ^ 3 + 5x + 19, Extension -> ℱ]Factor a polynomial over an extension of a finite field:
ℱ = FiniteField[29, 3];
𝒢 = FiniteField[29, 6];
ℰ = FiniteFieldEmbedding[ℱ, 𝒢];A polynomial irreducible over
factors after embedding
in a larger field
:
Factor[ℱ[12]x ^ 2 + ℱ[34]x + ℱ[56]]Factor[ℱ[12]x ^ 2 + ℱ[34]x + ℱ[56], Extension -> ℰ]Some non-polynomial expressions can be factored:
Factor[x ^ (2s) + 2x ^ s + 1]Factor[x ^ (2 / 3s) + 2x ^ s + 1]Factor[Exp[2s] + 2Exp[s] + 1]Factor a polynomial of degree
:
rpoly[n_] := RandomInteger[{-2 ^ 10, 2 ^ 10}, {n + 1}].x ^ Range[0, n]
SeedRandom[1234];
p = rpoly[1000]; q = rpoly[1000];
r = Expand[p q];Factor[r]//Short//AbsoluteTimingOptions (7)
Extension (4)
Factor over algebraic number fields:
Factor[1 + x ^ 4, Extension -> Sqrt[2]]Factor[1 + x ^ 4, Extension -> {Sqrt[2], I}]Extension->Automatic automatically extends to a field that covers the coefficients:
Factor[2 + 2Sqrt[2]x + x ^ 2]Factor[2 + 2Sqrt[2]x + x ^ 2, Extension -> Automatic]Factor a polynomial with integer coefficients over a finite field:
ℱ = FiniteField[73, 4];Factor[x ^ 4 + 21x + 3, Extension -> ℱ]Factor a polynomial with coefficients in a finite field:
ℱ = FiniteField[7, 2];Factor[ℱ[1]x ^ 4 + ℱ[234]x + ℱ[567]]Embedding
in a larger field
allows further factorization:
𝒢 = FiniteField[7, 4];
ℰ = FiniteFieldEmbedding[ℱ, 𝒢];Factor[ℱ[1]x ^ 4 + ℱ[234]x + ℱ[567], Extension -> ℰ]GaussianIntegers (1)
Modulus (1)
Applications (3)
When modeling behavior with polynomials, it is important to determine when the polynomial evaluates to zero. For example, suppose the cost to produce a video game system is modeled by the following expression:
cost[x_] := -.03x ^ 3 + 4x ^ 2 - x + 500Plot[cost[x], {x, 0, 100}]Also suppose the revenue can be modeled by the equation:
revenue[x_] := .03x ^ 2 - 4x + 200Plot[revenue[x], {x, 0, 100}]If you wish to know the number of units you must sell before making a profit, calculate the difference:
profit[x_] := revenue[x] - cost[x]Plot[profit[x], {x, 0, 100}]Then solve to find where the profit function is zero using Factor:
Factor[profit[x]]This reveals to us there is a zero for profit at
:
Plot[profit[x], {x, 130, 140}]Find a number that is equal to its square:
x ^ 2 == xSubtract
from both sides of the equation:
SubtractSides[%, x]Use Factor to find when a polynomial is zero:
Factor[%]The only numbers that are equal to their square are thus
and
:
0 ^ 21 ^ 2Compute the greatest common divisor of two polynomials:
Factor[-x ^ 2 + x]Factor[x ^ 4 - 1]You can see they share a common factor of
. Confirm this result using PolynomialGCD:
PolynomialGCD[-x ^ 2 + x, x ^ 4 - 1]Properties & Relations (3)
Expand is effectively the inverse of Factor:
Factor[x ^ 50 - 1]Expand[Factor[x ^ 50 - 1]]FactorList gives a list of factors:
FactorList[x ^ 8 + 11x ^ 7 + 43x ^ 6 + 59x ^ 5 - 35x ^ 4 - 151x ^ 3 - 63x ^ 2 + 81x + 54]FactorSquareFree only pulls out multiple factors:
f = x ^ 9 + 9x ^ 8 + 21x ^ 7 - 27x ^ 6 - 153x ^ 5 - 81x ^ 4 + 239x ^ 3 + 207x ^ 2 - 108x - 108;Factor[f]FactorSquareFree[f]Related Links
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 2007 (6.0) ▪ 2022 (13.2) ▪ 2023 (13.3)
Text
Wolfram Research (1988), Factor, Wolfram Language function, https://reference.wolfram.com/language/ref/Factor.html (updated 2023).
CMS
Wolfram Language. 1988. "Factor." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/Factor.html.
APA
Wolfram Language. (1988). Factor. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Factor.html
BibTeX
@misc{reference.wolfram_2026_factor, author="Wolfram Research", title="{Factor}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/Factor.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_factor, organization={Wolfram Research}, title={Factor}, year={2023}, url={https://reference.wolfram.com/language/ref/Factor.html}, note=[Accessed: 12-June-2026]}