Finding the Structure of a Polynomial

PolynomialQ[expr,x]test whether expr is a polynomial in x
PolynomialQ[expr,{x1,x2,...}]test whether expr is a polynomial in the
Variables[poly]a list of the variables in poly
Exponent[poly,x]the maximum exponent with which x appears in poly
Coefficient[poly,expr]the coefficient of expr in poly
Coefficient[poly,expr,n]the coefficient of in poly
Coefficient[poly,expr,0]the term in poly independent of expr
CoefficientList[poly,{x1,x2,...}]generate an array of the coefficients of the in poly
CoefficientRules[poly,{x1,x2,...}]get exponent vectors and coefficients of monomials

Finding the structure of polynomials written in expanded form.

Here is a polynomial in two variables.
In[1]:=
Click for copyable input
Out[1]=
This is the polynomial in expanded form.
In[2]:=
Click for copyable input
Out[2]=
PolynomialQ reports that is a polynomial in .
In[3]:=
Click for copyable input
Out[3]=
This expression, however, is not a polynomial in .
In[4]:=
Click for copyable input
Out[4]=
Variables gives a list of the variables in the polynomial .
In[5]:=
Click for copyable input
Out[5]=
This gives the maximum exponent with which appears in the polynomial . For a polynomial in one variable, Exponent gives the degree of the polynomial.
In[6]:=
Click for copyable input
Out[6]=
Coefficient[poly, expr] gives the total coefficient with which expr appears in poly. In this case, the result is a sum of two terms.
In[7]:=
Click for copyable input
Out[7]=
This is equivalent to Coefficient[t, x^2].
In[8]:=
Click for copyable input
Out[8]=
This picks out the coefficient of in .
In[9]:=
Click for copyable input
Out[9]=
CoefficientList gives a list of the coefficients of each power of , starting with .
In[10]:=
Click for copyable input
Out[10]=
For multivariate polynomials, CoefficientList gives an array of the coefficients for each power of each variable.
In[11]:=
Click for copyable input
Out[11]=
CoefficientRules includes only those monomials that have nonzero coefficients.
In[12]:=
Click for copyable input
Out[12]=

It is important to notice that the functions in this tutorial will often work even on polynomials that are not explicitly given in expanded form.

Many of the functions also work on expressions that are not strictly polynomials.

Without giving specific integer values to , , and , this expression cannot strictly be considered a polynomial.
In[13]:=
Click for copyable input
Out[13]=
Exponent[expr, x] still gives the maximum exponent of in expr, but here has to write the result in symbolic form.
In[14]:=
Click for copyable input
Out[14]=
New to Mathematica? Find your learning path »
Have a question? Ask support »