PolynomialRemainder[p,q,x]
gives the remainder from dividing p by q, treated as polynomials in x.
PolynomialRemainder
PolynomialRemainder[p,q,x]
gives the remainder from dividing p by q, treated as polynomials in x.
Details and Options
- The degree of the result in x is guaranteed to be smaller than the degree of q.
- Unlike PolynomialMod, PolynomialRemainder performs divisions in generating its results.
- With the option Modulus->n, the remainder is computed modulo n.
Examples
open all close allBasic Examples (3)
Find the remainder after dividing one polynomial by another:
PolynomialRemainder[x ^ 4 + 2x + 1, x ^ 2 + 1, x]The difference of the dividend and the remainder is a polynomial multiple of the divisor:
(x ^ 4 + 2x + 1 - %) / (x ^ 2 + 1)//CancelIf the dividend is a multiple of the divisor, then the remainder is zero:
PolynomialRemainder[x ^ 2 + 2x + 1, x + 1, x]Find the remainder of division for polynomials with symbolic coefficients:
PolynomialRemainder[x ^ 3, a x + b, x]Coefficients of the quotient are rational functions of the input coefficients:
(x ^ 3 - %) / (a x + b)//CancelScope (4)
The resulting polynomial will have coefficients that are rational numbers:
PolynomialRemainder[x ^ 2 + x + 1, 2x + 1, x]The resulting polynomials will have coefficients that are rational functions:
{PolynomialRemainder[x ^ 2 + b x + 1, a x + 1, x], PolynomialRemainder[x ^ 2 + x + 1, Pi x + 1, x]}Polynomial remainder over the integers modulo
:
PolynomialRemainder[x ^ 2 + 4 x + 1, 2x + 1, x, Modulus -> 5]Polynomial remainder over a finite field:
ℱ = FiniteField[17, 3];PolynomialRemainder[ℱ[1]x ^ 5 + ℱ[123]x + ℱ[456], ℱ[789]x ^ 3 + ℱ[987]x + ℱ[654], x]PolynomialRemainder also works for rational functions:
PolynomialRemainder[(x ^ 2 + 1/(x + 2)(x - 1)), (x ^ 2 - 1/x + 3), x]The quotient and remainder of division of
by
are
and
, where
:
((x ^ 2 + 1/(x + 2)(x - 1)) - %) / ((x ^ 2 - 1/x + 3))//Together
and
are uniquely determined by the condition that the degree of
is less than the degree of
:
Exponent[Numerator[%%], x] < Exponent[Cancel[(x ^ 2 - 1) / Denominator[%%]], x]Options (1)
Applications (1)
Euclid's algorithm for the greatest common divisor:
Euclid[f_, g_, x_] /; Exponent[f, x] < Exponent[g, x] := Euclid[g, f, x]
Euclid[f_, g_ ? NumericQ, x_] := If[PossibleZeroQ[g], f, 1]
Euclid[f_, g_, x_] := Euclid[g, PolynomialRemainder[f, g, x], x]Euclid[(x + 1)(x + 2), (x + 2)(x + 3), x]Divide by the leading coefficient:
Expand[% / Coefficient[%, x, 1]]PolynomialGCD[(x + 1)(x + 2), (x + 2)(x + 3)]Properties & Relations (3)
For a polynomial
,
, where
is given by PolynomialQuotient:
{f, g} = {x ^ 2 + 4x + 1, x + 2};
q = PolynomialQuotient[f, g, x]And r is given by PolynomialRemainder:
r = PolynomialRemainder[f, g, x]Use Expand to verify the identity:
Expand[q g + r] == fTo get both quotient and remainder use PolynomialQuotientRemainder:
PolynomialQuotientRemainder[f, g, x]PolynomialReduce generalizes PolynomialRemainder for multivariate polynomials:
PolynomialReduce[x ^ 2 + 4x + 1, {x + 2}, {x}]PolynomialRemainder requires knowing the variable of interest:
PolynomialRemainder[x ^ 2, x + a, x]PolynomialMod is not provided that information and can choose when more than one variable is present:
PolynomialMod[x ^ 2, x + a]See Also
PolynomialQuotient Apart Cancel PolynomialMod Mod PolynomialReduce ShiftRegisterSequence
Function Repository: PseudoQuotientRemainder
Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 2023 (13.3)
Text
Wolfram Research (1988), PolynomialRemainder, Wolfram Language function, https://reference.wolfram.com/language/ref/PolynomialRemainder.html (updated 2023).
CMS
Wolfram Language. 1988. "PolynomialRemainder." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/PolynomialRemainder.html.
APA
Wolfram Language. (1988). PolynomialRemainder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PolynomialRemainder.html
BibTeX
@misc{reference.wolfram_2026_polynomialremainder, author="Wolfram Research", title="{PolynomialRemainder}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/PolynomialRemainder.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_polynomialremainder, organization={Wolfram Research}, title={PolynomialRemainder}, year={2023}, url={https://reference.wolfram.com/language/ref/PolynomialRemainder.html}, note=[Accessed: 13-June-2026]}