Mathematics

Symmetric polynomials, step by step

An algorithmic proof of the fundamental theorem of symmetric polynomials, with interactive examples from power sums to the discriminant.

11 min read

A polynomial in x1,…,xnx_1, \ldots, x_n is symmetric when permuting the variables leaves it unchanged: x12+x22+x32x_1^2 + x_2^2 + x_3^2 and x1x2x3−1x_1 x_2 x_3 - 1 are, x12x2x_1^2 x_2 is not, since swapping x1x_1 and x2x_2 turns it into x1x22x_1 x_2^2. The fundamental theorem of symmetric polynomials says that, over a field FF, every symmetric polynomial can be written in exactly one way as a polynomial in a few basic ones, the elementary symmetric polynomials e1,…,ene_1, \ldots, e_n:

Sym⁡[Xn]=F[e1,…,en]≅F[y1,…,yn].\begin{aligned} \operatorname{Sym}[X_n] &= F[e_1, \ldots, e_n] \\ &\cong F[y_1, \ldots, y_n]. \end{aligned}

Here XnX_n is the set {x1,…,xn}\{x_1, \ldots, x_n\}, Sym⁡[Xn]\operatorname{Sym}[X_n] is the ring of symmetric polynomials in XnX_n with coefficients in FF, and F[y1,…,yn]F[y_1, \ldots, y_n] is a ring of polynomials in nn new variables. The equality says that every symmetric polynomial is a polynomial in the eie_i; the isomorphism, which sends each yiy_i to eie_i, that it is one in exactly one way.

The usual proof is an algorithm, and a short one. I first implemented it in 2022, in a SageMath archive notebook; here it runs in your browser.

The elementary symmetric polynomials

Fix n∈N+n \in \NN^+, the number of variables. The elementary symmetric polynomial of degree d≥1d \geq 1 is the sum of all the products of dd distinct variables,

ed=∑1≤i1<i2<⋯<id≤nxi1⋯xid⏟d factors,e_d = \sum_{1 \leq i_1 < i_2 < \cdots < i_d \leq n} \underbrace{x_{i_1} \cdots x_{i_d}}_{d \text{ factors}},

and e0=1e_0 = 1. With three variables, for instance,

e1=x1+x2+x3,e2=x1x2+x1x3+x2x3,e3=x1x2x3,\begin{aligned} e_1 &= x_1 + x_2 + x_3, \\ e_2 &= x_1 x_2 + x_1 x_3 + x_2 x_3, \\ e_3 &= x_1 x_2 x_3, \end{aligned}

and ed=0e_d = 0 for every d>nd > n, as there are not enough variables to choose from.

Ordering the monomials

The algorithm needs to know which term of a polynomial comes first. A monomial x1α1⋯xnαnx_1^{\alpha_1} \cdots x_n^{\alpha_n} is written xαx^\alpha, with α=(α1,…,αn)∈Nn\alpha = (\alpha_1, \ldots, \alpha_n) \in \NN^n, and monomials are ordered by the degree lexicographic order (deglex): first by total degree α1+⋯+αn\alpha_1 + \cdots + \alpha_n, then, between monomials of the same degree, by the exponent of x1x_1, then by that of x2x_2, and so on. So x13>x1x22>x23>x12x_1^3 > x_1 x_2^2 > x_2^3 > x_1^2, and in general x1>x2>⋯>xnx_1 > x_2 > \cdots > x_n. The leading term of a non-zero polynomial is its term with the largest monomial, and that monomial is its leading monomial.

Deglex is not just any way of ordering monomials: it is a monomial order, that is, a total order on the monomials such that

  1. it is compatible with multiplication: if xα<xα′x^\alpha < x^{\alpha'}, then xαxγ<xα′xγx^\alpha x^\gamma < x^{\alpha'} x^\gamma for every monomial xγx^\gamma;
  2. it is a well-order: every non-empty set of monomials has a smallest element. Equivalently, there is no infinite strictly decreasing sequence of monomials xα(1)>xα(2)>xα(3)>⋯x^{\alpha^{(1)}} > x^{\alpha^{(2)}} > x^{\alpha^{(3)}} > \cdots.

Deglex has both properties. Multiplying by xγx^\gamma adds the same amount to the degrees of xαx^\alpha and xα′x^{\alpha'} and the same exponents to both, so neither comparison changes. And below any monomial there are only finitely many others, those of degree no larger than its own, so a strictly decreasing sequence has to stop.

The first property is what makes leading terms behave: the leading term of a product is the product of the leading terms. Every other product of a term of gg by a term of hh involves at least one smaller monomial, and multiplying keeps it smaller. The second property is what will make the algorithm stop.

One more fact is specific to symmetric polynomials: their leading monomial has non-increasing exponents, α1≥α2≥⋯≥αn\alpha_1 \geq \alpha_2 \geq \cdots \geq \alpha_n. If xαx^\alpha appears with αi<αi+1\alpha_i < \alpha_{i+1}, swapping xix_i and xi+1x_{i+1} gives another monomial of the polynomial, and a larger one: so xαx^\alpha was not the leading monomial.

Cancelling the leading term

Let ff be symmetric, with leading term c xαc \, x^\alpha. The idea of the proof is to remove this term with a product of elementary symmetric polynomials: to find a finite sequence of exponents b=(b1,…,bn)∈Nnb = (b_1, \ldots, b_n) \in \NN^n such that

eb=e1b1e2b2⋯enbne^b = e_1^{b_1} e_2^{b_2} \cdots e_n^{b_n}

has the same leading monomial xαx^\alpha. Then in f−c ebf - c \, e^b the two leading terms cancel.

Since leading terms multiply, the leading term lt⁡(eb)\operatorname{lt}(e^b) of ebe^b is the product of those of its factors, and the leading term of eke_k is x1x2⋯xkx_1 x_2 \cdots x_k, with coefficient 11. The variable xix_i occurs in it exactly when k≥ik \geq i, so

lt⁡(eb)=∏k=1n(x1x2⋯xk)bk=x1b1+b2+⋯+bn x2b2+⋯+bn⋯xnbn.\begin{aligned} \operatorname{lt}(e^b) &= \prod_{k=1}^{n} (x_1 x_2 \cdots x_k)^{b_k} \\ &= x_1^{b_1 + b_2 + \cdots + b_n} \, x_2^{b_2 + \cdots + b_n} \cdots x_n^{b_n}. \end{aligned}

For this to be xαx^\alpha, the exponents have to match, and bb must solve a triangular system:

α1=b1+b2+⋯+bn,α2=b2+⋯+bn,    ⋮αn=bn.\begin{aligned} \alpha_1 &= b_1 + b_2 + \cdots + b_n, \\ \alpha_2 &= b_2 + \cdots + b_n, \\ &\;\;\vdots \\ \alpha_n &= b_n. \end{aligned}

Subtracting each equation from the one above it leaves bi=αi−αi+1b_i = \alpha_i - \alpha_{i+1}, and the last one gives bn=αnb_n = \alpha_n. So there is exactly one candidate, which we call β(α)\beta(\alpha):

β(α)i={αi−αi+1if 1≤i<n,αiotherwise.\beta(\alpha)_i = \begin{cases} \alpha_i - \alpha_{i+1} & \text{if } 1 \leq i < n, \\ \alpha_i & \text{otherwise.} \end{cases}

It is a valid sequence of exponents, with no negative entries, exactly when α1≥α2≥⋯≥αn\alpha_1 \geq \alpha_2 \geq \cdots \geq \alpha_n, which is what the leading monomial of a symmetric polynomial always satisfies. For instance, with n=3n = 3 and leading monomial x13x2x3x_1^3 x_2 x_3, α=(3,1,1)\alpha = (3, 1, 1) gives β(α)=(2,0,1)\beta(\alpha) = (2, 0, 1), and indeed e12e3=(x1+x2+x3)2 x1x2x3e_1^2 e_3 = (x_1 + x_2 + x_3)^2 \, x_1 x_2 x_3 has leading monomial x12⋅x1x2x3=x13x2x3x_1^2 \cdot x_1 x_2 x_3 = x_1^3 x_2 x_3.

The algorithm

Given a symmetric polynomial ff:

  • if ff is 00 or a constant, it already is a polynomial in the eie_i, and there is nothing to do;
  • otherwise, let c xαc \, x^\alpha be its leading term in deglex, and b=β(α)b = \beta(\alpha). Then ff is c ebc \, e^b plus the expression in the eie_i of f−c ebf - c \, e^b, where ebe^b is expanded in the xix_i; this one is found by running the algorithm again.

The polynomial f−c ebf - c \, e^b is still symmetric, being a difference of symmetric polynomials, and its leading monomial is smaller than xαx^\alpha: the two leading terms cancel, and every other term of ff and of c ebc \, e^b has a smaller monomial. Running the algorithm thus produces symmetric polynomials f0=f,f1,f2,…f_0 = f, f_1, f_2, \ldots whose leading monomials strictly decrease. Deglex being a well-order, such a sequence cannot go on forever: after finitely many steps what is left is 00, and the terms c ebc \, e^b collected along the way add up to ff.

The expression is also unique. Suppose f=P(e1,…,en)=Q(e1,…,en)f = P(e_1, \ldots, e_n) = Q(e_1, \ldots, e_n) for two polynomials P,Q∈F[y1,…,yn]P, Q \in F[y_1, \ldots, y_n]. Their difference R=P−QR = P - Q then satisfies R(e1,…,en)=0R(e_1, \ldots, e_n) = 0, and it is enough to show that this forces R=0R = 0, that is, that no non-zero polynomial vanishes when the eie_i are substituted for its variables (the eie_i are algebraically independent). Write

R=∑b∈Scb yb,R(e1,…,en)=∑b∈Scb eb,\begin{aligned} R &= \sum_{b \in S} c_b \, y^b, \\ R(e_1, \ldots, e_n) &= \sum_{b \in S} c_b \, e^b, \end{aligned}

where S⊂NnS \subset \NN^n is the finite set of exponents whose coefficient cbc_b is not zero, and suppose SS is not empty. Each ebe^b has leading term xα(b)x^{\alpha(b)}, with coefficient 11 and α(b)i=bi+bi+1+⋯+bn\alpha(b)_i = b_i + b_{i+1} + \cdots + b_n, and distinct bb give distinct α(b)\alpha(b), since bb is recovered from α(b)\alpha(b) as β(α(b))\beta(\alpha(b)). Among the finitely many monomials xα(b)x^{\alpha(b)} with b∈Sb \in S there is therefore a largest one, xα(b∗)x^{\alpha(b^*)}, reached by a single b∗∈Sb^* \in S. It occurs in cb∗eb∗c_{b^*} e^{b^*} with coefficient cb∗c_{b^*}; every other ebe^b has only monomials up to its own leading monomial xα(b)x^{\alpha(b)}, which is smaller than xα(b∗)x^{\alpha(b^*)}, so it does not contain xα(b∗)x^{\alpha(b^*)} at all. The coefficient of xα(b∗)x^{\alpha(b^*)} in R(e1,…,en)R(e_1, \ldots, e_n) is then cb∗≠0c_{b^*} \neq 0, against R(e1,…,en)=0R(e_1, \ldots, e_n) = 0. So SS is empty, R=0R = 0, and P=QP = Q.

The calculator below shows each step: the leading term, α\alpha and β(α)\beta(\alpha), and what is left, fif_i. To keep long polynomials readable, they are grouped into orbits: mλm_\lambda is the sum of the distinct monomials whose exponents are a rearrangement of λ\lambda, so that with n=3n = 3

m(2,1)=x12x2+x12x3+x1x22+x22x3+x1x32+x2x32.\begin{aligned} m_{(2,1)} = {} & x_1^2 x_2 + x_1^2 x_3 + x_1 x_2^2 \\ & + x_2^2 x_3 + x_1 x_3^2 + x_2 x_3^2. \end{aligned}

A polynomial is symmetric exactly when it is a combination of the mλm_\lambda, with λ1≥⋯≥λn\lambda_1 \geq \cdots \geq \lambda_n; the calculator lists them from the largest xλx^\lambda down, so the first one contains the leading term. The calculator also computes this way: it never expands a product ebe^b, but multiplies by each eje_j directly on the coefficients of the orbits.

Try it

Write x_1 or x1, with + - * / ^ and brackets; 2x1x2 is a product too. e(k), p(k) and h(k) are the elementary, power sum and complete homogeneous polynomials of degree kk.

The polynomial must be symmetric. If it is not, the algorithm cannot end successfully: if it did, the polynomial would be a combination of symmetric polynomials, and so symmetric itself, ↯. The Not symmetric example shows where it breaks down: sooner or later the leading term has exponents that are not in non-increasing order, β(α)\beta(\alpha) has a negative entry, and no product of the eie_i has that leading term.

Sums of powers

For the power sums pk=x1k+⋯+xnkp_k = x_1^k + \cdots + x_n^k there is a more direct route, the Newton–Girard identities archive. They give pkp_k, for k≥1k \geq 1, in terms of the eie_i and of the previous power sums:

pk=(−1)k+1(k ek+∑i=1k−1(−1)i pi ek−i),p_k = (-1)^{k+1} \Bigl( k \, e_k + \sum_{i=1}^{k-1} (-1)^i \, p_i \, e_{k-i} \Bigr),

where ei=0e_i = 0 for every i>ni > n (and p0=np_0 = n, since xi0=1x_i^0 = 1). Computing p1p_1, then p2p_2, and so on up to pkp_k, each from the ones before it, gives one expression; the general algorithm applied to x1k+⋯+xnkx_1^k + \cdots + x_n^k gives another. By uniqueness they must be the same polynomial, and their difference is indeed zero:

Try it

The discriminant

Now let

f(x)=xn+an−1xn−1+⋯+a0f(x) = x^n + a_{n-1} x^{n-1} + \cdots + a_0

have roots x1,x2,…,xnx_1, x_2, \ldots, x_n in C\CC, each listed as many times as its multiplicity, so that f(x)=(x−x1)⋯(x−xn)f(x) = (x - x_1) \cdots (x - x_n). The discriminant of ff is the product

Δ(f)=∏1≤i<j≤n(xi−xj)2,\Delta(f) = \prod_{1 \leq i < j \leq n} (x_i - x_j)^2,

and it tells whether ff has a repeated root:

∃ i≠j:xi=xj  ⟺  Δ(f)=0.\exists \, i \neq j : x_i = x_j \iff \Delta(f) = 0.

It is easy to check that Δ(f)\Delta(f) is a symmetric polynomial in the roots. Every permutation is a composition of transpositions, so it is enough to check that swapping two roots xix_i and xjx_j leaves it unchanged:

  • the factors that contain neither of them are untouched;
  • the factors that contain only one of them are exchanged in pairs, (xi−xk)2(x_i - x_k)^2 with (xj−xk)2(x_j - x_k)^2, at most with the sign of the base changed, which the square takes away;
  • the factor that contains both changes the sign of its base, (xi−xj)2(x_i - x_j)^2 becoming (xj−xi)2(x_j - x_i)^2, and is unchanged once squared.

So, by the fundamental theorem, Δ(f)\Delta(f) can be written in exactly one way in terms of the elementary symmetric polynomials of the roots. But these are nothing but the coefficients of ff, up to sign: expanding (x−x1)⋯(x−xn)(x - x_1) \cdots (x - x_n) and comparing with ff,

ei(x1,…,xn)=(−1)ian−ie_i(x_1, \ldots, x_n) = (-1)^i a_{n-i}

for 0≤i≤n0 \leq i \leq n, with an=1a_n = 1. Running the algorithm on ∏i<j(xi−xj)2\prod_{i<j} (x_i - x_j)^2 and substituting (−1)ian−i(-1)^i a_{n-i} for each eie_i thus gives the discriminant of every monic polynomial of degree nn in terms of its coefficients, without knowing its roots. For n=2n = 2 it is the familiar Δ=a12−4a0\Delta = a_1^2 - 4 a_0; for n=3n = 3,

Δ=a12a22−4a0a23−4a13+18 a0a1a2−27a02,\begin{aligned} \Delta = {} & a_1^2 a_2^2 - 4 a_0 a_2^3 - 4 a_1^3 \\ & + 18 \, a_0 a_1 a_2 - 27 a_0^2, \end{aligned}

which for x3+px+qx^3 + p x + q reduces to −4p3−27q2-4p^3 - 27q^2.

A polynomial whose leading coefficient ana_n is not 11 has the same roots as f/anf / a_n, which is monic; its discriminant is usually defined as an2n−2 Δ(f/an)a_n^{2n-2} \, \Delta(f / a_n). The factor makes it a polynomial in a0,…,ana_0, \ldots, a_n with integer coefficients, and it is zero exactly when Δ(f/an)\Delta(f / a_n) is.

Below, the formula for the degree of the polynomial you type is computed with the algorithm and then evaluated at its coefficients. The first example, (x−1)2(x+2)=x3−3x+2(x - 1)^2 (x + 2) = x^3 - 3x + 2, has a double root, so its discriminant is zero; the second, (x−1)(x+1)(x+3)=x3+3x2−x−3(x - 1)(x + 1)(x + 3) = x^3 + 3x^2 - x - 3, has three distinct roots, and a discriminant that is not zero.

Try it

Rational coefficients; products and powers are expanded, as in (x - 1)^2 (x + 3).

On this page