CoefficientRules[poly,{x1,x2,…}]
gives the list {{e11,e12,…}c1,{e21,…}c2,…} of exponent vectors and coefficients for the monomials in poly with respect to the xi.
CoefficientRules[poly,{x1,x2,…},order]
gives the result with the monomial ordering specified by order.
CoefficientRules
CoefficientRules[poly,{x1,x2,…}]
gives the list {{e11,e12,…}c1,{e21,…}c2,…} of exponent vectors and coefficients for the monomials in poly with respect to the xi.
CoefficientRules[poly,{x1,x2,…},order]
gives the result with the monomial ordering specified by order.
Details and Options
- CoefficientRules works whether or not poly is explicitly given in expanded form.
- CoefficientRules[poly] is equivalent to CoefficientRules[poly,Variables[poly]].
- Possible settings for order are the same as in MonomialList.
- The default order is "Lexicographic".
- CoefficientRules[poly,vars,Modulus ->m] computes the coefficients modulo m.
- CoefficientRules[poly,All,order] is the same as CoefficientRules[poly,Variables[poly],order].
Examples
open all close allBasic Examples (1)
Scope (1)
Use "DegreeReverseLexicographic" monomial ordering:
CoefficientRules[a x y ^ 2 + b x ^ 2 z, {x, y, z}, "DegreeReverseLexicographic"]Specify the same ordering using weight matrix:
CoefficientRules[a x y ^ 2 + b x ^ 2 z, {x, y, z}, {{1, 1, 1}, {0, 0, -1}, {0, -1, 0}}]Options (1)
Properties & Relations (2)
FromCoefficientRules reconstructs the original polynomial:
CoefficientRules[a x ^ 2 + b x y + c y ^ 2, {x, y}]FromCoefficientRules[%, {x, y}]MonomialList gives a different representation:
MonomialList[a x ^ 2 + b x y + c y ^ 2, {x, y}]For two variables "DegreeLexicographic" and "DegreeReverseLexicographic" coincide:
poly = Sum[RandomInteger[{-10, 10}]x ^ RandomInteger[10]y ^ RandomInteger[10], {20}]CoefficientRules[poly, {x, y}, "DegreeLexicographic"] === CoefficientRules[poly, {x, y}, "DegreeReverseLexicographic"]Possible Issues (1)
The list given by Variables[poly] is not always sorted:
Variables[y + x z]CoefficientRules[y + x z]FromCoefficientRules[%, {y, x, z}]Neat Examples (2)
Visualize monomial orderings in 2D:
MonomialOrderPlot[poly_, {x1_, x2_}, ord_ : "Lexicographic", o : OptionsPattern[]] :=
Graphics[{Blue, Arrow /@ Partition[CoefficientRules[poly, {x1, x2}, ord][[All, 1]], 2, 1]}, Sequence@@FilterRules[{o}, Options[Graphics]]]The standard built-in orderings:
orders = {"Lexicographic", "DegreeLexicographic", "DegreeReverseLexicographic", "NegativeLexicographic", "NegativeDegreeLexicographic", "NegativeDegreeReverseLexicographic"};In 2D some orderings cannot be distinguished:
Table[MonomialOrderPlot[Sum[x ^ i y ^ j, {i, 0, 5}, {j, 0, 5}], {x, y}, o, PlotLabel -> Style[o, Small]], {o, orders}]Visualize monomial orderings in 3D:
MonomialOrderPlot3D[poly_, {x1_, x2_, x3_}, ord_ : "Lexicographic", o : OptionsPattern[]] :=
Graphics3D[{Arrowheads[.06], Arrow[Tube[#, .02]]& /@ Partition[CoefficientRules[poly, {x1, x2, x3}, ord][[All, 1]], 2, 1]}, Sequence@@FilterRules[{o}, Options[Graphics3D]]]orders = {"Lexicographic", "DegreeLexicographic", "DegreeReverseLexicographic", "NegativeLexicographic", "NegativeDegreeLexicographic", "NegativeDegreeReverseLexicographic"};In 3D all orderings are distinct:
Table[MonomialOrderPlot3D[Sum[x ^ i y ^ j z ^ k, {i, 0, 2}, {j, 0, 2}, {k, 0, 2}], {x, y, z}, o, PlotLabel -> Style[o, Small]], {o, orders}]Tech Notes
Related Guides
History
Text
Wolfram Research (2008), CoefficientRules, Wolfram Language function, https://reference.wolfram.com/language/ref/CoefficientRules.html.
CMS
Wolfram Language. 2008. "CoefficientRules." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CoefficientRules.html.
APA
Wolfram Language. (2008). CoefficientRules. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CoefficientRules.html
BibTeX
@misc{reference.wolfram_2026_coefficientrules, author="Wolfram Research", title="{CoefficientRules}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/CoefficientRules.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_coefficientrules, organization={Wolfram Research}, title={CoefficientRules}, year={2008}, url={https://reference.wolfram.com/language/ref/CoefficientRules.html}, note=[Accessed: 12-June-2026]}