Complex polynomial roots toy

Grab the red dots and play around! Or jump to the explanation, or try this.


A polynomial in x of degree n has the form

\begin{align} P(x) = \sum_{i=0}^n a_i x^i . \end{align}

From the fundamental theorem of algebra, there are exactly n roots in the complex plane.1 The same polynomial can be written as

\begin{align} \label{eq:factored} P(x) = a_n (x-z_1)(x-z_2)\cdots(x-z_n) . \end{align}

Let’s set for simplicity (this is called a monic polynomial).

Now, if you have the roots, finding the values of the coefficients is straightforward: just expand out the product in Eq. \eqref{eq:factored}. The functions are known as elementary symmetric polynomials (up to a sign). If you move a root, you can see how all the coefficients change.

Solving for the ’s from the ’s with some algebraic formula is possible for but generally impossible for higher degrees.2 Nonetheless, we can numerically solve for roots with various numerical algorithms.3 If you move a coefficient, your computer will solve for the new locations of the roots, and you can see how they respond.

Things to try

Grab a coefficient and move it around in a closed loop. If it comes back to where it started, then the set of roots have to return to the starting set.

But we can also talk about each individual root’s trajectory as is varied. If moves in a very small loop, so does each .

Now try to find a larger loop for some so that some ’s swap places!

Hint (spoiler): a really simple choice is to move around the unit circle, if all the other ’s are close to the origin. Then you should see the n roots each shift one spot to the left/right around their unit circle. This is an n-cycle.

Try to find a 2-cycle (two roots swap places) or other more complicated types of permutations.

What we have here is a map from closed loops in a-space to permutations of the n roots.

Question: What determines the type of permutation (cycle structure or conjugacy class)? Hint: It has something to do with the zeros of the discriminant. To understand the relationship, check the box to view the discriminant’s roots. When you drag a coefficient , you will see the roots of the discriminant (treated as univariate, holding fixed all other ).


This toy was somewhat inspired by John Baez’s post, which in turn was discussing this tumblr post.

This toy makes use of JSXGraph and my extended version of Polynomial.js.3

Suggestions welcome!

  1. I’m only considering ; things like polynomials over finite fields are trickier! 

  2. Proved by Évariste Galois before his death in a duel at age 20. 

  3. For root-finding, I implemented the Aberth-Ehrlich method into the javascript package Polynomial.js, following Dario Bini’s paper and his FORTRAN implementation. To evaluate the discriminant, I compute the determinant of the Bézout matrix 2