# 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

\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 $z_i \in \mathbb{C}$ 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 $a_n=1$ for simplicity (this is called a monic polynomial).

Now, if you have the roots, finding the values of the coefficients $a_i$ is straightforward: just expand out the product in Eq. \eqref{eq:factored}. The functions $a_i(z_1, z_2, \ldots, z_n)$ 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 $z_i$’s from the $a_i$’s with some algebraic formula is possible for $n\le 4$ 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 $a_i$ and move it around in a closed loop. If it comes back to where it started, then the set of roots $\{ z_j \}$ have to return to the starting set.

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

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

Hint (spoiler): a really simple choice is to move $a_0$ around the unit circle, if all the other $a_i$’s are close to the origin. Then you should see the n roots $z_j$ 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)? Does it have anything to do with the zeros of the discriminant?

## 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!

1. I’m only considering $a_i \in \mathbb{C}$; things like polynomials over finite fields are trickier!

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

3. I implemented the Aberth-Ehrlich method into the javascript package Polynomial.js, following Dario Bini’s paper and his FORTRAN implementation 2

Tags:

Categories:

Updated: