The Fundamental Theorem of Algebra
Every non-constant polynomial with complex coefficients has a complex root. This single fact is why every square matrix has an eigenvalue over , why characteristic polynomials always factor completely, and, turned around, how np.roots actually finds roots.
The statement
Fundamental theorem of algebra. If with complex coefficients, and , then has at least one root in .
Applying it repeatedly gives the factored form. If , polynomial division gives with ; now apply the theorem to , and so on:
So a degree- polynomial has exactly complex roots, counted with multiplicity (how many times each factor repeats). Compare with , where has no roots at all: is algebraically closed, is not.
Why it is true (sketch)
There are many proofs; all need some analysis or topology, not just algebra. One intuitive picture uses winding:
- On a huge circle , the leading term dominates, so as goes once around, winds times around 0.
- On a tiny circle (if ), stays near and winds 0 times around 0.
- Shrinking the circle from to changes the winding number from to 0. A winding number can only change when the curve passes through 0, so some has .
Note: The theorem says roots exist, not how to write them. Quadratics, cubics and quartics have formulas with radicals; by the Abel–Ruffini theorem, general polynomials of degree 5 and higher do not. In practice roots are computed numerically.
Real polynomials
If the coefficients are real, non-real roots come in conjugate pairs (see The Complex Numbers). Each pair multiplies to a real quadratic:
So every real polynomial factors into real linear factors and real irreducible quadratics. In particular, a real polynomial of odd degree always has a real root.
from sympy import symbols, factor, roots, expand, I
x = symbols("x")
p = x**4 - 2*x**3 + 6*x**2 - 2*x + 5
print("roots with multiplicity:", roots(p, x))
print("over the reals: ", factor(p))
print("over Q(i): ", factor(p, extension=I))
q = expand((x - 1)**3 * (x + 2))
print(q, "->", roots(q, x))roots with multiplicity: {1 - 2*I: 1, 1 + 2*I: 1, -I: 1, I: 1}
over the reals: (x**2 + 1)*(x**2 - 2*x + 5)
over Q(i): (x - I)*(x + I)*(x - 1 - 2*I)*(x - 1 + 2*I)
x**4 - x**3 - 3*x**2 + 5*x - 2 -> {-2: 1, 1: 3}
SymPy prints x**4 for . The root 1 of has multiplicity 3.
Consequences for matrices
The eigenvalues of an matrix are the roots of its characteristic polynomial , which has degree (Finding Eigenvalues). So:
- Every square complex matrix has at least one eigenvalue and exactly counted with (algebraic) multiplicity. Over this fails: a 90° rotation has none.
- The product of all eigenvalues is and their sum is (compare the coefficients of the factored characteristic polynomial).
- Results such as the spectral theorem and the Cayley-Hamilton theorem start from "pick an eigenvalue", which is only possible because of this theorem.
Roots via eigenvalues
Here the logic runs backwards in numerical practice. Finding roots of a high-degree polynomial is done by building a companion matrix whose characteristic polynomial is , then computing its eigenvalues with the robust QR algorithm. That is exactly what np.roots does.
For monic , one companion matrix has in the first row and ones just below the diagonal.
import numpy as np
coeffs = [1, -2, 6, -2, 5] # z^4 - 2z^3 + 6z^2 - 2z + 5
n = len(coeffs) - 1
C = np.zeros((n, n))
C[0, :] = -np.array(coeffs[1:]) / coeffs[0]
C[1:, :-1] = np.eye(n - 1)
print("companion matrix:\n", C)
ev = np.sort_complex(np.linalg.eigvals(C))
print("eigenvalues:", np.round(ev, 6) + 0)
print("np.roots :", np.round(np.sort_complex(np.roots(coeffs)), 6) + 0)
print("product of roots =", np.round(np.prod(ev), 6), " (= a0 = 5 for even degree)")companion matrix:
[[ 2. -6. 2. -5.]
[ 1. 0. 0. 0.]
[ 0. 1. 0. 0.]
[ 0. 0. 1. 0.]]
eigenvalues: [0.-1.j 0.+1.j 1.-2.j 1.+2.j]
np.roots : [0.-1.j 0.+1.j 1.-2.j 1.+2.j]
product of roots = (5+0j) (= a0 = 5 for even degree)
In software
- Root finding.
np.roots, MATLAB'srootsand most polynomial libraries use companion-matrix eigenvalues. - Control and signal processing. A filter or controller is stable when all roots of its characteristic polynomial lie in the left half-plane (or inside the unit circle for digital filters);
scipy.signalchecks this. - Graphics. Ray–torus intersection is a quartic equation; all four roots exist in and the real positive ones are the hits.
- Recurrences and ODEs. Solving linear recurrences and differential systems starts by finding all roots of a characteristic polynomial, complex ones giving oscillations.
Exercises
Exercise 1: Count the roots
How many complex roots, with multiplicity, does have? Must one of them be real?
Answer
Seven; and yes, at least one is real.
Solution
Degree 7 gives 7 roots with multiplicity. The coefficients are real, so non-real roots pair up; an odd number of roots cannot all be paired, so at least one is real.
Exercise 2: Rebuild from roots
Find the monic real polynomial of smallest degree with roots 2 and .
Answer
.
Solution
Real coefficients force to be a root too. . Multiply by : .
Exercise 3: Eigenvalues of a rotation
Find the eigenvalues of the 90° rotation over , and check them against trace and determinant.
Answer
; , .
Solution
. , .
Exercise 4: Companion matrix (code)
Build a companion matrix for and compute its eigenvalues.
Answer
The eigenvalues are 1, 2, 3, so .
Solution
First row , ones below the diagonal.
import numpy as np
C = np.array([[6.0, -11.0, 6.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
print(np.round(np.sort(np.linalg.eigvals(C).real), 6))[1. 2. 3.]
Test yourself
What does the fundamental theorem of algebra guarantee?
- Every polynomial has a real root
- Every non-constant complex polynomial has a complex root
- Roots can always be written with radicals
- Every polynomial has distinct roots
Why does every real matrix have at least one real eigenvalue?
- Because matrices are invertible
- The characteristic polynomial has odd degree and real coefficients, so it has a real root
- Because the trace is real
- It is false
How does np.roots compute the roots of a polynomial?
- With the quadratic formula repeatedly
- As eigenvalues of a companion matrix
- By bisection on the real line
- Symbolically with radicals