Complex polynomial roots toy
Grab the red dots and play around! Or jump to the explanation, or try this.
Explanation
A polynomial in x of degree n has the form
From the fundamental theorem of algebra, there are exactly n roots in the complex plane.^{1} The same polynomial can be written as
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 ncycle.
Try to find a 2cycle (two roots swap places) or other more complicated types of permutations.
What we have here is a map from closed loops in aspace 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 ).
Acknowledgments
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!

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

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

For rootfinding, I implemented the AberthEhrlich 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}