Real Algebraic Geometry

Fourteen ideas from the algorithmic side of real algebraic geometry: how to count, isolate and compare real roots exactly, how polynomials cut space into cells, and how that decides statements with quantifiers. Edit polynomials, drag roots and parameters, step through algorithms, then check yourself with concept questions and practice problems.

Follows the chapter order of S. Basu, R. Pollack and M.-F. Roy, Algorithms in Real Algebraic Geometry, 2nd ed. (Springer, Algorithms and Computation in Mathematics 10, 2006). The modules cover Chapters 1–14; the roadmap algorithms of Chapters 15–16 are not covered. Chapter numbers refer to that book; the questions and examples here are written for this page. Exercises from the book appear at the end of each module, with their numbers from the book and their statements restated in our own words.

Step-throughBasu–Pollack–Roy, Ch. 1: Algebraically Closed Fields

Remainders and elimination over ℂ

Do two polynomials have a common complex root? You can answer without finding a single root: divide, keep the remainder, and repeat. When the coefficients depend on parameters, the same computation describes the set of parameters for which a solution exists, and that is the whole idea behind elimination over C.

The idea

Euclidean division. For polynomials P,Q over a field with Q≠0 there are unique A,R with P=AQ+R and deg⁡R<deg⁡Q. The remainder sequence starts R0=P, R1=Q and continues Ri+1=Rem⁡(Ri−1,Ri) until a remainder is 0. The last nonzero Ri is gcd(P,Q) up to a constant.
Common roots. Because C is algebraically closed, P and Q (not both zero) have a common root in C if and only if deg⁡gcd(P,Q)≥1, and the common roots are exactly the roots of the gcd. In particular P has deg⁡P−deg⁡gcd(P,P′) distinct complex roots.

Every common root of Ri−1 and Ri is a root of Ri+1=Ri−1−AiRi, and conversely, so the common roots never change along the sequence. Only the degrees drop.

Constructible set. A subset of Ck defined by a boolean combination of polynomial equations P=0. In C these are exactly the finite sets and their complements.
Projection theorem. The projection of a constructible subset of Ck+1 to Ck is constructible. Equivalently, every formula built from polynomial equations, ∧,∨,¬ and quantifiers over C is equivalent to a quantifier-free one, and (transfer) a sentence with coefficients in a field K is true in one algebraically closed field containing K exactly when it is true in all of them.

The proof runs the remainder sequence with coefficients that are polynomials in the parameters, branching on whether each leading coefficient vanishes. There are finitely many branches, and each is described by equations and inequations in the parameters.

Not over ℝ. x2+1 and x3+x have gcd x2+1: two common complex roots, no common real root. Real questions need inequalities, which is where the rest of this page goes.

Explore

roots of P roots of Q roots of gcd(P, Q), in the complex plane
Examples

Worked example

For which complex numbers a do P=x2+ax+1 and Q=x2+x+a have a common root? (This is the last example in the explorer.)

  1. Do the first division. What is R2?

    Both are monic of degree 2, so the quotient is 1 and R2=P−Q=(a−1)x+(1−a)=(a−1)(x−1).

  2. The next step depends on a. What happens when a=1?

    Then R2=0, so the gcd is Q=x2+x+1. In fact P=Q: two common roots, the primitive cube roots of unity.

  3. Now take a≠1. Divide Q by R2.

    R2 is a nonzero multiple of x−1, and the remainder of Q on division by a multiple of x−1 is the constant Q(1)=2+a. So R3=2+a.

  4. Finish: describe the set of a with a common root, as a formula without x.

    If a≠1 and a≠−2, R3 is a nonzero constant and the gcd is 1. If a=−2, the gcd is x−1 and the common root is x=1 (check: 1−2+1=0 and 1+1−2=0). So

    ∃x (P(x)=0∧Q(x)=0)⟺(a−1)(a+2)=0.

    The projection of the curve {(a,x):P=Q=0} to the a-line is the finite set {1,−2}: constructible, as the theorem promises. The branches of the computation (a=1, a=−2, the rest) are exactly the cases in the answer.

Check your understanding

Two real polynomials P,Q have gcd(P,Q)=x2+1. What can you conclude?

  1. They have exactly two common roots in C, namely ±i, and no common real root.
  2. They have a common real root.The common roots are the roots of the gcd, and x2+1 has no real roots.
  3. They have no common root at all, since the gcd has no real root.Over C the gcd's roots are common roots of P and Q: divisibility doesn't care which field you look for roots in.
x2+1 divides both, so ±i are common roots, and any common root is a root of the gcd. The gcd test answers the complex question; the real question needs the tools of the next modules.

Which of these subsets of C is constructible?

  1. ZA constructible subset of C is finite or has finite complement. Z is infinite and so is its complement.
  2. C∖{0,1}
  3. The unit circle {z:|z|=1}|z|2=zz¯ is not a polynomial in z. The circle is infinite with infinite complement, so it can't be constructible.
C∖{0,1} is defined by ¬(z(z−1)=0). In one variable a single nonzero polynomial has finitely many roots, which is why constructible subsets of C are finite or cofinite.

Over C, the formula ∃x (x2+a=0) with parameter a is equivalent to which quantifier-free formula?

  1. a≤0There is no order on C to write this with. That is the answer over R.
  2. a≠0a=0 has the solution x=0.
  3. 0=0, that is, "true" for every a
Every complex number has a square root, so the projection is all of C. Over R the answer a≤0 is an inequality: real elimination produces semi-algebraic sets, not constructible ones.

Practice

Counting distinct rootsgcd with the derivative

Let P=x4−2x3+2x−1. Compute gcd(P,P′) and deduce the number of distinct complex roots of P. Then find them.

Hint

Run the remainder sequence of P and P′=4x3−6x2+2, or type both into the explorer. A root of multiplicity m of P is a root of multiplicity m−1 of the gcd.

Solution

gcd(P,P′)=(x−1)2, so P has 4−2=2 distinct roots and 1 is a root of multiplicity 3. Dividing, P=(x−1)3(x+1): the roots are 1 (triple) and −1.

Eliminating a variableA parameter in one polynomial

For which a∈C do x3−a and x2−1 have a common root? Answer with the remainder sequence, then check directly.

Hint

x3−a=x(x2−1)+(x−a).

Solution

The sequence is x3−a, x2−1, x−a, a2−1 (the last is the value of x2−1 at x=a). So there is a common root iff a2=1. Directly: a common root is ±1, and (±1)3=a gives a=±1.

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 1.2Constructible sets on the line

Prove that a constructible subset of C is either finite or the complement of a finite set.

Hint

The class of finite and cofinite subsets of C is closed under the Boolean operations. Which sets are zero sets of one-variable polynomials?

Solution

A constructible set is a finite Boolean combination of sets Zer(P,C) with P∈C[X]. Each such zero set is finite if P≠0 (at most deg⁡P roots) and is all of C if P=0. So the generators are finite or cofinite.

Let B be the family of finite or cofinite subsets of C. It is closed under complement (finite ↔ cofinite), under finite intersections (an intersection is finite if any piece is finite; an intersection of cofinite sets is cofinite) and under finite unions (by De Morgan). So every Boolean combination of the generators lies in B.

Exercise 1.9A quadratic and its derivative

Over C, with P=aX2+bX+c and P′=2aX+b: (a) find the conditions on (a,b,c) for P and P′ to have a common root; (b) find the conditions for P to have a root that is not a root of P′.

Hint

Treat a≠0 and a=0 separately. When a≠0, the only root of P′ is −b/(2a). Don't forget that the zero polynomial vanishes everywhere.

Solution

(a) If a≠0, the root of P′ is −b/(2a), and P(−b/(2a))=c−b2/(4a). So there is a common root iff b2−4ac=0. If a=0 and b≠0, P′=b never vanishes. If a=b=0, P′ is the zero polynomial, so a common root exists iff P=c has a root, iff c=0. Answer:

(a≠0∧b2−4ac=0) ∨ (a=b=c=0).

(b) If a≠0, P has two roots counted with multiplicity; a root that P′ doesn't share exists iff the roots are simple, iff b2−4ac≠0. If a=0,b≠0, P has the root −c/b and P′=b has none: yes. If a=b=0, either P has no root (c≠0) or every point is a root of both (c=0): no. Answer:

(a≠0∧b2−4ac≠0) ∨ (a=0∧b≠0).

InteractiveBasu–Pollack–Roy, Ch. 2: Real Closed Fields

Descartes' law of signs

The signs of the coefficients already bound the number of positive roots. Build a polynomial from its roots, watch the signs of its coefficients, and see why the overcount is always even.

The idea

Real closed field. An ordered field R in which every positive element is a square and every polynomial of odd degree has a root. Equivalently, polynomials over R satisfy the intermediate value theorem. R is one; so are the real algebraic numbers and the field of real Puiseux series (module 4). Everything on this page works over any real closed field.
Sign variations. For a sequence of numbers, Var is the number of sign changes after deleting the zeros. For P=apxp+⋯+a0, write Var⁡(P)=Var⁡(ap,…,a0) and pos⁡(P) for the number of positive roots counted with multiplicity.
Descartes' law of signs. Var⁡(P)≥pos⁡(P), and Var⁡(P)−pos⁡(P) is even.
Budan–Fourier. Let Der⁡(P)=(P,P′,…,P(p)). For a<b, the number Var⁡(Der⁡(P);a)−Var⁡(Der⁡(P);b) is at least the number of roots in (a,b] counted with multiplicity, and the difference is even. Descartes is the case a=0, b=+∞: the signs of P(k)(0) are the signs of the coefficients.

The parity part is easy to see when a0≠0: Var⁡(P) is odd exactly when a0 and ap have opposite signs, which is exactly when P(0) and P(+∞) have opposite signs, which is exactly when P has an odd number of positive roots.

When it is exact. If all roots of P are real, then Var⁡(P)=pos⁡(P). The overcount comes only from non-real roots.

Explore

real roots (drag along the axis) a complex pair (drag the upper one) · P is the monic polynomial with these roots
Examples
Coefficients of P, leading first (⇅ marks a sign change)

Worked example

How many positive and negative roots does P=x3−x2+2 have?

  1. What does Descartes' law say about positive roots?

    The coefficients are 1,−1,0,2, with signs +,−,+ after deleting the zero: Var⁡(P)=2. So P has 2 or 0 positive roots.

  2. Apply it to P(−x) for the negative roots.

    P(−x)=−x3−x2+2 has signs −,−,+: one variation, so exactly one negative root. (One variation can't overcount: the excess would have to be even and nonnegative, and 1−0 is odd.)

  3. Find the negative root and settle the positive ones.

    P(−1)=−1−1+2=0, and P=(x+1)(x2−2x+2). The quadratic has discriminant 4−8<0, so its roots 1±i are not real. P has no positive roots: here Descartes overcounts by 2.

  4. Where do the two "phantom" sign changes come from?

    From the factor x2−2x+2, whose coefficients +,−,+ already have two variations. Its roots 1±i have positive real part, close to the positive axis. Make "A complex pair" in the explorer and drag the pair well into the left half-plane: the phantom variations disappear (close to the imaginary axis they can persist).

Check your understanding

A polynomial of degree 4 has coefficient signs +,−,−,+,− (leading first, none zero). How many positive roots can it have?

  1. Exactly 3Descartes gives an upper bound and a parity. It is exact only when all roots are real.
  2. 3 or 1
  3. 0, 1, 2 or 3The overcount Var−pos is even, so the parity is fixed.
The signs change three times, so pos∈{3,1}. In particular there is at least one positive root, which you can also see from P(0)<0<P(+∞).

How many real roots does x5+1 have?

  1. 0An odd-degree real polynomial always has a real root.
  2. 1
  3. 5Count the variations of P and of P(−x).
  4. 3There are no positive roots and exactly one negative one.
Var⁡(x5+1)=0: no positive roots. Var⁡(−x5+1)=1: exactly one negative root. And 0 is not a root. So there is one real root, −1, and two complex pairs.

P has degree 6, all its roots are real, P(0)≠0, and Var⁡(P)=4. How many negative roots does it have?

  1. Exactly 2
  2. 2 or 0With all roots real Descartes is exact: there are exactly 4 positive roots.
  3. Not enough informationYou know the degree, that 0 is not a root, and the exact number of positive roots.
All roots real gives pos⁡(P)=4, and since 0 is not a root the other 6−4=2 roots are negative.

Practice

One real rootDescartes plus a little calculus

Show that x5−x+1 has exactly one real root, and that it is negative.

Hint

Descartes leaves two possibilities for the positive roots. Rule out 2 by finding the minimum of the polynomial on (0,∞).

Solution

Var⁡(P)=2 and Var⁡(P(−x))=Var⁡(−x5+x+1)=1: one negative root, and 0 or 2 positive ones. On (0,∞), P′=5x4−1 vanishes only at x0=5−1/4≈0.669, where P(x0)=1−45x0≈0.465>0. So P>0 on (0,∞), and the only real root is the negative one.

Budan–Fourier on intervalsCounting in (0, 1] and (1, 2]

For P=x3−3x+1, use Budan–Fourier at x=0,1,2 to show that P has exactly one root in (0,1] and exactly one in (1,2].

Hint

Der⁡(P)=(x3−3x+1, 3x2−3, 6x, 6). A count of 1 is exact, because the excess is even.

Solution

At 0: (1,−3,0,6), signs +,−,+, two variations. At 1: (−1,0,6,6), signs −,+,+, one variation. At 2: (3,9,12,6), no variation. So the bound for (0,1] is 2−1=1 and for (1,2] it is 1−0=1. Each bound is exact: the true count is the bound minus an even number, and it can't be negative, so from 1 it must be 1. (The roots are about 0.347 and 1.532.)

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 2.12When Budan–Fourier is exact

Using the Budan–Fourier theorem, prove: if Var(Der(P);a,b)=0 then P has no root in (a,b]; if it equals 1, then P has exactly one root in (a,b], and that root is simple.

Hint

Budan–Fourier says the variation count is at least the number of roots in (a,b] counted with multiplicity, and the difference is even.

Solution

Write v=Var(Der(P);a,b) and n=num(P;(a,b]), counted with multiplicity. Budan–Fourier gives n≤v and v−n even.

If v=0, then n=0.

If v=1, then n≤1 and n is odd, so n=1. One root counted with multiplicity means one root of multiplicity one: a simple root.

InteractiveBasu–Pollack–Roy, Ch. 2: Real Closed Fields

Sturm sequences

Descartes gives a bound. Sturm's theorem gives the exact number of real roots in any interval: evaluate a short sequence of polynomials at the two endpoints and count sign changes. Drag the endpoints and watch the count follow the roots.

The idea

Sturm sequence. The signed remainder sequence of P and P′: P0=P, P1=P′ and Pi+1=−Rem⁡(Pi−1,Pi), stopping before the first zero remainder. For a point x, Var⁡(x) is the number of sign changes in P0(x),P1(x),…, and at ±∞ one uses the signs of the leading terms.
Sturm's theorem. If a<b (possibly ±∞) are not roots of P, then the number of distinct real roots of P in (a,b) is Var⁡(a)−Var⁡(b).

Why: Var can only change where some Pi vanishes. If Pi(c)=0 with i≥1, then Pi−1(c)=−Pi+1(c)≠0, so the triple Pi−1,Pi,Pi+1 has one sign change on both sides of c. If P(c)=0, then P and P′ have opposite signs just left of a simple root and equal signs just right of it: one change is lost. A multiple root is handled by noticing that every Pi is divisible by gcd(P,P′), the last term.

Cauchy index and Tarski queries. The Cauchy index Ind⁡(Q/P;a,b) counts the jumps of Q/P from −∞ to +∞ minus the jumps from +∞ to −∞ at poles in (a,b). The signed remainder sequence of P and Q computes it the same way. With Q=P′Q0 it gives the Tarski query
TaQ⁡(Q0,P)=∑x∈R, P(x)=0sign⁡Q0(x)=Ind(P′Q0P),

the number of roots of P where Q0>0 minus those where Q0<0. Tarski queries for Q0=1, Q0, Q02 determine how many roots have each sign of Q0. That is the engine of the projection theorem for semi-algebraic sets later in Chapter 2.

Explore

Examples
Drag the endpoints a and b. roots inside (a, b). The vertical scale is compressed, but signs are kept.

Worked example

Locate the real roots of P=x3−3x+1 using its Sturm sequence.

  1. Compute the Sturm sequence.

    P1=3x2−3. Dividing, P=x3(3x2−3)+(−2x+1), so P2=2x−1. Then the remainder of 3x2−3 by 2x−1 is its value at x=12, namely −94, so P3=94.

  2. How many real roots are there?

    At −∞ the signs are −,+,−,+: three changes. At +∞: +,+,+,+, none. So P has 3−0=3 real roots.

  3. How many lie in (0,1)?

    At 0: 1,−3,−1,94, signs +,−,−,+, two changes. At 1: −1,0,1,94, signs −,+,+ after dropping the zero, one change. Exactly 2−1=1 root in (0,1).

  4. Place the other two.

    At 2: 3,9,3,94, no change, so one root in (1,2). At −2: −1,9,−5,94, three changes, so one root in (−2,0). The roots are about −1.879, 0.347, 1.532: pick the first example in the explorer to check.

Check your understanding

x passes a root c of Pi for some i≥1, and P(c)≠0. Why does Var not change?

  1. Because Pi does not change sign at c.It may well change sign. What matters is its two neighbours.
  2. Because Pi−1(c)=−Pi+1(c)≠0, so whatever the sign of Pi, the three of them have exactly one sign change near c.
  3. Because the theorem only counts roots of P.That is what has to be proved: sign changes elsewhere must not disturb the count.
The defining relation Pi−1=AiPi−Pi+1 at a root of Pi gives Pi−1(c)=−Pi+1(c). These are nonzero, since otherwise all later terms would vanish at c, including gcd(P,P′), and c would be a root of P.

The Sturm sequence of x2+1 is x2+1, 2x, −1. What is Var⁡(−∞)−Var⁡(+∞)?

  1. 0
  2. 2At −∞ the signs are +,−,−, only one change.
  3. 1At +∞ the signs are +,+,−, which also has one change.
One change at each end, so no real roots, as expected. Note that Var itself need not be 0 at the ends; only the difference counts.

P=x3−x and Q=x. What is the Tarski query TaQ⁡(Q,P)?

  1. 3That's TaQ⁡(1,P), the number of real roots.
  2. 2The root 0 contributes sign⁡Q(0)=0, and −1 contributes −1.
  3. 0
The roots are −1,0,1, where Q has signs −,0,+. The sum is 0: one root with Q>0, one with Q<0. Together with TaQ⁡(1,P)=3 and TaQ⁡(Q2,P)=2 this pins down the counts 1,1,1.

Practice

A Sturm sequence by handDegree 4

Compute the Sturm sequence of x4−2x2−1 and use it to count the real roots.

Hint

P=x4(4x3−4x)−(x2+1).

Solution

The sequence is x4−2x2−1, 4x3−4x, x2+1, 8x, −1. Signs at −∞: +,−,+,−,−, three changes. At +∞: +,+,+,+,−, one change. So there are 2 real roots, ±1+2.

Signs of Q at the roots of PThree Tarski queries

Let c+,c−,c0 be the numbers of real roots of P=x3−3x+1 at which Q=x is positive, negative, zero. Express TaQ⁡(1,P), TaQ⁡(Q,P), TaQ⁡(Q2,P) in terms of them and solve, given that these queries are 3,1,3.

Hint

Each root contributes sign⁡Q, sign⁡Q2 or 1 to the sums.

Solution

c++c−+c0=3, c+−c−=1, c++c−=3. So c0=0, c+=2, c−=1, matching the roots −1.879, 0.347, 1.532. The matrix of this linear system is invertible, which is why sign determination works for any number of polynomials (by taking tensor powers of it).

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 2.13The sign matrix Ms is invertible

Let M1=(11101−1011) and Mt+1=Mt⊗M1. Prove by induction that Ms is invertible.

Hint

(A⊗B)(C⊗D)=AC⊗BD.

Solution

detM1=1⋅(1⋅1−(−1)⋅1)=2≠0, so M1 is invertible.

If Mt is invertible, then (Mt−1⊗M1−1)(Mt⊗M1)=I⊗I=I, so Mt+1 is invertible with inverse Mt−1⊗M1−1. (Equivalently, det(A⊗B)=det(A)mdet(B)n for A of size n and B of size m, giving detMs=2s3s−1.)

InteractiveBasu–Pollack–Roy, Ch. 2: Real Closed Fields · Ch. 3: Semi-Algebraic Sets

Infinitesimals and Puiseux series

Many algorithms in this subject perturb a problem by an infinitely small ε to make it generic. The roots of the perturbed polynomial are Puiseux series in ε, and a picture called the Newton polygon reads off how big each root is.

The idea

Puiseux series. Series a=∑i≥i0aiεi/q with a fixed positive integer q and coefficients in R. Those that are algebraic over R(ε) form a field R⟨ε⟩. It is ordered by the sign of the leading coefficient ai0, so ε>0 but ε<r for every positive r∈R: ε is infinitesimal.
Theorem. If R is real closed, so is R⟨ε⟩, and C⟨ε⟩=R⟨ε⟩[i] is algebraically closed. So every polynomial in x with coefficients in R[ε] factors into linear terms over Puiseux series.

An element is bounded over R when it has no negative exponents. Then its constant term is its limit limεa∈R. This is how algorithms come back from a perturbed problem to the original one.

Germs (Ch. 3). A Puiseux series can be read as the germ at 0+ of a continuous semi-algebraic function t↦f(t), with ε standing for t itself. A statement holds in R⟨ε⟩ exactly when it holds for all small enough positive t. That is what the log–log plot below shows numerically.
Newton polygon. Write P=∑aijεixj and mark the points (j,i) with aij≠0. Each edge of the lower convex hull, of slope −q and width ℓ, accounts for ℓ roots of order εq. Their leading coefficients are the nonzero roots c of the edge equation ∑(j,i) on the edgeaijcj=0.

Reason: substitute x=cεq. The terms on the edge all have the same, lowest, power of ε, so they must cancel among themselves.

Explore

P(ε, x)
Newton polygon: a dot for each term εixj, with its coefficient. lower edges
|roots| against ε, both on log scales. real complex predicted |c|·εq

Worked example

Find the orders and leading terms of the roots of P=x3−εx2−ε4, and decide which roots lie in the real closed field R⟨ε⟩.

  1. Plot the Newton points and find the lower hull.

    The terms give the points (3,0), (2,1), (0,4). The lower hull runs (0,4)→(2,1)→(3,0), with slopes −32 and −1. (The slopes increase, so the hull is convex there.)

  2. What does each edge predict?

    Edge (0,4)–(2,1): width 2, so two roots of order ε3/2. Edge (2,1)–(3,0): width 1, one root of order ε.

  3. Solve the edge equations.

    First edge: the terms −εx2 and −ε4 give −c2−1=0, so c=±i. Second edge: x3 and −εx2 give c3−c2=0, nonzero root c=1.

    x1=ε+⋯,x2,3=±iε3/2+⋯
  4. Which roots are real Puiseux series? Are they infinitesimal?

    Only x1: the other two are complex conjugates. x1 is positive and infinitesimal, with limεx1=0. Numerically at ε=10−3 the roots are about 0.001001 and −5⋅10−7±3.16⋅10−5i, and ε3/2≈3.16⋅10−5.

Check your understanding

In R⟨ε⟩, which is larger: ε1/2 or 1000ε?

  1. ε1/2
  2. 1000εCompare leading terms: a smaller exponent beats any constant factor.
  3. It depends on the value of ε.ε is not a number to plug in; the order is decided by the leading term of the difference.
ε1/2−1000ε=ε1/2(1−1000ε1/2) has leading coefficient 1>0. As a germ: for all small enough t>0, t>1000t.

Which of these elements is bounded over R, and what is its limit?

  1. 1/εIt is larger than every real number.
  2. 2+ε1/3, with limit 2
  3. ε−1/2+3A negative exponent makes it unbounded.
Bounded means no negative exponents; the limit is the constant term. Taking limε of a perturbed solution is how one recovers a solution of the unperturbed problem.

What are the orders of the two roots of ε2x2+x+1?

  1. ε0 and ε−2
  2. ε0 and ε2The second edge goes up from (1,0) to (2,2): positive slope, so the exponent is negative and the root is large.
  3. Both of order ε−1The polygon has two edges with different slopes.
Edges (0,0)–(1,0) (slope 0, edge equation c+1=0) and (1,0)–(2,2) (slope 2, edge equation c2+c=0). So the roots are about −1 and −ε−2; their product is ε−2, as it should be.

Practice

Two terms of each rootBeyond the leading term

Find the first two nonzero terms of both roots of x2−2εx−ε. Which is positive?

Hint

The quadratic formula works in a real closed field. Expand ε+ε2=ε1/2(1+ε)1/2.

Solution

x=ε±ε+ε2=±ε1/2+ε±12ε3/2+⋯. The Newton polygon has one edge (0,1)–(2,0) (the point (1,1) lies above it), predicting ±ε1/2. The root ε1/2+ε+⋯ is positive and the other negative; both are infinitesimal.

Signs and sizesWorking in the ordered field

Decide the sign of −ε3+106ε4 and of ε−ε2ε2+ε3, and say whether each is infinitesimal, bounded but not infinitesimal, or unbounded.

Solution

−ε3+106ε4=ε3(−1+106ε): negative and infinitesimal, whatever the size of 106. The fraction equals ε−1(1−ε)(1+ε)−1=ε−1−2+2ε−⋯: positive and unbounded.

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 2.4The order 0+ on F(ε)

On the field of rational functions F(ε) over an ordered field F, the order 0+ declares f>0 when f(t)>0 for all small enough t>0. Show this is an order, and that it is the only order on F(ε) in which ε is infinitesimal (positive and smaller than every positive element of F).

Hint

Write f=εkg/h with g(0),h(0)≠0. Show that in any order where ε is infinitesimal, the sign of a polynomial g with g(0)≠0 is the sign of g(0).

Solution

Every nonzero f can be written f=εkg/h with k∈Z and polynomials g,h not divisible by ε.

0+ is an order. Under 0+, f>0 iff g(0)h(0)>0, because g(t),h(t) keep the signs of g(0),h(0) for small t and tk>0. Exactly one of f>0, f=0, −f>0 holds. Sums and products of functions positive on some (0,η) are positive on a smaller interval. So the positive cone is closed under + and × and is a total order. And ε is infinitesimal: 0<t<r for small t, for each r>0 in F.

Uniqueness. Fix any order in which ε is infinitesimal. Then every εj with j≥1 is infinitesimal too (0<εj≤ε once ε<1), and so is any finite sum ∑j≥1cjεj (bound each term by r/N). For a polynomial g with g(0)≠0, g(ε)=g(0)+∑j≥1gjεj, and the sum is smaller in absolute value than |g(0)|, so g(ε) has the sign of g(0). Since εk>0, the sign of f is the sign of g(0)h(0): the same as under 0+.

Exercise 2.19Puiseux series form a field

Prove that the Puiseux series K⟨⟨ε⟩⟩ — series ∑i≥kaiεi/q with k∈Z, q≥1 — form a field.

Hint

For a fixed q these are Laurent series in ε1/q. Two series can always be written with a common q. For inverses, factor out the leading term and use a geometric series.

Solution

K⟨⟨ε⟩⟩=⋃q≥1K((ε1/q)), and K((ε1/q))⊂K((ε1/qq′)). Any two elements lie in a common K((ε1/N)) (take N=qq′). So it suffices that each K((u)), u=ε1/N, is a field; then the union of this increasing chain of fields is a field.

In K((u)), sums are termwise, and the product (∑i≥kaiui)(∑j≥lbjuj) has coefficient of un equal to the finite sum ∑i+j=naibj (i≥k, j≥l). Ring axioms follow as for polynomials.

Inverse: a nonzero a=akuk(1+w) with ak≠0 and w∈uK[[u]]. The series ∑n≥0(−w)n makes sense because wn has order at least n, so each coefficient receives only finitely many contributions, and it inverts 1+w (the telescoping product has every coefficient of positive order cancelling). So a−1=ak−1u−k∑n(−w)n.

InteractiveBasu–Pollack–Roy, Ch. 4: Algebra

Discriminants and Hermite's form

Whether a cubic has one real root or three is decided by the sign of a single polynomial in its coefficients. Hermite's quadratic form goes further, in every degree: its rank counts the distinct complex roots and its signature the distinct real ones. Drag the cubic across its discriminant curve and watch two real roots collide and leave the real line.

The idea

Discriminant. If P=ap∏i=1p(x−xi) over C, then Disc⁡(P)=ap2p−2∏i<j(xi−xj)2. It is a polynomial in the coefficients of P and vanishes exactly when P has a multiple root. For x3+px+q it is −4p3−27q2.

For real P with distinct roots, each pair of conjugate roots z,z¯ contributes (z−z¯)2=(2iIm⁡z)2<0, and all the other factors pair up into positive numbers. So sign⁡Disc⁡(P)=(−1)#conjugate pairs.

Resultant and subresultants. Res⁡(P,Q) is the determinant of the Sylvester matrix of P and Q; it vanishes iff they have a common root (or both leading coefficients vanish). Disc⁡(P)=(−1)p(p−1)/2Res⁡(P,P′)/ap. The subresultant coefficients sResj are certain minors of the same matrix, and deg⁡gcd(P,Q) is the smallest j with sResj≠0.
Hermite's quadratic form. With Newton sums Nk=∑ixik (roots counted with multiplicity), Her⁡(P) is the form on polynomials f of degree <p
Her⁡(P)(f)=∑i=1pf(xi)2,matrix (Nj+k)0≤j,k<p.

The Nk are rational functions of the coefficients (Newton's identities), so the matrix is computable without the roots.

Hermite's theorem. The rank of Her⁡(P) is the number of distinct roots of P in C, and its signature is the number of distinct roots in R.

Each distinct real root x contributes the square f(x)2 of a real linear form. A conjugate pair contributes f(z)2+f(z¯)2=2(Re⁡f(z))2−2(Im⁡f(z))2: one positive and one negative square. The forms for distinct roots are independent (a Vandermonde argument).

Explore

The cubic x³ + px + q as a point (p, q). Drag it. Disc = 0, a cusp. The point snaps onto the curve when close.
Its roots in the complex plane. real complex

Worked example

Write down Hermite's form for P=x2+bx+c and check the theorem in every case.

  1. Compute N0,N1,N2.

    N0=2 (the degree), N1=x1+x2=−b, and N2=(x1+x2)2−2x1x2=b2−2c.

  2. Write the matrix and its determinant.

    Her⁡(P)=(2−b−bb2−2c),det=2b2−4c−b2=b2−4c=Disc⁡(P).
  3. Find the signature when b2−4c>0 and when b2−4c<0.

    The top-left entry is 2>0. If det>0, both eigenvalues are positive: signature 2, two real roots. If det<0, the eigenvalues have opposite signs: signature 0, rank 2, two complex roots.

  4. And when b2=4c?

    det=0 and the entry 2 is nonzero, so the rank is 1 and the signature 1: one distinct root, and it is real (the double root −b/2).

Check your understanding

A real cubic has Disc<0. What are its roots like?

  1. One real root and a pair of complex conjugate roots.
  2. Three real roots, one of them double.A multiple root makes the discriminant 0, not negative.
  3. No real roots.An odd-degree real polynomial always has a real root.
The sign is (−1)#pairs: negative means exactly one conjugate pair. In the explorer, the unshaded region is Disc<0.

P has degree 4 and roots 1,1,i,−i. What are the rank and signature of Her⁡(P)?

  1. Rank 4, signature 2Both numbers count distinct roots: multiplicity doesn't add anything.
  2. Rank 3, signature 1
  3. Rank 3, signature 2The double root 1 is one distinct real root.
Distinct complex roots: 1,i,−i, so rank 3. Distinct real roots: just 1, so signature 1. The form is 2f(1)2+f(i)2+f(−i)2, and the pair gives one positive and one negative square.

A real polynomial of degree 4 with distinct roots has Disc>0. What can you conclude?

  1. All four roots are real.Two conjugate pairs also give (−1)2=+1.
  2. It has either 4 or 0 real roots.
  3. It has exactly 2 real roots.That is one conjugate pair, which makes the discriminant negative.
The sign only records the parity of the number of conjugate pairs. To tell 4 from 0 you need more, for instance the signs of further subdiscriminants (the other principal minors of the Hermite matrix), or its signature.

Practice

The discriminant as a resultantA 3 × 3 Sylvester determinant

For P=ax2+bx+c, compute Res⁡(P,P′) as the determinant of the Sylvester matrix and compare with b2−4ac.

Hint

The rows are the coefficients of P (once, since deg⁡P′=1) and of P′=2ax+b (twice, shifted).

Solution
det(abc2ab002ab)=ab2−2ab2+4a2c=−a(b2−4ac).

With p=2, (−1)p(p−1)/2Res⁡(P,P′)/a=b2−4ac, the familiar discriminant.

Hermite's form of x⁴ − 1A 4 × 4 Hankel matrix

Compute the Newton sums N0,…,N6 of x4−1, write Her⁡(P), and find its rank and signature.

Solution

The roots are ±1,±i, so Nk=4 if 4∣k and 0 otherwise: N0=N4=4, the rest 0. The matrix has 4 at positions (0,0), (2,2), (1,3), (3,1). Its eigenvalues are 4,4,4,−4: rank 4 (four distinct roots), signature 2 (two real roots).

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 4.1Which sign conditions on a,s,δ happen?

For P=X4+aX2+bX+c, let s=8ac−9b2−2a3 and δ=256c3−128a2c2+144ab2c+16a4c−27b4−4a3b2 (the discriminant). Find all sign conditions on (a,s,δ) whose realisation in (a,b,c)-space is non-empty.

Hint

Three tools: a=0 forces s=−9b2≤0; the root count from the signed subresultant table can't be negative; and δ<0 means exactly two real roots, while δ>0 means zero or four. Then exhibit a point for each remaining case (scaling X↦λX lets you take a∈{−1,0,1}).

Solution

Of the 27 sign conditions, 20 are realised:

  • a<0: s>0 with each sign of δ; s<0 with each sign of δ; s=0 with δ<0 or δ=0. (8 conditions.)
  • a=0: s<0 with each sign of δ; s=0 with each sign of δ. (6.)
  • a>0: s<0 with each sign of δ; s=0 with δ>0 or δ=0; s>0 with δ>0. (6.)

The seven empty ones. a=0,s>0 (three conditions): s=−9b2≤0. a>0,s>0,δ<0 and a>0,s>0,δ=0: the subresultant count gives −2 and −1 real roots, impossible. a>0,s=0,δ<0: count 0, but δ<0 forces two real roots. a<0,s=0,δ>0: count 2, but δ>0 forces 0 or 4.

Witnesses (a few; the rest come from a perturbation of these or random sampling). a=1,b=0,c=1: s=6,δ=144. X4+aX2+a2/4=(X2+a/2)2 gives s=δ=0 for any a≠0. a=0,b=0 gives s=0 and δ=256c3 of any sign. a=1,b=0,c=0: s=−2<0, δ=0. For a=−1, s=0 is the curve c=−(9b2−2)/8, on which δ changes sign at b≈±0.544 and is negative near b=0 apart from b=0 itself, giving s=0,δ<0 and s=0,δ=0.

InteractiveBasu–Pollack–Roy, Ch. 5: Decomposition of Semi-Algebraic Sets

Cylindrical decomposition

Any finite family of polynomials cuts Rk into finitely many cells on which each polynomial has constant sign, stacked in cylinders over a decomposition of Rk−1. In the plane you can watch the whole construction: project to find the critical values, cut the line, lift.

The idea

Semi-algebraic set. A subset of Rk defined by a boolean combination of conditions P>0 and P=0 with polynomials P.
Cylindrical decomposition. A sequence of partitions of R1,R2,…,Rk into cells. In R1 the cells are points and open intervals. Over each cell C of Ri there are continuous semi-algebraic functions ξ1<⋯<ξℓ on C, and the cells of Ri+1 above C are their graphs (sections) and the bands between consecutive ones (sectors, with ξ0=−∞, ξℓ+1=+∞). It is adapted to a family P if every P∈P has constant sign on every cell.
Theorem. Every finite family of polynomials has an adapted cylindrical decomposition. Hence every semi-algebraic set is a finite union of cells.

In the plane, with P,Q∈R[x][y]: over an interval of x avoiding the real roots of the following, the real roots in y move continuously and keep their number and order:

  • the leading coefficients in y (a root escapes to infinity),
  • the discriminants in y (two roots of the same polynomial meet),
  • the resultant of P and Q in y (a root of P meets a root of Q).

In higher degree the projection uses all the subresultant coefficients, which also detect, say, when two roots become a double root before turning complex. Then one recurses on the polynomials in x.

Consequences. A semi-algebraic set has finitely many connected components, each semi-algebraic; its dimension is the largest dimension of a cell in it; closed and bounded ones can be triangulated (all in Ch. 5).

Explore

P = 0 Q = 0 · dashed lines: the critical values ξ · dots: one sample point per cell (bigger dots are 0-cells). Point at a cell to highlight it.
Polynomials

Worked example

Build a cylindrical decomposition of R2 adapted to P=x2+y2−1, count its cells, and describe the closed disk P≤0 as a union of cells.

  1. Project: which values of x are critical?

    The leading coefficient in y is 1, with no roots. The discriminant in y of y2+(x2−1) is −4(x2−1), with roots x=±1. So the line is cut into (−∞,−1), {−1}, (−1,1), {1}, (1,∞).

  2. Lift: how many cells lie over each of the five?

    Over |x|>1: no roots in y, so one cell (the whole strip). Over x=±1: one root y=0, so three cells (a point and two vertical half-lines). Over (−1,1): two roots ±1−x2, so five cells (three sectors, two arcs). In all 1+3+5+3+1=13.

  3. Which cells make up the closed disk?

    The two points (±1,0), the lower and upper open arcs over (−1,1), and the sector between them: five cells, on each of which P≤0.

  4. A check that comes back in the next module: add up (−1)dim over these cells.

    2 points −2 arcs +1 open disk =1, the Euler characteristic of a closed disk. For the circle alone (points and arcs) you get 0.

Check your understanding

Why does the projection of {P,Q} include the resultant of P and Q in y?

  1. To find the vertical asymptotes.Roots escaping to infinity are detected by the leading coefficients.
  2. To find where the curve P=0 has a vertical tangent or a singular point.Those come from the discriminant of P.
  3. At its roots a root of P can meet a root of Q in the fiber, which changes the order of roots and the sign pattern.
Without it, over an interval the curves of P and Q could cross, and a sector above that interval would contain points where Q has different signs. Try "Circle and line": the crossings sit exactly over roots of the resultant. Its roots can also be harmless, for example where the common root in y is not real: try "Two circles" with the circles apart.

What are the dimension and the number of connected components of {x2+y2<1}∪{(2,0)}?

  1. Dimension 2, two components
  2. Dimension 2, one componentThe point (2,0) is not connected to the disk.
  3. It has no well-defined dimension, because it mixes a disk and a point.The dimension is the largest dimension of a cell, here 2.
A cylindrical decomposition adapted to x2+y2−1 and (x−2)2+y2 shows the set as a union of one 2-cell and one 0-cell. Connected components are unions of cells.

Over an open interval of the x-axis the curves have 3 points above every x. How many cells of the decomposition lie above that interval?

  1. 3Those are the sections; the bands between them are cells too.
  2. 4Those are the sectors; the curves themselves are cells too.
  3. 7
3 sections (1-dimensional) and 4 sectors (2-dimensional): 2ℓ+1 cells for ℓ roots.

Practice

A parabola and a lineCounting cells

Build a decomposition adapted to P=y−x2 and Q=y−1. How many cells are there, and what happens to the order of the two roots in each fiber?

Solution

Both are of degree 1 in y with constant leading coefficients; the resultant is ±(x2−1), so the critical values are ±1. Over the three open intervals there are two roots (y=x2 and y=1), giving 5 cells each; over x=±1 the roots coincide, giving 3 cells each. Total 15+6=21. For |x|>1 the line is below the parabola, for |x|<1 above it.

Why leading coefficients matterA root running away

For P=xy−1, find the projection, the cells, and explain what goes wrong if you don't cut the x-axis at 0.

Solution

The leading coefficient in y is x, with root 0 (there is no discriminant for degree 1). Over x≠0 there is one root y=1/x: 3 cells over each half-line; over x=0 there is none: 1 cell. Total 7. Over all of R the number of roots is not constant, because the root escapes to infinity as x→0, so no single stack of cells would work.

Draw it yourselfBasu–Pollack–Roy, Ch. 6: Elements of Topology

Homology and the Euler characteristic

Betti numbers count components, independent loops and cavities. For a space built from triangles they come from linear algebra, and their alternating sum is V−E+F. Build complexes on the grid and watch the numbers.

The idea

Simplicial homology. For a simplicial complex K, the chain space Ci is the Q-vector space with a basis of oriented i-simplices. The boundary map is ∂[v0v1]=v1−v0, ∂[v0v1v2]=[v1v2]−[v0v2]+[v0v1], and so on, with ∂∘∂=0. Then Hi(K)=ker⁡∂i/im⁡∂i+1 and bi=dim⁡Hi.

b0 is the number of connected components; b1 the number of independent loops that do not bound; b2 the number of enclosed cavities.

Euler–Poincaré. χ(K)=∑i(−1)i#{i-simplices}=∑i(−1)ibi. This is rank–nullity applied to each ∂i.
For semi-algebraic sets. A closed and bounded semi-algebraic set has a semi-algebraic triangulation (Ch. 5), and its homology is defined through it. It doesn't depend on the triangulation, and it is invariant under semi-algebraic homotopy equivalence. For sets that are only locally closed, Borel–Moore homology gives an Euler characteristic that is additive: χ(S)=∑C(−1)dim⁡C over the cells of any decomposition. So χ(point)=1 and χ(open interval)=−1.
Mayer–Vietoris. For closed A,B: χ(A∪B)=χ(A)+χ(B)−χ(A∩B), coming from a long exact sequence relating the homology of A, B, A∩B and A∪B.

Explore

Click or drag across triangles to fill them; click close to an edge or a vertex to add just that. Clicking something already there removes it, with everything it is a face of.
Start from

Worked example

Compute the homology of the boundary of a triangle (vertices a,b,c, edges ab,bc,ca), then of the filled triangle.

  1. Write the matrix of ∂1:C1→C0 and find its rank.

    ∂[ab]=b−a, ∂[bc]=c−b, ∂[ca]=a−c. The three images add to 0, and any two are independent, so the rank is 2.

  2. Deduce b0 and b1 for the boundary.

    b0=dim⁡C0−rank⁡∂1=3−2=1. b1=dim⁡ker⁡∂1=3−2=1 (there is no ∂2), spanned by the cycle [ab]+[bc]+[ca]. It is a circle.

  3. Add the 2-simplex [abc]. What changes?

    ∂[abc]=[bc]−[ac]+[ab]=[ab]+[bc]+[ca], exactly the cycle. So im⁡∂2 kills it: b1=0. And ker⁡∂2=0, so b2=0. A disk.

  4. Check Euler–Poincaré both times.

    Boundary: 3−3=0=1−1. Filled: 3−3+1=1=1−0+0. Draw both in the explorer (the "Circle" and "Disk" starts give bigger versions of the same thing).

Check your understanding

A connected graph has 7 vertices and 9 edges. What is b1?

  1. 2For a graph χ=V−E=b0−b1, with b0=1.
  2. 3
  3. 9Edges in a spanning tree don't create loops.
b1=b0−χ=1−(7−9)=3. A spanning tree uses 6 edges, and each of the other 3 closes one independent loop.

With the additive (Borel–Moore) Euler characteristic, what is χ of the open interval (0,1)?

  1. 1That's the closed interval. The additive χ is not a homotopy invariant for sets that aren't closed and bounded.
  2. −1
  3. 0Use additivity: [0,1] is two points and the open interval.
χ([0,1])=1=χ({0})+χ({1})+χ((0,1))=2+χ((0,1)). In general an open d-cell has χ=(−1)d, which is what makes χ computable from a cylindrical decomposition.

The boundary of a tetrahedron is a triangulation of the sphere S2. What is χ(S2)?

  1. 2
  2. 0Count: 4 vertices, 6 edges, 4 triangles.
  3. 1That's the disk. The sphere has b2=1: the cavity inside.
4−6+4=2=b0−b1+b2=1−0+1. A complex in the plane, like the ones in the explorer, can never enclose a cavity, so there b2=0.

Practice

The annulus by Mayer–VietorisGluing two contractible pieces

Write the closed annulus 1≤x2+y2≤4 as the union of its upper half A (y≥0) and lower half B (y≤0). Find χ and b1.

Solution

A and B are contractible, so χ=1 each. A∩B is two disjoint segments on the x-axis, χ=2. So χ(A∪B)=1+1−2=0. The annulus is connected, so b1=b0−χ=1 (and b2=0).

χ from cellsOpen disk, closed disk, circle

Using the 13-cell decomposition of the worked example in the previous module, compute the additive χ of the open disk, the circle, and the closed disk, and check that the first two add up to the third.

Solution

Open disk: one 2-cell, χ=1. Circle: two points and two arcs, χ=2−2=0. Closed disk: all five, χ=1. Indeed 1+0=1. (For the open disk, 1 agrees with χBM(R2)=(−1)2.)

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 6.1Homology of a punctured disk

Let D be the punctured open disk X2+Y2−1<0∧X2+Y2>0. Prove H0(D)=Q, H1(D)=Q, H2(D)=0.

Hint

D semi-algebraically deformation retracts onto a circle, and homology is a semi-algebraic homotopy invariant. Then triangulate the circle.

Solution

The map r(x)=x/(2|x|) is continuous and semi-algebraic on D (|x|=X2+Y2 is semi-algebraic), and H(x,t)=(1−t)x+tr(x) stays in D for t∈[0,1]. So D is semi-algebraically homotopy equivalent to the circle C of radius 1/2, and H∗(D)≅H∗(C).

C is semi-algebraically homeomorphic to the boundary of a triangle: three vertices v0,v1,v2 and three edges. With ∂[vivj]=vj−vi, the boundary map C1→C0 has rank 2, so H0=Q3/Q2=Q and H1=ker⁡∂1≅Q, spanned by [v0v1]+[v1v2]+[v2v0]. There are no 2-simplices, so H2=0.

Exercise 6.3Borel–Moore homology of the punctured plane

Let D=R2∖{0}. Compute its Borel–Moore homology, defined as H∗(Dr―,Dr―∖Dr) with Dr=D∩B(0,r) for large r.

Hint

Dr― is the closed disk and Dr―∖Dr is the boundary circle together with the origin. Use the long exact sequence of the pair.

Solution

Let K be the closed disk of radius r and A=S1⊔{0}. K is contractible, H0(A)=Q2, H1(A)=Q. The long exact sequence

0→H2(K,A)→H1(A)→H1(K)=0→H1(K,A)→H0(A)→H0(K)→H0(K,A)→0

gives H2(K,A)≅Q. The map H0(A)=Q2→H0(K)=Q is onto with kernel Q, so H1(K,A)≅Q and H0(K,A)=0.

So H0BM(D)=0, H1BM(D)=Q, H2BM(D)=Q. This matches Poincaré duality for the open cylinder D≅S1×R: HiBM≅H2−i. (The printed statement lists H0BM=Q; the computation above shows it is 0, as for any connected non-compact manifold.)

Interactive sweepBasu–Pollack–Roy, Ch. 7: Quantitative Semi-algebraic Geometry

Morse theory and Betti number bounds

How complicated can the zero set of a polynomial of degree d be? Sweep a line across a curve: the topology of the part already swept changes only at critical points of the sweep. Counting those points bounds the Betti numbers, and Bézout's theorem counts them.

The idea

Critical points of a projection. Let Z={Q=0}⊂Rk be bounded and non-singular (∇Q≠0 on Z), and let π be the projection to the x1-axis. A point of Z is critical for π when ∂Q/∂x2=⋯=∂Q/∂xk=0 there: the tangent space is vertical. π is a Morse function if these points are non-degenerate (and their values distinct).
Morse lemmas. If [a,b] contains no critical value, Z≤a=Z∩{x1≤a} and Z≤b are (semi-algebraically) homotopy equivalent. Passing a non-degenerate critical point of index λ attaches a λ-cell, which changes one Betti number by one.

Consequence: b(Z)=∑ibi(Z)≤ the number of critical points of π on Z. For a curve in the plane: each oval contributes b0=b1=1, and has at least two critical points, its leftmost and rightmost.

Oleinik–Petrovskii, Thom, Milnor. An algebraic set in Rk defined by polynomials of degree at most d has b≤d(2d−1)k−1.

The proof perturbs the set into a bounded non-singular hypersurface (with infinitesimals from module 4), then counts the critical points, which are the solutions of a system of k polynomial equations, with Bézout's theorem. Similar arguments bound the Betti numbers of sets defined by s polynomials by (O(sd))k: a single exponential in k.

Explore

the part with x ≤ t critical points of x on the curve (red once passed)
Curve f(x, y) = c

Worked example

For the curve (x2−1)2+y2=c ("Double well"), find the critical points of x and compare their number with b0+b1, for 0<c<1 and for c>1.

  1. Write the condition for a critical point of x on the curve.

    With Q=(x2−1)2+y2−c, the condition is Q=0 and ∂Q/∂y=2y=0. So y=0 and (x2−1)2=c.

  2. Solve it for 0<c<1.

    x2=1±c, both positive, so four points x=±1+c, ±1−c on the x-axis.

  3. What is the topology, and is the bound sharp?

    Two ovals, one around each well: b0=b1=2, so b0+b1=4, equal to the number of critical points. Each oval has exactly its leftmost and rightmost point.

  4. Now c>1. And how does this compare with Milnor's bound?

    Only x2=1+c is positive: 2 critical points, one oval, b0+b1=2. Milnor's bound for degree 4 in the plane is 4⋅7=28: true but generous. Sweep the line in the explorer and watch the left part change only at the critical points.

Check your understanding

A smooth bounded curve in the plane has 10 critical points for the projection to x. At most how many ovals can it have?

  1. 5
  2. 10One critical point per oval is impossible: x has both a maximum and a minimum on each.
  3. 20Each oval uses up at least two critical points, not half of one.
x attains a minimum and a maximum on each compact oval, and they are different points. So ovals ≤10/2. In Betti terms, b0+b1=2⋅#ovals≤10.

You sweep x=t across a smooth curve. Between two consecutive critical values, what can happen to the part with x≤t?

  1. A new arc can appear at any moment.A new arc starts at a leftmost point of an oval, which is a critical point.
  2. Nothing topological: it only stretches.
  3. Two arcs can join into one.Two arcs meet at a rightmost point of an oval, again a critical point.
That is the first Morse lemma: without critical values in [a,b] the parts below a and below b are homotopy equivalent. All changes happen at critical points.

Which bound on b0+b1 holds for every curve in R2 defined by one polynomial of degree d?

  1. dThe "Four wells" curve has degree 4 and b0+b1=8 at small levels.
  2. d(2d−1)
  3. None in terms of d alone.The Milnor bound depends only on d and the dimension.
With k=2, d(2d−1)k−1=d(2d−1). For curves there are sharper classical results (Harnack's bound on the number of ovals), but this bound has the right shape in every dimension.

Practice

Four wellsCritical points and ovals

For (x2−1)2+(y2−1)2=c with 0<c<1, find all critical points of x on the curve and the Betti numbers of the curve.

Solution

∂/∂y=4y(y2−1)=0 gives y∈{0,±1}. With y=0: (x2−1)2=c−1<0, nothing. With y=±1: (x2−1)2=c, so x2=1±c: four values of x for each, 8 points. The curve is four ovals around (±1,±1): b0+b1=8, equal to the count.

Which Betti number changesThe index of a critical point

Sweep x=t across the circle x2+y2=1. Describe the part with x≤t for t<−1, −1<t<1, t>1, and say which Betti number changes at each critical point.

Solution

Empty, then an arc (contractible: b0=1), then the whole circle (b0=b1=1). At (−1,0), a minimum (index 0), a point is born: b0 goes from 0 to 1. At (1,0), a maximum (index 1 for a curve), the two ends of the arc are joined by a 1-cell: b1 goes from 0 to 1.

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 7.1Non-singular hypersurfaces are manifolds

Prove that a non-singular algebraic hypersurface Zer(Q,Rk) (where ∇Q≠0 at every point of it) is an S∞ submanifold of dimension k−1.

Hint

Semi-algebraic implicit function theorem at a point where some partial derivative is nonzero.

Solution

Let p∈Zer(Q,Rk). Since ∇Q(p)≠0, some ∂Q/∂Xi(p)≠0; reorder so i=k. By the semi-algebraic implicit function theorem there are a semi-algebraic neighbourhood U×V of p=(p′,pk) and an S∞ function φ:U→V with Zer(Q)∩(U×V)={(x′,φ(x′)):x′∈U}. The map x′↦(x′,φ(x′)) is an S∞ diffeomorphism from the open set U⊂Rk−1 onto a neighbourhood of p in the hypersurface, with inverse the projection. These are S∞ charts of dimension k−1 around every point.

Exercise 7.2The gradient is normal

For a non-singular hypersurface Zer(Q,Rk) and a point p on it, prove that ∇Q(p) is orthogonal to the tangent space Tp.

Hint

In the chart from the previous exercise, Q(x′,φ(x′))=0 identically. Differentiate.

Solution

Using the chart ψ(x′)=(x′,φ(x′)), Tp is the image of dψ, spanned by ∂ψ/∂xj=ej+∂φ∂xjek, j<k. Differentiating Q∘ψ≡0 gives ∂jQ+∂kQ∂jφ=0, i.e. ⟨∇Q(p),∂ψ/∂xj⟩=0 for every j. So ∇Q(p)⟂Tp. As dim⁡Tp=k−1, Tp is exactly ∇Q(p)⟂.

SimulatorBasu–Pollack–Roy, Ch. 8: Complexity of Basic Algorithms

Subresultants and bit size

Counting arithmetic operations is not the whole story. Euclid's algorithm on integer polynomials can produce numbers with exponentially many digits. Subresultants compute the same sequence, up to constant factors, with numbers whose size grows only linearly. Generate random pairs and compare.

The idea

Complexity. The arithmetic complexity of an algorithm counts additions, multiplications and comparisons in the ring of coefficients. The bit complexity also accounts for the size of the numbers: with integer inputs of bitsize τ, one wants the intermediate numbers to stay of size polynomial in τ and the degree.
Hadamard's bound. |detM|≤∏i‖Mi‖, the product of the Euclidean lengths of the rows. So an n×n integer determinant with entries of bitsize τ has bitsize at most about nτ+n2log2⁡n.
Bareiss elimination. Gaussian elimination where step k replaces mij by (mkkmij−mikmkj)/p, with p the previous pivot. The division is exact, and every intermediate entry is a minor of the original matrix, so Hadamard's bound controls all of them.
Subresultants. The j-th subresultant of P and Q is a polynomial of degree at most j whose coefficients are determinants of submatrices of the Sylvester matrix. The structure theorem says each signed remainder of P and Q is a constant multiple of one of them, and the constants (with their signs) are known along the way. So Sturm sequences and Cauchy indices can be computed from subresultants.
Cost. All subresultants of two polynomials of degree at most p take O(p2) arithmetic operations, and each coefficient, being a determinant, has bitsize O(p(τ+log⁡p)).

Explore

Size of the largest number in each remainder Rk (log scale). Euclid over ℚ (numerator + denominator) pseudo-remainders primitive parts (dashed) subresultants

Worked example

Compute det(213132321) by Bareiss elimination, and compare with Hadamard's bound.

  1. First step, pivot 2, previous pivot 1. Compute the new lower-right 2×2 block.

    m22=2⋅3−1⋅1=5, m23=2⋅2−1⋅3=1, m32=2⋅2−3⋅1=1, m33=2⋅1−3⋅3=−7.

  2. Second step, pivot 5, previous pivot 2.

    m33=(5⋅(−7)−1⋅1)/2=−36/2=−18. The division is exact, and −18 is the determinant.

  3. Why are the divisions always exact?

    After step k, the entry mij equals the minor of the original matrix on rows 1,…,k,i and columns 1,…,k,j (Sylvester's identity). For instance m22=5=det(2113). Minors are integers.

  4. Compare with Hadamard's bound.

    Every row has length 14, so |det|≤143/2≈52.4. Indeed 18≤52.4, and no intermediate entry can exceed the corresponding bound for its minor.

Check your understanding

Why do pseudo-remainder sequences over Z blow up?

  1. Because they introduce denominators.Pseudo-division is designed to avoid denominators: it multiplies by a power of the leading coefficient first.
  2. Each step multiplies by a power of a leading coefficient, and these factors compound from step to step.
  3. Because the degrees go up.Degrees go down at every step, in every version of the algorithm.
The factor lc⁡(B)deg⁡A−deg⁡B+1 enters the next remainder, which becomes the next divisor, whose leading coefficient is raised to a power again. Sizes roughly double per step. Subresultants divide out exactly the predictable part of these factors.

An n×n integer matrix has entries of bitsize at most τ. About how big can its determinant be?

  1. About nτ+n2log2⁡n bits
  2. About τn bitsSizes add when you multiply numbers; they don't multiply.
  3. About 2nτ bitsExponential growth in bitsize is the pseudo-remainder disease, not a property of determinants.
Each row has length at most n2τ, and Hadamard's bound multiplies n of them. That is why algorithms whose intermediate numbers are minors, like Bareiss and subresultants, have polynomial bit complexity.

How are the subresultants of P and Q related to the signed remainder sequence?

  1. Each signed remainder is a known constant multiple of a subresultant, so the subresultants carry the same information with small coefficients.
  2. Only the last subresultant, the resultant, is related to the remainders.The structure theorem relates every remainder to a subresultant, not only the last one.
  3. They have different degrees, so they compute different things.The degrees match: a subresultant proportional to a remainder has the same degree.
In the explorer all four methods produce the same sequence up to scaling; the curves differ only in how big the numbers are.

Practice

Three sequences for one pairPseudo-remainders and subresultants

For A=x3+x+1 and B=3x2+1, compute the pseudo-remainder sequence and the subresultant sequence. (In the Collins–Brown form of the subresultant algorithm, with all degree gaps equal to 1, the first pseudo-remainder is kept and the second is divided by lc⁡(B)2.) Compare the last term with Res⁡(A,B).

Hint

prem⁡(A,B) is the remainder of 32A by B.

Solution

prem⁡(A,B)=9A−3xB=6x+9, then prem⁡(B,6x+9)=36B(−32)=279. The subresultant sequence keeps 6x+9 and divides 279 by 32: it gives 31. And Res⁡(A,B)=31 (Disc⁡(A)=−31). Primitive parts would give 2x+3 and 31, at the price of gcd computations.

Bounding a resultantHadamard on a Sylvester matrix

P and Q are quadratics with integer coefficients of absolute value at most 10. Bound |Res⁡(P,Q)|.

Solution

The Sylvester matrix is 4×4 and each row contains the three coefficients of P or of Q and a zero, so each row has length at most 300. Hadamard gives |Res⁡|≤3002=90000.

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 8.1Computing rank by elimination

Adapt Gaussian elimination and the Dodgson–Jordan–Bareiss (fraction-free) algorithm to compute the rank of a matrix.

Hint

Rank is the number of pivots you find when you are allowed to search the whole remaining submatrix for a nonzero pivot.

Solution

Gauss (over a field). For k=1,2,…: search the submatrix of rows ≥k, columns ≥k for a nonzero entry. If there is none, stop and return k−1. Otherwise swap it into position (k,k) by a row and a column swap, and subtract multiples of row k to clear column k below the pivot. The row and column operations preserve rank, and at the end the matrix is upper-trapezoidal with r nonzero pivots and zeros below, so its rank is r. For an n×m matrix this takes O(nmmin(n,m)) arithmetic operations.

Bareiss (over an integral domain). Same pivot search, but update with the fraction-free rule mij←(mkkmij−mikmkj)/mk−1,k−1 (exact division, m00=1). After step k the entries of the remaining block are (k+1)×(k+1) minors of the permuted matrix, so they stay in the domain with controlled size. If the whole remaining block is zero after r steps, every (r+1)-minor containing the leading r×r pivot block vanishes, and the rank is r. Same O(nmmin(n,m)) operation count, with all intermediate entries being minors.

Exercise 8.2A quadratic-time resultant

Give an algorithm computing Res(P,Q) with O(p2) arithmetic operations when deg⁡P=deg⁡Q=p. (Hint: with Q1=apQ−bpP, show app−1Res(P,Q)=Res(P,Q1), where Q1 is regarded as having degree p−1.)

Hint

Use Res(P,Q)=apdeg⁡Q∏P(x)=0Q(x), and the remainder rule Res(P,Q)=(−1)pqbqp−rRes(Q,R) for R=PmodQ of degree r.

Solution

The hint. At each root x of P, Q1(x)=apQ(x). With Q1 of formal degree p−1, Res(P,Q1)=app−1∏Q1(x)=app−1app∏Q(x)=app−1Res(P,Q).

Remainder rule. If deg⁡Q=q≤deg⁡P=p and R=PmodQ has degree r, then P(y)=R(y) at each root y of Q, and Res(P,Q)=(−1)pqbqp∏P(y)=(−1)pqbqp−rRes(Q,R). Base cases: Res(P,c)=cdeg⁡P for a nonzero constant c, and Res(P,0)=0 when deg⁡P≥1.

Algorithm. Compute Q1 (O(p) operations), then run the Euclidean remainder sequence P,Q1,R2,…, accumulating the factors (−1)⋅b⋅ from the remainder rule. Dividing a polynomial of degree d by one of degree e costs O((d−e+1)e), and summing over the sequence gives O(p2) because the degree drops d−e add up to at most p. Finally divide by app−1. Over an integral domain the same bookkeeping is done with the signed subresultant sequence, which avoids fractions at the same O(p2) cost.

InteractiveBasu–Pollack–Roy, Ch. 9: Cauchy Index and Applications

Cauchy index and stability

A linear system is stable when every root of its characteristic polynomial has negative real part. You can decide that from the coefficients alone: restricted to the imaginary axis, the question becomes a Cauchy index, a real root counting problem, and the Routh array computes it.

The idea

Cauchy index. Ind⁡(Q/P;a,b) is the number of poles in (a,b) where Q/P jumps from −∞ to +∞, minus the number where it jumps from +∞ to −∞. For instance Ind⁡(P′/P) is the number of distinct real roots of P.
Computing it. If a,b are not roots of P, Ind⁡(Q/P;a,b)=Var⁡(a)−Var⁡(b) for the signed remainder sequence of P and Q. (Sturm's theorem is the case Q=P′.)
Hankel form. Expand Q/P=∑k≥0skx−k−1 at infinity. The quadratic form with Hankel matrix (sj+k)0≤j,k<p has signature Ind⁡(Q/P;−∞,+∞). With Q=P′ the sk are Newton sums: that is Hermite's form again.
Stability. Write P(iy), for real y, in terms of its real and imaginary parts, two real polynomials built from the even and the odd coefficients of P. If P has no root on the imaginary axis, the difference between the numbers of roots with negative and with positive real part is (up to a sign convention) the Cauchy index of their ratio on (−∞,+∞).
Routh's rule. For real P=a0sn+a1sn−1+⋯+an with a0>0, build rows (a0,a2,…), (a1,a3,…), and each new row (c0,c1,…) from the two rows (u0,u1,…) and (v0,v1,…) just above it by cj=(v0uj+1−u0vj+1)/v0 (missing entries count as 0). If no entry of the first column is 0, the number of sign changes down the first column is the number of roots with positive real part.
A quick necessary condition. A stable real polynomial is a product of factors s+r and s2+2us+u2+v2 with r,u>0, so all its coefficients have the same sign.

Explore

real roots complex pairs · the shaded side is Re s > 0
Examples

Worked example

For which real k is P=s3+2s2+3s+k stable?

  1. Write the first two rows of the Routh array.

    (1, 3) and (2, k).

  2. Compute the remaining rows.

    Third row: (2⋅3−1⋅k)/2=(6−k)/2. Fourth row: (6−k2⋅k−2⋅0)/6−k2=k (when k≠6). First column: 1, 2, 6−k2, k.

  3. Read off the condition.

    No sign change iff 6−k>0 and k>0: stable exactly for 0<k<6. For k>6 the column is +,+,−,+: two roots with positive real part. For k<0: +,+,+,−, one.

  4. What happens at k=6?

    A zero appears in the first column. Indeed s3+2s2+3s+6=(s+2)(s2+3), with roots ±i3 on the imaginary axis: exactly the boundary between stable and unstable.

Check your understanding

A real cubic has coefficients 1,3,−2,5 (leading first). Can it be stable?

  1. No: the coefficients don't all have the same sign.
  2. Yes, if the Routh array has no sign change.With a negative coefficient that cannot happen; stability forces all coefficients positive.
  3. You can't tell without computing the roots.The quick necessary condition already settles it.
Multiplying factors s+r and s2+2us+u2+v2 with r,u>0 only produces positive coefficients.

The first column of a Routh array is 1,4,−1,2,3. How many roots have positive real part?

  1. 1Going into the negative entry is one change and coming out of it is another.
  2. 2
  3. 3Count the sign changes, not the entries.
+,+,−,+,+ has two sign changes. Degree 4, so the other two roots have negative real part (no zero appeared, so none is on the axis).

For P=(x−1)2(x+3), what is Ind⁡(P′/P;−∞,+∞)?

  1. 3Multiplicity changes the size of the pole of P′/P, not the direction of its jump.
  2. 2
  3. 1Both roots are poles of P′/P with a jump from −∞ to +∞.
Near a root c of multiplicity m, P′/P≈m/(x−c): it jumps from −∞ to +∞ for every m≥1. So the index counts distinct real roots.

Practice

Degree twoStability by hand

Show that s2+a1s+a2 (real coefficients) is stable iff a1>0 and a2>0, first from the roots and then from the Routh array.

Solution

Roots: their sum is −a1 and their product a2. Two real roots are both negative iff the sum is negative and the product positive. A complex pair has real part −a1/2, negative iff a1>0, and then a2=|z|2>0 automatically. Routh: the rows are (1,a2), (a1), (a2), and the column 1,a1,a2 has no sign change iff a1,a2>0.

A quarticPositive coefficients are not enough

How many roots of s4+2s3+3s2+4s+5 have positive real part?

Solution

Rows: (1,3,5), (2,4), (1,5), (−6), (5). The first column 1,2,1,−6,5 changes sign twice: two roots with positive real part (numerically 0.288±1.416i), although every coefficient is positive.

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 9.3Stable cubics

Determine the conditions on a,b,c,d for P=aX3+bX2+cX+d to lie in the domain of stability (all complex roots with negative real part).

Hint

Normalise a>0. Routh–Hurwitz (or Liénard–Chipart) for degree 3: all coefficients positive plus one extra inequality. Test on P=(X+1)(X2+ω2), which sits on the boundary.

Solution

P is stable iff

a,b,c,d all have the same sign and bc>ad.

(Both conditions are unchanged by P↦−P.) For a>0 this reads a,b,c,d>0 and bc>ad.

Why: if the roots are −r and −α±iβ (or three real ones) with negative real parts, P/a is a product of factors with positive coefficients, so all coefficients have the sign of a. For the extra condition, P has a root on the imaginary axis iy iff −ay3+cy=0 and −by2+d=0, i.e. y2=c/a=d/b, i.e. bc=ad. So within the region of positive coefficients, the number of roots in the right half-plane can only change when the parameters cross the surface bc=ad. That region minus the surface has two parts. (X+1)3 lies in the part with bc>ad (9>1) and is stable; X3+X2+X+2 lies in the part with bc<ad (1<2) and has a pair of roots with positive real part (its real root is near −1.35 and the other two have product 2/1.35>0 and sum 1.35−1>0). Hence bc>ad is the condition.

Step-throughBasu–Pollack–Roy, Ch. 10: Real Roots

Isolating real roots

To compute with a real algebraic number you have to pin it down: an interval with rational endpoints that contains it and no other root. Bisection guided by Descartes' rule does this with exact rational arithmetic only. Step through it.

The idea

Cauchy bound. Every complex root of P=apxp+⋯+a0 satisfies |x|<1+maxi<p|ai/ap|. So all real roots lie in a known interval (−B,B).
Descartes on an interval. The map x↦(ℓ+rx)/(1+x) sends (0,∞) onto (ℓ,r). Put T(x)=(1+x)pP((ℓ+rx)/(1+x)). Its positive roots correspond to the roots of P in (ℓ,r), so Var⁡(T) bounds their number, with even excess. The coefficients of T are, up to positive factors, the Bernstein coefficients of P on [ℓ,r].
Theorem of three circles. For P without multiple roots: if no complex root lies in the open disk with diameter [ℓ,r], then Var⁡(T)=0; if exactly one root lies in the union of the two open disks bounded by the circumcircles of the two equilateral triangles with side [ℓ,r], then Var⁡(T)=1.

So bisection terminates: small intervals far from every root give 0, and small intervals around a single real root give 1. Its cost is governed by how close distinct roots can be, which for integer polynomials is bounded below in terms of the degree and the bitsize.

Multiple roots. Near a double root Var never drops below 2. So one first replaces P by its square-free part P/gcd(P,P′), which has the same roots, all simple.
Thom encodings and sign determination. A real root can also be named exactly by the signs of P′,P″,… at it (module 14). With Tarski queries (module 3) one determines the sign of another polynomial Q at each root of P, without ever approximating the roots.

Explore

Examples
Top: P (compressed vertical scale). Below: the intervals tested, one row per bisection depth, labelled with Var. exactly one root no root bisect waiting

Worked example

Isolate the real roots of P=x2−2 by the bisection method.

  1. Find a starting interval.

    The Cauchy bound is 1+2=3; round up to a power of 2: (−4,4).

  2. Test (−4,4).

    T=(1+x)2P(−4+4x1+x)=(4x−4)2−2(1+x)2=14x2−36x+14. Signs +,−,+: Var=2. Inconclusive, so bisect at 0, which is not a root.

  3. Test (−4,0) and (0,4).

    On (−4,0): T=16−2(1+x)2=−2x2−4x+14, signs −,−,+, Var=1. On (0,4): T=16x2−2(1+x)2=14x2−4x−2, signs +,−,−, Var=1. Each contains exactly one root.

  4. What has been computed, and what would you do to get more digits?

    Isolating intervals (−4,0)∋−2 and (0,4)∋2. To refine, bisect an isolating interval and keep the half where P changes sign: P(2)=2>0, P(1)=−1<0, so 2∈(1,2), and so on.

Check your understanding

On some interval the transformed polynomial has Var=2. What do you know?

  1. There are exactly 2 roots in the interval.Descartes gives a bound with even excess, not an exact count.
  2. There is at least one root in the interval.2−2=0 is allowed: a complex pair near the interval can produce both variations.
  3. There are 0 or 2 roots there, so the interval must be bisected.
Only Var=0 and Var=1 are conclusive. For example x2+1 on (−2,2) gives T=(2x−2)2+(1+x)2=5x2−6x+5: Var=2, and no real root at all.

Why does the method work with the square-free part of P?

  1. Because Descartes' rule is false for polynomials with multiple roots.It holds, counting multiplicities; that's exactly why a double root keeps Var≥2.
  2. Because near a multiple root the count never drops to 1, so bisection would never stop.
  3. Because the square-free part has smaller coefficients.It often does not; the point is termination.
P/gcd(P,P′) has the same roots, each simple. Try (x2−2)(x−1)2: the explorer uses (x2−2)(x−1).

What is the Cauchy bound for 2x3−6x+1?

  1. 4
  2. 7Divide by the leading coefficient first: the ratios are 3 and 12.
  3. 3It is 1 plus the largest ratio.
1+max(|−6/2|,|1/2|)=1+3=4. All roots (in fact about −1.81, 0.17, 1.64) lie in (−4,4).

Practice

The golden ratioOne test per root

For P=x2−x−1, compute Var⁡(T) on (0,2) and on (−1,0).

Solution

On (0,2): T=(1+x)2P(2x1+x)=4x2−2x(1+x)−(1+x)2=x2−4x−1, Var=1: one root, 1+52≈1.618. On (−1,0): T=1+(1+x)−(1+x)2=−x2−x+1, Var=1: one root, 1−52≈−0.618.

Naming roots by derivative signsThom encodings

The roots of P=x3−3x+1 are about −1.879, 0.347, 1.532. Give the signs of P′ and P″ at each, and check that no two roots get the same pair.

Solution

P′=3x2−3 is positive at −1.879 and 1.532, negative at 0.347. P″=6x is negative at −1.879 and positive at the other two. Codes: (+,−), (−,+), (+,+), all different. The "A cubic and its derivative" example in module 14 shows this table.

InteractiveBasu–Pollack–Roy, Ch. 11: Cylindrical Decomposition Algorithm · Ch. 14: Quantifier Elimination

Quantifier elimination

Tarski's theorem: every statement about real numbers built from polynomial equations, inequalities, logical connectives and quantifiers is equivalent to one without quantifiers. Here is the smallest interesting case, a quadratic with two parameters, and four questions about it.

The idea

Tarski–Seidenberg. For every formula Φ(Y) of the language of ordered fields (with quantified variables X and free variables Y) there is a quantifier-free formula Ψ(Y) equivalent to it over every real closed field. Geometrically: the projection of a semi-algebraic set is semi-algebraic (Ch. 2). In particular the truth of sentences is decidable, and the same in every real closed field.
By cylindrical decomposition (Ch. 11). Decompose the space of (Y,X) cylindrically, with Y first, adapted to the polynomials of Φ. On each cell the quantifier-free part of Φ has a constant truth value. Then, over each cell of Y-space, ∃X holds iff it holds at some cell above, and ∀X iff at all of them: one sample point per cell decides. Ψ is the union of the good Y-cells, described by sign conditions on the projection polynomials.
Cost. Cylindrical decomposition takes (sd)2O(k) operations for s polynomials of degree d in k variables: doubly exponential. Some doubly exponential cost is unavoidable for quantifier elimination in general, because there are formulas whose shortest quantifier-free equivalent is that long (Davenport and Heintz, 1988).
Critical point methods (Ch. 14). Deciding a sentence whose k variables are split into ω blocks of sizes k1,…,kω (alternating ∃ and ∀) costs s(kω+1)⋯(k1+1)dO(kω)⋯O(k1). With few alternations this is singly exponential in k. Quantifier elimination has a similar bound, with the free variables counted as one more block.

Explore

Question about f(x) = x² + bx + c
Parameters (b, c): drag the point. where the formula is true. The curves are the projection polynomials: b² − 4c c 1 + b + c b, b + 2
The quadratic for the current (b, c). The shaded strip is the range of x the formula talks about. a witness a counterexample

Worked example

Eliminate the quantifier in ∃x (x>0∧x2+bx+c=0).

  1. What is needed for any real root at all?

    b2−4c≥0. The two roots then have product c and sum −b.

  2. Case c<0.

    Then b2−4c>0 automatically, and the product of the roots is negative: one is positive. The formula holds.

  3. Cases c>0 and c=0.

    c>0: the roots (if real) have the same sign, the sign of their sum −b. So we need b<0 and b2−4c≥0. c=0: the roots are 0 and −b, so we need b<0 (and then b2−4c=b2≥0).

  4. Combine, and compare with what a decomposition would see.

    ∃x (x>0∧x2+bx+c=0)⟺c<0 ∨ (b<0∧b2−4c≥0).

    Only the signs of b2−4c, c and b appear: the discriminant, the value at the boundary point x=0, and the coefficient that locates the vertex. Their zero sets cut the (b,c)-plane into cells on which the answer is constant. Choose the third question in the explorer to see them.

Check your understanding

Over R, ∀x (x2+bx+c≥0) is equivalent to:

  1. b2−4c<0When b2=4c the parabola touches 0 but stays ≥0, so the boundary belongs.
  2. b2−4c≤0
  3. c≥0That's the condition at x=0 only: necessary, not sufficient.
The minimum is c−b2/4, at x=−b/2. Strict versus non-strict inequalities in the quantified formula show up as strict versus non-strict in the answer.

Why does one sample point per cell suffice to decide a formula?

  1. Because cells are convex.They need not be; the arcs of a circle are cells.
  2. Because every polynomial in the formula has constant sign on each cell, so the quantifier-free part has a constant truth value there.
  3. Because the formula is linear in the parameters.Here the answer involves b2−4c; nothing is linear.
Truth of the quantifier-free part depends only on the signs of its polynomials. Being adapted to those polynomials is exactly what the decomposition guarantees, and cylindricity lets you read off ∃ and ∀ fiber by fiber.

For a sentence with a single block of k existential variables, what do critical point methods gain over cylindrical decomposition?

  1. A cost of sk+1dO(k), singly exponential in k, instead of doubly exponential.
  2. Polynomial time in k.Still exponential in k, just not doubly so.
  3. Nothing for a fixed number of variables.For fixed k both are polynomial in s and d, but the exponents are very different: O(k) against 2O(k).
With ω=1 the general bound reads sk+1dO(k). The price of each extra quantifier alternation is another factor in the exponent.

Practice

Positive on an intervalNegating a formula

Eliminate the quantifier in ∀x (0≤x≤1⇒x2+bx+c>0). Use the fourth question of the explorer.

Hint

This is the negation of ∃x (0≤x≤1∧x2+bx+c≤0).

Solution

The explorer's answer for the existential formula is c≤0∨1+b+c≤0∨(−2≤b≤0∧b2−4c≥0): the minimum on [0,1] is at 0, at 1, or at the vertex −b/2. Negating:

c>0 ∧ 1+b+c>0 ∧ (b<−2 ∨ b>0 ∨ b2−4c<0).
Two sentencesEliminate the inner quantifier first

Decide ∀y ∃x (x2+xy+1=0) and ∃y ∀x (x2+xy+1>0).

Solution

∃x(x2+yx+1=0)⟺y2−4≥0, and ∀y(y2≥4) is false (take y=0). ∀x(x2+yx+1>0)⟺y2−4<0, and ∃y(y2<4) is true. Each step is a one-variable elimination, which is what the algorithm does recursively.

From Basu, Pollack and Roy, Algorithms in Real Algebraic Geometry (2nd ed., Springer, 2006)

Numbers match the book. Each question is restated in our own words; the hints and solutions are written for this page.

Exercise 2.14When X3+aX+b has a positive root

Find the conditions on a,b for X3+aX+b to have a strictly positive real root.

Hint

Look at f(0)=b. If b>0, the graph must dip below zero somewhere on (0,∞), which needs a local minimum there.

Solution

Let f(x)=x3+ax+b.

  • If b<0: f(0)<0 and f→+∞, so there is a positive root.
  • If b=0: roots 0,±−a; a positive root iff a<0.
  • If b>0: a positive root needs f≤0 somewhere on (0,∞). If a≥0, f is increasing and positive there. If a<0, the minimum on (0,∞) is at x0=−a/3 with f(x0)=b+2a3x0. So f(x0)≤0⟺b2≤−4a3/27⟺4a3+27b2≤0.

Together: b<0 ∨ (a<0∧4a3+27b2≤0). (The case b=0,a<0 is included in the second clause.)

Exercise 14.1The minimum of a polynomial

Design an algorithm with complexity dO(k) that computes the infimum (possibly −∞) of a polynomial P of degree d on Rk. Say precisely how the answer is described.

Hint

The image P(Rk) is a semi-algebraic subset of R. Eliminating the single block of k existential quantifiers in ∃x P(x)≤t has complexity dO(k), and leaves univariate polynomials in t.

Solution

Step 1. Apply the single-block quantifier elimination algorithm to Φ(t)=∃x∈Rk (P(x)−t≤0). It outputs, in dO(k) operations, a finite family G⊂D[t] of at most dO(k) polynomials of degree dO(k) and a quantifier-free formula in their signs describing S={t:Φ(t)}. Since S is an up-set, it is R, [m,∞) or (m,∞).

Step 2. Compute the Thom encodings of all real roots of the polynomials in G and the sign conditions realised on the intervals between them (univariate sign determination, polynomial in the sizes above). Test Φ on a point below all roots: if true, the infimum is −∞. Otherwise m is the smallest root at which, or just above which, Φ becomes true.

Output. Either "−∞", or the infimum m as a real algebraic number given by a polynomial g∈G and the Thom encoding of the root (signs of g′,g″,… at m), together with a flag saying whether the minimum is attained (true iff m∈S, i.e. Φ(m) holds, which is read off from the sign condition at m). The flag matters: (xy−1)2+x2 has infimum 0 but no minimum. The total cost is dO(k).

Worked exampleBasu–Pollack–Roy, Ch. 12: Polynomial System Solving

Solving polynomial systems

When a system has finitely many complex solutions, everything you want to know about them, their coordinates, how many are real, the sign of another polynomial at each, can be read off from linear algebra in a finite-dimensional ring. This module works one system through in full.

The idea

Gröbner basis. Fix a monomial order. A finite G⊂I is a Gröbner basis of the ideal I if the leading monomials of G generate the ideal of leading monomials of I. Then division by G gives a unique remainder (normal form), and f∈I iff its normal form is 0.
Zero-dimensional ideals. I⊂K[X1,…,Xk] has finitely many solutions in Ck iff A=K[X]/I is a finite-dimensional vector space. A basis is given by the monomials not divisible by any leading monomial of G, and dim⁡A is the number of solutions counted with multiplicity.
Stickelberger. Let Lf:A→A be multiplication by f (its matrix is a multiplication table). The eigenvalues of Lf are the values f(z) at the complex solutions z, each repeated according to multiplicity.
Univariate representation. A linear form u is separating if it takes different values at different solutions. Then the characteristic polynomial of Lu has one root per solution, and each coordinate can be written as a rational function of that root. This reduces a system to one univariate polynomial, where the earlier modules apply.
Multivariate Hermite. The form f↦Tr⁡(Lf2Q) on A has rank equal to the number of distinct complex solutions with Q(z)≠0, and signature ∑z realsign⁡Q(z). With Q=1: the signature is the number of real solutions.

Worked example

Solve the system x2+y2=5, xy=2 by these methods: find a Gröbner basis, the multiplication tables, the solutions, the number of real solutions, and how many have x+y>0. Then see what changes for x2+y2=1, xy=2.

  1. Eliminate y: find a polynomial in x alone in the ideal.

    Multiply the first equation by x2 and use (xy)2=4: x4+4−5x2. So x4−5x2+4∈I.

  2. Express y in terms of x modulo I, and give a basis of A.

    From x4−5x2+4=0 we get x(5x−x3)=4, and xy=2, so y=(5x−x3)/2. Indeed, for lex order with y>x, a Gröbner basis is

    G={x4−5x2+4,  2y+x3−5x}.

    The leading monomials are x4 and y, so the monomials 1,x,x2,x3 form a basis of A: dim⁡A=4.

  3. Write Lx in this basis and find its eigenvalues. Then get y.

    x⋅x3=x4=5x2−4 in A, so Lx is the companion matrix of x4−5x2+4=(x2−1)(x2−4), with eigenvalues ±1,±2. Since Ly=(5Lx−Lx3)/2, its eigenvalue on each eigenvector is (5x−x3)/2: the solutions are

    (1,2),(2,1),(−1,−2),(−2,−1).

    Here x happens to be separating, so this is already a univariate representation.

  4. Count the real solutions with Hermite's form, without the solutions.

    The entries are Tr⁡(Lxj+k)=∑zxj+k=Nj+k, here 4,0,10,0,34,0,130 (from the companion matrix, or Newton's identities):

    (401000100341003400340130)

    It splits into the blocks (4101034) and (103434130), both with positive trace and determinants 36 and 144. All four eigenvalues are positive: signature 4, so four real solutions.

  5. How many solutions have x+y>0? Use the Tarski query of Q=x+y.

    The signature of f↦Tr⁡(Lf2Q) is ∑sign⁡(x+y)=1+1−1−1=0, and Q vanishes at no solution. With c++c−=4 and c+−c−=0: c+=2. Only signs of traces were needed.

  6. Now take x2+y2=1, xy=2. What does Hermite's form say?

    The same steps give x4−x2+4 and a basis 1,x,x2,x3. The Newton sums are 4,0,2,0,−14,0,−22, and the blocks (422−14), (2−14−14−22) have negative determinants: one positive and one negative eigenvalue each. Signature 0: no real solutions, four complex ones. (Geometrically, x2+y2≥2|xy|=4 on the hyperbola.)

Check your understanding

A zero-dimensional ideal I⊂Q[x,y] has dim⁡Q[x,y]/I=6. What do you know about its complex solutions?

  1. There are exactly 6 distinct ones.Multiple solutions count more than once in the dimension.
  2. There are 6 counted with multiplicity, so at most 6 distinct ones.
  3. There are 6 real ones.The dimension counts complex solutions; the real ones need a signature.
The rank of the trace form tells you the number of distinct solutions, and its signature the number of real ones.

The eigenvalues of the multiplication matrix Lf on A are:

  1. the values f(z) at the complex solutions z
  2. the coordinates of the solutionsThat is the special case f=x or f=y.
  3. the coefficients of fThe coefficients of f enter Lf, but its eigenvalues are values of f.
If v is the evaluation at z seen as a linear form on A, then v(fg)=f(z)v(g): it is an eigenvector of the transpose of Lf with eigenvalue f(z).

For some zero-dimensional system the trace form f↦Tr⁡(Lf2) has rank 6 and signature 2. How many solutions are real?

  1. 6The rank counts distinct complex solutions.
  2. 2, out of 6 distinct complex ones
  3. 4The signature itself is the number of real solutions; it doesn't need to be subtracted.
Each real solution gives a positive square; each conjugate pair a positive and a negative one. 6 distinct solutions: 2 real and 2 pairs.

Practice

A family of systemsWhen do real solutions appear?

For which real r does x2+y2=r, xy=2 have real solutions, and how many?

Solution

Eliminating y gives x4−rx2+4=0, so x2=(r±r2−16)/2. For r>4 both values are positive: 4 real solutions. For r=4: x2=2, two real solutions (2,2), (−2,−2), each of multiplicity 2. For r<4: none (for r≤−4 the values of x2 are negative, for |r|<4 they are not real).

A separating elementUnivariate representation

In the worked example, is u=x+y separating? Find a linear form that is, and the characteristic polynomial of Lu for it.

Solution

x+y takes the values 3,3,−3,−3: not separating, since (1,2) and (2,1) collide. u=x+2y takes 5,4,−5,−4: separating, with characteristic polynomial (T2−25)(T2−16)=T4−41T2+400.

InteractiveBasu–Pollack–Roy, Ch. 10: Real Roots · Ch. 13: Existential Theory of the Reals

Sign conditions and Thom encodings

Deciding whether a system of polynomial conditions has a real solution means finding which sign conditions on the polynomials are realizable. On the line you can see all of them at once, and there are far fewer than the 3s conceivable ones. The same bookkeeping names each real root exactly.

The idea

Sign condition. For a family P={P1,…,Ps}, a sign condition is a choice σ∈{−,0,+}s. Its realization is {x:sign⁡Pi(x)=σi for all i}, and σ is realizable if that set is nonempty.

The existential theory of the reals asks whether ∃x Φ(x) holds for a quantifier-free Φ. Since the truth of Φ only depends on the signs of its polynomials, it is enough to list the realizable sign conditions and test Φ on each.

Few sign conditions. For s polynomials of degree at most d in k variables, the number of realizable sign conditions, and even of connected components of their realizations, is at most (O(sd))k, much less than 3s when s is large. On the line: at most sd roots, hence at most 2sd+1 cells.
Sample points (Ch. 13). A set of points meeting every connected component of every realizable sign condition can be computed with sk+1dO(k) arithmetic operations. The method takes critical points of a well-chosen function on perturbed sets, with infinitesimals (module 4) to make everything bounded and non-singular, and is singly exponential in k, unlike a cylindrical decomposition.
Thom's lemma. For a univariate P of degree p, every sign condition on P,P′,…,P(p) is realized by an interval, a point, or nothing. Consequently two distinct real roots of P have different sign vectors on P′,…,P(p−1). That vector is the Thom encoding of the root: an exact name, and two encoded numbers can be compared by sign determination.

Explore

Examples
One row per polynomial: its graph (compressed) and its sign, positive negative. Dashed lines: roots of the product. Drag the blue marker along the line.

Worked example

Find the realizable sign conditions of P={x2−1, x2−4x+3}, decide whether x2<1∧x2−4x+3<0 has a solution, and give the Thom encodings of the roots of the second polynomial.

  1. Find the roots of the product and the cells of the line.

    x2−1 has roots ±1; x2−4x+3=(x−1)(x−3) has roots 1,3. The product's roots are −1,1,3, so there are 7 cells: (−∞,−1), {−1}, (−1,1), {1}, (1,3), {3}, (3,∞).

  2. Compute the sign vector on each cell.

    Using sample points −2, −1, 0, 1, 2, 3, 4: (+,+), (0,+), (−,+), (0,0), (+,−), (+,0), (+,+).

  3. Which sign conditions are realizable, and is the system solvable?

    Six of the nine: (+,+), (0,+), (−,+), (0,0), (+,−), (+,0). The condition (−,−) is not among them, so x2<1∧x2−4x+3<0 has no real solution. Neither do (−,0) and (0,−).

  4. Give the Thom encodings of the roots 1 and 3 of x2−4x+3.

    The derivative is 2x−4: negative at 1, positive at 3. The encodings (−) and (+) differ, as Thom's lemma guarantees. "Shared roots" in the explorer is a variant of this example.

Check your understanding

Three polynomials of degree 2 in one variable. At most how many sign conditions are realizable?

  1. 27That's 33, all conceivable ones; most can't occur.
  2. 13
  3. 7Three quadratics can have up to 6 roots in total, so up to 13 cells.
At most sd=6 roots cut the line into at most 2⋅6+1=13 cells, and each cell realizes one sign condition. In the explorer the first example has 5 distinct roots and 11 cells.

Why can two different real roots of P never have the same Thom encoding?

  1. Because all roots of P are simple.P may have multiple roots; the encoding still tells them apart.
  2. The set where P′,…,P(p) have the given signs is an interval or a point, and on it P is strictly monotone or the set is a single point, so P vanishes there at most once.
  3. Because P′ is nonzero at every root.At a multiple root P′ vanishes, and the encoding then records a 0.
This is Thom's lemma applied to P′: the realization of a sign condition on all derivatives is connected. If it is an interval, P′ has a constant nonzero sign on it, so P is strictly monotone there.

To decide ∃x (P(x)>0∧Q(x)<0) in one variable, it suffices to:

  1. check whether the sign condition (+,−) is realized, for example at one sample point in each cell cut out by the roots of PQ
  2. evaluate P and Q at the roots of PQ onlyA strict condition like this one is realized on intervals between the roots, not at them.
  3. check whether P−Q>0 somewhereThat is a different condition: P=3, Q=1 satisfies it.
Signs are constant on each cell, so finitely many sample points decide every quantifier-free condition in one variable. The algorithms of Ch. 13 do the same in k variables, with sample points meeting every connected component.

Practice

Thom encodings of a quarticSigns of three derivatives

P=x4−4x2+1 has the four real roots ±2±3≈±1.932, ±0.518. Find their Thom encodings (signs of P′,P″,P‴) and check they are distinct. Then use the "Thom encodings" example in the explorer.

Solution

P′=4x3−8x, P″=12x2−8, P‴=24x. At −1.932: (−,+,−). At −0.518: (+,−,−). At 0.518: (−,−,+). At 1.932: (+,+,+). All different. Note that P‴ alone separates the negative from the positive roots, and P″ then separates the two of each sign.

One polynomial, many cellsCells versus sign conditions

Show that a single polynomial realizes at most 3 sign conditions however many roots it has. Can two polynomials of degree 2 realize all 9 sign conditions in {−,0,+}2?

Hint

How many cells can two quadratics make, and how many of them are points?

Solution

One polynomial only has the values −,0,+. For two quadratics there are at most 4 roots and 9 cells, but at most 4 of the cells are points, while the conditions (0,0), (0,±), (±,0) (five of them) can only be realized at roots. So at most 4 of those five occur, and all 9 is impossible. With (0,0) realized, some root is shared, which leaves even fewer cells.