Elliptic curves
A cubic curve whose points can be added. Over the rationals the sum of two points with fraction coordinates is again one, exactly, and the questions become: which points come back to zero, how fast do the others grow, and what does the curve look like modulo each prime.
A curve and its points
A curve is given by a Weierstrass equation , written [a1, a2, a3, a4, a6], or by the short form , written [a, b]. The discriminant must not be zero: a cubic with a node or a cusp is refused.
import { ellipticCurve } from "@ratmath/numtheory";
const E = ellipticCurve([0, 0, 1, -1, 0]);
String(E); // "y² + y = x³ − x"
E.discriminant; // 37
E.j; // 110592/37
const P = E.point(0, 0); // checked to lie on the curve
E.add(P, P); // (1, 0)
E.mul(5, P); // (1/4, -5/8)
E.mul(7, P); // (-5/9, 8/27)
E.add(E.mul(5, P), E.mul(-5, P)); // { infinity: true }, the zero of the group
Points are { x, y } with Core Rational coordinates; the point at infinity, which is the zero of the group, is E.infinity. Wherever a point is expected, [x, y] works too.
The group law
A line meets a cubic in three points, counted properly. Declare that three points on a line add up to zero, with the point at infinity as zero. Then the negative of is the other point on the vertical line through it, , and is the negative of the third point on the line through and (the tangent line, when ). With the slope of that line and its intercept,
That this is associative is not obvious and is a theorem; the tests check it on thousands of triples. mul(k, P) uses doubling and adding, so the millionth multiple takes about forty steps, though its coordinates are enormous: the number of digits of grows like , which is what the height measures.
Torsion
A point of finite order is a torsion point. Two theorems make the torsion of a curve over computable. Nagell–Lutz: on a model with whole , a torsion point has whole coordinates and either or divides . Mazur: the torsion group is one of fifteen, for or for ; in particular no point has finite order above 12.
const T = ellipticCurve([1, 0, 1, -19, 26]); // y² + xy + y = x³ − 19x + 26
T.torsion().structure; // [2, 6]: the group is Z/2 × Z/6
T.torsion().points; // O, (-5, 2), (-2, -7), (-2, 8), (1, -4), (1, 2), (7/4, -11/8), (3, -2), (4, -7), (4, 2), (13, -52), (13, 38)
T.torsion().generators; // [(-5, 2), (-2, 8)], of orders 2 and 6
const S = ellipticCurve([-43, 166]); // y² = x³ − 43x + 166
S.order(S.point(3, 8)); // 7n
E.order(P); // Infinity: (0, 0) on y² + y = x³ − x never returns
torsion() moves to a short integral model, lists the candidate from the divisors of , finds the whole roots of each cubic, and keeps a candidate only if one of its first twelve multiples is zero. Note above: on the long model torsion points need not have whole coordinates; on the short model they do. The tests compare every answer with the curve modulo primes, since torsion embeds in at each odd prime of good reduction.
Minimal models and reduction
The same curve has many equations: gives another, with discriminant divided by . Among the equations with whole coefficients there is one with the smallest discriminant, and it is unique once and .
const M = ellipticCurve([-432, 8208]); // y² = x³ − 432x + 8208
M.discriminant; // -23944605696 = −2¹² · 3¹² · 11
const min = M.minimalModel();
String(min.curve); // "y² + y = x³ − x²"
min.curve.discriminant; // -11
min.u; // 6
min.to(M.point(-12, 108)); // (0, 0): points are carried along
Modulo a prime , the minimal model is either still an elliptic curve (good reduction, when does not divide the minimal discriminant), or it gets a node (multiplicative reduction) or a cusp (additive). A node is split when its two tangent directions are defined over .
M.badPrimes(); // [11n]
M.reduction(11); // { prime: 11n, type: "multiplicative", split: true, discriminantValuation: 1, conductorExponent: 1 }
M.conductor(); // 11n: this is the curve of smallest conductor
E.reduction(37); // multiplicative, split: false
ellipticCurve([-1, 0]).reduction(2); // additive; conductorExponent: null
The conductor multiplies for each multiplicative prime and for each additive prime . At 2 and 3 an additive prime can have a larger exponent, which takes Tate's algorithm to find; that is not here, so the exponent is reported as null and conductor() refuses rather than guess. Kodaira symbols and Tamagawa numbers are likewise not computed.
How the minimal model is found: at each prime the largest possible is tried, and the candidate invariants either belong to an equation with whole coefficients, which is then written down and checked, or they do not. Nothing is taken from a table of conditions.
Heights
The naive height of a point is for . Doubling a point roughly raises to the fourth power, and the canonical height makes that exact:
It is a quadratic form on the group, and it is how independence of points is measured. (This normalisation is the one used in the Birch and Swinnerton-Dyer conjecture and in the tables; Silverman's book uses half of it.)
E.naiveHeight(E.mul(7, P)); // 9n: x = -5/9
E.height(P); // { lower: 0.05021…, upper: 0.05193…, exact: false }
E.height(P, { doublings: 8 }); // { lower: 0.051052…, upper: 0.051160… }
T.height(T.point(1, 2)); // { lower: 0, upper: 0, exact: true }: a torsion point
The bounds are Rationals and they are proved, for the curve at hand. On the short model , with ,
So with the larger coefficient sum. The other direction needs to know that and cannot both be small or share a large factor. Because they have no common root, there are cubic forms with and ; the library finds them by solving an 8 by 8 linear system exactly. They show that divides and that for an explicit . Hence for every point, and summing the geometric series,
Applied to and divided by , this encloses in an interval whose width shrinks by 4 with each doubling. The logarithms of the large whole numbers are themselves enclosed between Rationals. For the point above, the known value is , the regulator of this curve.
Searching for points, and what is not here
rationalPoints(bound) lists the points whose x-coordinate has small height on the short model, by trying every candidate. It is a search: it shows points, and it proves nothing about the ones it did not reach. The rank of a curve, the number of independent points of infinite order, is not computed; no algorithm is known that always finds it.
E.rationalPoints(10); // (-1, -1), (-1, 0), (0, -1), (0, 0), (1/4, -5/8), (1/4, -3/8), (1, -1), (1, 0), (2, -3), (2, 2), …
For curves over finite fields, see Counting points; for what curves do for factoring and primality, see The elliptic curve method and Elliptic curve certificates.
@ratmath/numtheory and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.