Ideals
An ideal is everything that follows from a set of polynomial equations by adding and multiplying. This page is the dictionary between ideals and the shapes their equations cut out, and how each entry is computed.
Ideals
Let . An ideal of is a set of polynomials closed under addition and under multiplication by any polynomial. The ideal generated by is the set of all combinations
These are exactly the equations that follow from by adding and multiplying. Hilbert's basis theorem says every ideal of is generated by finitely many polynomials, so every ideal can be held as a list.
The same ideal has many generating lists. To compare ideals, or to test whether a polynomial is in one, the library computes a Gröbner basis, the first time it is needed.
import { ring, ideal } from "@ratmath/structures";
const R = ring("x, y, z");
const I = ideal(R, ["x z - y^2", "x^3 - z^2"]);
String(I); // "(−y² + xz, x³ − z²)"
I.contains("x^3 z - y^2 z^2"); // false
I.contains("x^4 z - x z^3"); // true: x z · (x³ − z²)
String(I.reduce("y^4")); // "x²z²": the normal form of y⁴ modulo I
I.dimension; // 1: the solution set is a curve
I.equals(ideal(R, ["y^2 - x z", "z^2 - x^3", "x^4 z - x z^3"])); // true
Algebra and geometry
An ideal has a solution set , the points where every polynomial of vanishes. Operations on ideals correspond to operations on solution sets:
| Ideals | Solution sets | Method |
|---|---|---|
| (generators of both) | I.add(J) | |
| (products of generators) | I.mul(J) | |
I.intersect(J) | ||
| contains | I.quotient(J) | |
| (saturation) | the closure of | I.saturate(f) |
| the closure of the projection | I.eliminate(vars) | |
| the same set | I.radical() |
The product and the intersection have the same solutions, and always, but they can differ as ideals: while .
const A = ideal(R, ["x", "y"]); // the z-axis
const B = ideal(R, ["z"]); // the plane z = 0
String(A.add(B)); // "(x, y, z)": the origin
A.intersect(B).basis.map(String); // ["yz", "xz"]: the axis together with the plane
A.mul(B).equals(A.intersect(B)); // true here
const S = ring("x, y");
const J = ideal(S, ["x^2", "x y"]); // the y-axis, with something extra at the origin
J.quotient("x").basis.map(String); // ["y", "x"]
J.radical().basis.map(String); // ["x"]
J.saturate("y").basis.map(String); // ["x"]: away from y = 0 the ideal is just (x)
Intersections are computed with a classical trick: introduce a new variable , form , and eliminate . The quotient by one polynomial is , and saturation adds and eliminates .
Elimination
The elimination theorem: if is a Gröbner basis of for an order in which every monomial containing ranks above every monomial without them, then the elements of that do not involve are a Gröbner basis of . So eliminating variables is a matter of choosing the order and reading off part of the basis.
A typical use is finding the equation of a curve or surface given by parameters. The curve , is the solution set of in -space, projected to the -plane:
const T = ring("t, x, y");
ideal(T, ["x - t^2 + 1", "y - t^3 + t"]).eliminate("t").basis.map(String);
// ["x³ + x² − y²"]: the nodal cubic y² = x²(x + 1)
const U = ring("s, t, x, y, z");
ideal(U, ["x - s t", "y - s", "z - t^2"]).eliminate(["s", "t"]).basis.map(String);
// ["y²z − x²"]: the Whitney umbrella
Compare resultants, which eliminate one variable from two polynomials. Elimination ideals handle any number of each and add no extra factors.
Radicals and the Nullstellensatz
Different ideals can have the same solutions: and both describe . The radical is the set of polynomials some power of which lies in . Hilbert's Nullstellensatz says that over an algebraically closed field such as the complex numbers,
and in particular is empty exactly when . So "does follow from the equations?" has a definite algebraic answer, and it can be tested without finding the radical: exactly when for a new variable (Rabinowitsch's trick).
const Q = ideal(S, ["x^2", "y^3"]);
Q.contains("x + y"); // false
Q.radicalContains("x + y"); // true
Q.exponentOf("x + y"); // 4: (x + y)⁴ is in Q and (x + y)³ is not
const cert = Q.radicalContains("x + y", { certificate: true });
cert.power; // 4
cert.cofactors.map(String); // ["x² + 4xy + 6y²", "4x + y"]
// (x + y)⁴ = (x² + 4xy + 6y²)·x² + (4x + y)·y³, and cert.check confirms it
The certificate is a proof: an explicit identity that can be checked by multiplying out. This is how a theorem of geometry is proved by algebra: write the hypotheses as polynomial equations, and show the conclusion lies in the radical of the ideal they generate.
I.radical() itself is computed for ideals with finitely many solutions (by adding the square-free part of each variable's minimal polynomial, a method due to Seidenberg), for ideals with one generator, and for ideals generated by monomials. It throws for the rest; radicalContains works for every ideal.
Prime and maximal ideals
An ideal is prime when forces or ; its solution set cannot be split into two smaller ones. It is maximal when no proper ideal is larger; over the complex numbers the maximal ideals are the single points . Over the rationals a maximal ideal is a point together with all its conjugates.
ideal(S, ["x^2 + y^2 - 1"]).isPrime(); // true: the circle is one piece
ideal(S, ["x y"]).isPrime(); // false: two lines
ideal(S, ["x - 1", "y - 2"]).isMaximal(); // true: the point (1, 2)
ideal(S, ["x^2 - 2", "y - x"]).isMaximal(); // true: the pair (±√2, ±√2), one point over Q
ideal(S, ["x^2 - 1", "y"]).isMaximal(); // false: two rational points
isMaximal is decided over Q for every ideal. isPrime is decided for ideals with finitely many solutions, for one generator, and for linear generators, and returns null otherwise: a general test needs primary decomposition, which this library does not have.
@ratmath/structures and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.