Roots of Polynomial Equations
By Kay Hall

Introduction

This project provides two programs for teachers to use when discussing the roots of polynomial equations.  The first program simply graphs a series of polynomial equations varying by the constant factor,t.  These graphs may be animated while various aspects of the graphs are discussed.  The number of roots, number and location of real roots, and conjugate nature of imaginary roots
are some of the topics that could be discussed.
     The second group of programs graphs the same equations beside a graph of the roots of the equations on the real-imaginary axes.  This enables students to "see" more clearly the location and number of the real roots, the occurrence of double roots,and the location and the conjugate nature of imaginary roots.

Graphing and Animating Polynomial Equations

Clear[f,x]
f[x_]:=x^4 - 4 x^2 + x + t
Table[Plot[f[x],{x,-4,4}, PlotRange->{-10,10}],
      {t,-3.5,6.5}]

Graphing and Animating Polynomials and Their Roots

Clear[f,x,fred,barney,a,t]
f[x_] = x^4 - 4 x^2 + x + t;
Do[
fred := Plot[f[x],{x,-4,4}, 
                     AxesLabel->{"x","y"},
                     PlotRange->{-10,10},
                     DisplayFunction->Identity];
 (*The following line of code will store the solutions 
 of the polynomial equations as a list of approximate 
 numerical values stored in the variable 'sol'*);  
 sol = N[Solve[f[x]==0,x]];
 (*The following line of code does several things:
 first, the Re{x/.sol] will take each element of 
 the list 'sol' and will give the real part of the
 number.  The Im[x/.sol] gives the imaginary part
 of the number.  If the value is a pure real number,
 the output of Im[x/.sol] will be 0.  Using these
 two commands, you end up with a matrix of the
 solutions in a 4X2 format.  The Transpose command
 takes that matrix and transposes it into a 2X4
 format, thus allowing the graphing of the solutions
 as pairs of points on the real-imaginary
 axes.*); 
  
 rts = Transpose[{Re[x/.sol],Im[x/.sol]}];
 
 barney:=ListPlot[rts,
 					PlotStyle->{PointSize[0.04]},
 					AxesLabel->{"Real","Imag"},
 					PlotRange->{{-2.5,2.5},{-5,5}},
 					DisplayFunction->Identity];
 
 Show[GraphicsArray[{fred,barney}],
      Display Function->$Display Function],
                     {t,-3.5,6.5}]

Some More Examples

The commands which produce the display above could easily be modified to display linear, quadratic, cubic, and quintic equations and their roots.  You can modify the function line as indicated in each of the following examples.

Graphing Linear Equations and Their Roots

Clear[f,x,fred,barney,a,t]
f[x_] =  x + t;
Do[
fred := Plot[f[x],{x,-4,4}, 
                     AxesLabel->{"x","y"},
                     PlotRange->{-10,10},
                     DisplayFunction->Identity];
 sol = N[Solve[f[x]==0,x]];
 rts = Transpose[{Re[x/.sol],Im[x/.sol]}];
 barney:=ListPlot[rts,
 					PlotStyle->{PointSize[0.04]},
 					AxesLabel->{"Real","Imag"},
 					PlotRange->{{-4,4},{-5,5}},
 					DisplayFunction->Identity];
 
 Show[GraphicsArray[{fred,barney}],
      Display Function->$Display Function],
                     {t,-3.5,6.5,2}]

Graphing Quadratic Equations and Their Roots

Clear[f,x,fred,barney,a,t]
f[x_] = -4 x^2 + x + t;
Do[
fred := Plot[f[x],{x,-4,4}, 
                     AxesLabel->{"x","y"},
                     PlotRange->{-10,10},
                     DisplayFunction->Identity];
 sol = N[Solve[f[x]==0,x]];
 rts = Transpose[{Re[x/.sol],Im[x/.sol]}];
 barney:=ListPlot[rts,
 					PlotStyle->{PointSize[0.04]},
 					AxesLabel->{"Real","Imag"},
 					PlotRange->{{-1,1},{-4,4}},
 					DisplayFunction->Identity,
 					Ticks->{{-1,-.5,.5,1},
 					{-4,-2,2,4}}];
 
 Show[GraphicsArray[{fred,barney}],
      Display Function->$Display Function],
                     {t,-3.5,6.5,2}]

Graphing Cubic Equations and Their Roots

Clear[f,x,fred,barney,a,t]
f[x_] = x (x-2) (x + 1) + t;
Do[
fred := Plot[f[x],{x,-4,4}, 
                     AxesLabel->{"x","y"},
                     PlotRange->{-10,10},
                     DisplayFunction->Identity];
 sol = N[Solve[f[x]==0,x]];
 rts = Transpose[{Re[x/.sol],Im[x/.sol]}];
 barney:=ListPlot[rts,
 					PlotStyle->{PointSize[0.04]},
 					AxesLabel->{"Real","Imag"},
 					PlotRange->{-5,5},
 					DisplayFunction->Identity];
 
 Show[GraphicsArray[{fred,barney}],
      Display Function->$Display Function],
                     {t,-3.5,6.5,2}]

Graphing Quintic Equations and Their Roots

Clear[f,x,fred,barney,a,t]
f[x_] = x (x-1) (x+1) (x-2) (x +2)+ t;
Do[
fred := Plot[f[x],{x,-4,4}, 
                     AxesLabel->{"x","y"},
                     PlotRange->{-10,10},
                     DisplayFunction->Identity];
 sol = N[Solve[f[x]==0,x]];
 rts = Transpose[{Re[x/.sol],Im[x/.sol]}];
 barney:=ListPlot[rts,
 					PlotStyle->{PointSize[0.04]},
 					AxesLabel->{"Real","Imag"},
 					PlotRange->{{-2,2},{-5,5}},
 					DisplayFunction->Identity];
 
 Show[GraphicsArray[{fred,barney}],
      Display Function->$Display Function],
                     {t,-3.5,6.5}]