# Polynomial Orderings

The leading term of a polynomial can be chosen in many different ways. For multivariate polynomials, sorting by the total degree of the monomials is often useful.

MonomialList[poly] | get the list of monomials |

CoefficientRules[poly] | represent the monomials by exponent vectors and coefficients |

FromCoefficientRules[list] | construct a polynomial from a list of rules |

Different representations of polynomials.

If the second argument to MonomialList or CoefficientRules is omitted, the variables are taken in the order in which they are returned by the function Variables.

By default, the monomials are sorted lexicographically and given in the decreasing order. In the previous example, {5,4,1} (corresponding to ) is taken to precede {5,3,2} (corresponding to ) by the second element.

An order is described by defining how two vectors of exponents and are sorted. For the lexicographic order,

An order can also be described by giving a weight matrix. In that case the exponent vectors are multiplied by the weight matrix and the results are sorted lexicographically, also in the decreasing order. The matrices for different orderings are given as follows.

Weight matrices corresponding to different orderings.

For functions such as GroebnerBasis and PolynomialReduce, it is necessary that the order be well-founded, which ensures that any decreasing sequence of elements is finite (the elements being the vectors of non-negative exponents). In order for that condition to hold, the first nonzero value in each column of the weight matrix must be positive.

The default sorting used for polynomial terms in an expression corresponds to the negative lexicographic ordering with variables sorted in the reversed order. This is commonly known as reverse lexicographic ordering.

TraditionalForm tries to arrange the terms in an order close to the lexicographic ordering.

The option ParameterVariables tells TraditionalForm which variables should be excluded from the ordering.

One can obtain additional orderings from the six orderings used in MonomialList simply by reversing the resulting list. This is effectively equivalent to negating the exponent vectors. In a commutative setting, one can also obtain other orderings by reversing the order of the variables.

This diagram illustrates the relations between various orderings. Red lines indicate reversing the list of variables and blue lines indicate negating the power vectors.