Structural Operations on Polynomials

Expand[poly]expand out products and powers
Factor[poly]factor completely
FactorTerms[poly]pull out any overall numerical factor
FactorTerms[poly,{x,y,}]pull out any overall factor that does not depend on x, y,
Collect[poly,x]arrange a polynomial as a sum of powers of x
Collect[poly,{x,y,}]arrange a polynomial as a sum of powers of x, y,

Structural operations on polynomials.

Here is a polynomial in one variable.
In[1]:=
Click for copyable input
Out[1]=
Expand expands out products and powers, writing the polynomial as a simple sum of terms.
In[2]:=
Click for copyable input
Out[2]=
Factor performs complete factoring of the polynomial.
In[3]:=
Click for copyable input
Out[3]=
FactorTerms pulls out the overall numerical factor from t.
In[4]:=
Click for copyable input
Out[4]=

There are several ways to write any polynomial. The functions Expand, FactorTerms, and Factor give three common ways. Expand writes a polynomial as a simple sum of terms, with all products expanded out. FactorTerms pulls out common factors from each term. Factor does complete factoring, writing the polynomial as a product of terms, each of as low degree as possible.

When you have a polynomial in more than one variable, you can put the polynomial in different forms by essentially choosing different variables to be "dominant". Collect[poly,x] takes a polynomial in several variables and rewrites it as a sum of terms containing different powers of the "dominant variable" x.

Here is a polynomial in two variables.
In[5]:=
Click for copyable input
Out[5]=
Collect reorganizes the polynomial so that x is the "dominant variable".
In[6]:=
Click for copyable input
Out[6]=
If you specify a list of variables, Collect will effectively write the expression as a polynomial in these variables.
In[7]:=
Click for copyable input
Out[7]=
Expand[poly,patt]expand out poly, avoiding those parts which do not contain terms matching patt

Controlling polynomial expansion.

This avoids expanding parts which do not contain x.
In[8]:=
Click for copyable input
Out[8]=
This avoids expanding parts which do not contain objects matching b[_].
In[9]:=
Click for copyable input
Out[9]=
PowerExpand[expr]expand out (ab)^c and (a^b)^c in expr
PowerExpand[expr,Assumptions->assum]
expand out expr assuming assum

Expanding powers and logarithms.

The Wolfram System does not automatically expand out expressions of the form (ab)^c except when c is an integer. In general it is only correct to do this expansion if a and b are positive reals. Nevertheless, the function PowerExpand does the expansion, effectively assuming that a and b are indeed positive reals.

The Wolfram System does not automatically expand out this expression.
In[10]:=
Click for copyable input
Out[10]=
PowerExpand does the expansion, effectively assuming that x and y are positive reals.
In[11]:=
Click for copyable input
Out[11]=
Log is not automatically expanded out.
In[12]:=
Click for copyable input
Out[12]=
PowerExpand does the expansion.
In[13]:=
Click for copyable input
Out[13]=
PowerExpand returns a result correct for the given assumptions.
In[14]:=
Click for copyable input
Out[14]=
Collect[poly,patt]collect separately terms involving each object that matches patt
Collect[poly,patt,h]apply h to each final coefficient obtained

Ways of collecting terms.

Here is an expression involving various functions f.
In[15]:=
Click for copyable input
Out[15]=
This collects terms that match f[_].
In[16]:=
Click for copyable input
Out[16]=
This applies Factor to each coefficient obtained.
In[17]:=
Click for copyable input
Out[17]=
HornerForm[expr,x]puts expr into Horner form with respect to x

Horner form.

Horner form is a way of arranging a polynomial that allows numerical values to be computed more efficiently by minimizing the number of multiplications.

This gives the Horner form of a polynomial.
In[18]:=
Click for copyable input
Out[18]=