Exact arithmetic, and what it costs instead

What a determinant does not determine

Two integer matrices can have the same determinant, the same rank and the same size, and define genuinely different maps. What separates them is a list of integers each dividing the next — computed here twice, once by unimodular elimination and once from the gcds of every minor, which share no algorithm at all.

Worth reading first: The number that decides nothing · Rank is a decision · An answer with no error in it.

The determinant decides nothing is an argument this site has already made in floating point: the number is a poor test for singularity, a poor measure of conditioning, and its scale is arbitrary. Over the integers it stops being arbitrary — it is an integer, it counts something, and it is exact — and it is still not enough to say what the matrix does.

An integer matrix is a map from ℤⁿ to ℤⁿ. Two such maps can have the same determinant and be different in a way that no rank, norm or spectrum records.

5 × 5: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 5 is the diagonal [1, 1, 1, 1, 22616], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 22616], and the two agree entry for entry. Their product is 22616, which is |det A| = 22616. The Hermite form of the same matrix reaches 24 bits against the Smith form's 15, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss514 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-2.3·10⁴Π invariants2.3·10⁴SNF widest15HNF widest24det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 1 The invariant factors of a five by five integer matrix, computed by unimodular elimination and again from the gcds of every minor of each order. Two routes with no algorithm in common, agreeing as integers.

What the list is

Every integer matrix can be brought by unimodular row and column operations — integer operations with integer inverses, so nothing about the lattice changes — to a diagonal form

diag(s₁, s₂, …, s_r, 0, …, 0)      with s₁ | s₂ | … | s_r

each entry dividing the next. That is the Smith normal form, the sᵢ are the invariant factors, and they are unique: no choice made during the elimination can change them.

The determinant is their product. The rank is how many are nonzero. The rank modulo p is how many are not divisible by p — which is the previous essay’s whole subject, and which the list makes into a triviality. And the quotient ℤⁿ divided by the image of the map is ℤ/s₁ ⊕ ℤ/s₂ ⊕ … , so the list is a complete description of what the map does to the lattice, of which every other invariant is a summary.

A random integer matrix has a dull one: on the five by five above the factors are 1, 1, 1, 1 and 22616, four trivial entries and one carrying the whole determinant. That is typical and it is a theorem-shaped fact rather than an accident — the cokernel of a random integer matrix is cyclic with high probability — but typical is exactly what makes the exceptions worth being able to detect.

Why the determinant cannot carry it

There is a reason no single number can, and it is worth stating because it explains why the invariant is a list rather than a better scalar.

The determinant is the product of the invariant factors, so it is one equation in r unknowns. On a five by five with factors 1, 1, 1, 1, 22616 it is satisfied by that list and by 2, 2, 2, 11, 257 and by every other factorisation of 22616 into an increasing divisor chain. The determinant is the volume of the image lattice’s fundamental cell; the invariant factors are the shape of it, and a volume never determined a shape.

The rank is the other summary and it is worse: it counts how many factors are nonzero and says nothing about any of them. Between them, rank and determinant fix the number of entries and their product, which on a large matrix is a very small part of the information.

This is the same relation the site keeps meeting between a norm and the object it summarises. Two condition numbers of one matrix are two summaries disagreeing about the same thing; a spectrum does not determine a graph; a singular value does not determine a rank. What is unusual here is that the complete invariant exists, is computable, and is not much longer than the summary — which is rarely the case and is the reason this essay can be about what a determinant leaves out rather than about how hard the question is.

Two routes, sharing nothing

The site’s habit is that every quantity is computed twice by routes that share no arithmetic, and here the two are unusually far apart.

The algorithm finds the smallest nonzero entry of the remaining block, moves it to the corner, and clears its row and column by integer division with remainder — repeating until the row and column are clear, which terminates because the corner entry strictly decreases whenever it does not. Then it recurses on the trailing block. It is a few dozen lines and it is fast.

The definition says s₁s₂…s_k is the greatest common divisor of all k × k minors. So computing the list from the definition means enumerating every k × k minor for every k, taking gcds, and dividing consecutive results. On a six by six that is 400 minors of orders one through six, each by cofactor expansion. It is exponential and it is the reason the figure stops at n = 6.

They agree, entry for entry, at every size drawn, which is a stronger statement than it sounds. The gcd of every k × k minor is a single integer distilled from hundreds of determinants, and it has to come out equal to a product of diagonal entries produced by a completely different process. There is no tolerance in the comparison and no way for a near miss to pass. Neither could have confirmed itself: the algorithm’s correctness is a sequence of claims about unimodular operations, and the definition’s is a claim about gcds of determinants, and there is no step in common where a shared mistake could hide.

The divisibility chain is not free

The refusal this essay carries is about a step that is easy to leave out because the code looks finished without it.

The elimination above reaches a diagonal. A diagonal reached by unimodular operations is not automatically a Smith normal form, because the divisibility chain can fail: an elimination can perfectly well produce diag(2, 3), and 2 does not divide 3. The determinant is right, the rank is right, and the invariant factors are 1 and 6 rather than 2 and 3.

The repair is a sweep: wherever sᵢ does not divide sᵢ₊₁, replace the pair by their gcd and their lcm, and repeat until nothing moves. That preserves the product and imposes the chain, and it is a genuine part of the algorithm rather than tidying.

Leaving it out gives a routine that returns the right determinant and the right rank and the wrong answer to every question the invariant factors are actually for — including which primes are unlucky, which is the question that sent this field here. The check against the minors catches it, which is what a second route is for.

5 × 5: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a pascal matrix of order 5 is the diagonal [1, 1, 1, 1, 1], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 1], and the two agree entry for entry. Their product is 1, which is |det A| = 1. The Hermite form of the same matrix reaches 7 bits against the Smith form's 7, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss50 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A1Π invariants1SNF widest7HNF widest7det of the transform1an algorithm and a definitionagreeing as integers
Fig. 2 Pascal, whose determinant is 1, so every invariant factor is 1: the map is an isomorphism of ℤⁿ, no prime is unlucky for it, and its rank is the same over every ring.

The two matrices the title is about

The abstract claim deserves the concrete pair, and it is small enough to write down.

A = [ 2  0 ]        B = [ 1  0 ]
    [ 0  3 ]            [ 0  6 ]

Both have determinant 6. Both have rank two over ℚ. Both are diagonal, symmetric, and have the same Frobenius norm to within a few per cent. Every summary this site normally reaches for treats them as the same kind of object.

They are different maps. A sends ℤ² onto the sublattice of pairs with the first coordinate even and the second a multiple of three; B sends it onto the pairs whose second coordinate is a multiple of six. The quotients are ℤ/2 ⊕ ℤ/3 and ℤ/1 ⊕ ℤ/6 — which are isomorphic, as it happens, since 2 and 3 are coprime, and the Smith form says so by returning 1, 6 for both.

So the honest small example is the one where the invariant factors agree and the diagonals do not, and it makes the point better than a pair where they differ: the diagonal an elimination reaches is not an invariant and the Smith form is. Change A to diag(2, 4) and the factors become 2, 4 rather than 1, 8, the quotient is ℤ/2 ⊕ ℤ/4 rather than ℤ/8, and now two matrices with determinant 8 and rank 2 are genuinely different maps that no determinant, rank, norm or spectrum separates.

That is the whole content of the form, and it is why the divisibility chain is the part that carries the information rather than an aesthetic preference for a tidy diagonal.

The other normal form, and what it costs

The Hermite normal form is the one-sided version: row operations only, reaching an upper triangular form with positive pivots and every entry above a pivot reduced modulo it. It describes the same lattice — the row space over ℤ — and it is what one computes to answer do these vectors generate that lattice.

Its cost is the field’s usual story in a new place, and it is worse than the Smith form’s.

The entries of the Hermite form itself are bounded, because each is reduced modulo a pivot. The transform is not: the unimodular matrix U with U·A = H accumulates every quotient the elimination used, and those grow. Measured on a five by five random matrix the Hermite form’s widest intermediate is 24 bits against the Smith form’s 15, and the gap widens with n.

That is the swell from the field’s first essay appearing in a routine with no fractions in it anywhere. It is not the fractions that grow — it is the coefficients of a combination, and any algorithm that reports how it reached its answer pays for the report.

The transform is unimodular, which is checkable and is checked: its determinant is exactly ±1 at every size, computed by the same fraction-free elimination the rest of the field uses. That is the conserved quantity here, and it is the one thing an implementation cannot get subtly wrong without being caught.

6 × 6: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 6 is the diagonal [1, 1, 1, 1, 1, 40098], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 1, 40098], and the two agree entry for entry. Their product is 40098, which is |det A| = 40098. The Hermite form of the same matrix reaches 27 bits against the Smith form's 16, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss50 bitss615 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-4·10⁴Π invariants4·10⁴SNF widest16HNF widest27det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 3 Six by six, where the definition is running 924 minors and the two routes still agree.

What it is for

Three uses, and none of them is a numerical one, which is worth saying plainly.

Deciding whether an integer system is solvable in integers. Ax = b has an integer solution exactly when the invariant factors divide the corresponding components of the transformed right-hand side. A rational solution always exists when A is nonsingular, and the essay on the answer’s length is about how long it is; whether it happens to be integral is a completely different question and this is the one that answers it.

Deciding which primes are unlucky, which the field has now met twice — for a determinant and for a rank — and which is exactly the primes dividing an invariant factor.

Describing a quotient group. The cokernel of an integer matrix is ℤ/s₁ ⊕ ℤ/s₂ ⊕ …, which for a graph’s Laplacian is the sandpile group and whose order is the number of spanning trees. That is the same integer the graph field computes from a determinant, and the invariant factors say not just how many trees there are but what the group of them is.

What a numerical reader should notice about the cost curve

This field has been consistent about one thing: the price of exactness is the length of the numbers, and different routes pay it differently. The normal forms add a case that does not fit the pattern and is worth flagging.

The Smith form’s output is short. Five ones and a fourteen-digit integer is barely more information than the determinant, and on a random matrix it is nearly the same information. So this is not a case like the exact solution’s length, where the answer itself is large and no route can avoid it.

What is expensive is the route, and the two available routes are expensive for unrelated reasons. The elimination grows its intermediates because it accumulates quotients; the definition is exponential because it enumerates minors. There is no known route that is cheap in both senses, which is unusual on this site — almost every other quantity here has one good algorithm and several bad ones, and the essays are about which is which.

That makes the normal forms the field’s outlier: a short answer with no cheap route to it. The practical consequence is that they are computed when they are needed and not as a diagnostic, which is why the unlucky-prime question is answered probabilistically in practice even though it has an exact answer sitting right here.

What is not here

Two things are outside what this essay measures and are worth stating rather than implying.

The cost of the Smith form on matrices of any size is genuinely bad, and the routine used here is the naive one: it terminates, its entries are bounded by the check against the minors, and it makes no attempt to control the growth that a modular or a Hermite-first approach would. Sizes above about ten are not affordable with it, which is why every figure here stops at six.

And the divisibility repair as implemented is a sweep to a fixed point rather than a single pass. That is correct and it is not the standard construction, which interleaves the chain with the elimination. Both reach the same unique answer, since the invariant factors do not depend on the route — which is the property being relied on, and it is also the property the check against the minors is testing.

Where the graph field meets this one

The clearest application on this site is one that has already been computed for a different reason, and putting the two together is worth a section.

A connected graph’s Laplacian has rank n − 1, so its Smith normal form has one zero and n − 1 nonzero invariant factors. The product of those factors is the number of spanning trees — which is Kirchhoff’s theorem, and which the graph field computes as a determinant of the grounded Laplacian. The invariant factors say more: the cokernel is ℤ/s₁ ⊕ … ⊕ ℤ/sₙ₋₁, and that group is the one whose elements are chip configurations on the graph modulo the moves that fire a vertex.

So two graphs with the same number of spanning trees can have different groups, exactly as two matrices with the same determinant can be different maps. And the pair the graph field found with identical characteristic polynomials — a triangle joined to a square, and K₂,₃ with a pendant edge, twelve spanning trees each — is a candidate for exactly that: same spectrum, same tree count, and a question about the group that the spectrum cannot answer.

That is the second time this field has supplied a finer invariant than a spectral one, and both times the finer invariant is integral. It is the standing reason the field is placed after graph rather than beside cost: the objects it separates are ones the graph field could see were different and had no instrument for.

At other settings

3 × 3: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 3 is the diagonal [1, 1, 330], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 330], and the two agree entry for entry. Their product is 330, which is |det A| = 330. The Hermite form of the same matrix reaches 6 bits against the Smith form's 6, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss38 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-330Π invariants330SNF widest6HNF widest6det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 4 Three by three, the smallest size where the chain can fail and be repaired.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 4 is the diagonal [1, 1, 1, 4386], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 4386], and the two agree entry for entry. Their product is 4386, which is |det A| = 4386. The Hermite form of the same matrix reaches 13 bits against the Smith form's 13, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss412 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-4386Π invariants4386SNF widest13HNF widest13det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 5 Four by four, where the definition enumerates fifty minors.
5 × 5: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a wide matrix of order 5 is the diagonal [1, 1, 1, 1, 2580458337283640], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 2580458337283640], and the two agree entry for entry. Their product is 2580458337283640, which is |det A| = 2580458337283640. The Hermite form of the same matrix reaches 106 bits against the Smith form's 52, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss551 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-2.6·10¹⁵Π invariants2.6·10¹⁵SNF widest52HNF widest106det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 6 Three-digit entries, where the last invariant factor is fourteen digits and the first four are still one.
6 × 6: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a unitriangular matrix of order 6 is the diagonal [1, 1, 1, 1, 1, 1], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 1, 1], and the two agree entry for entry. Their product is 1, which is |det A| = 1. The Hermite form of the same matrix reaches 1 bits against the Smith form's 1, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss50 bitss60 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A1Π invariants1SNF widest1HNF widest1det of the transform1an algorithm and a definitionagreeing as integers
Fig. 7 Unit triangular, where the map is an isomorphism and every factor is 1.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a hilbert matrix of order 4 is the diagonal [1, 7, 7, 105], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 7, 7, 105], and the two agree entry for entry. Their product is 5145, which is |det A| = 5145. The Hermite form of the same matrix reaches 9 bits against the Smith form's 9, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss23 bitss33 bitss47 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A5145Π invariants5145SNF widest9HNF widest9det of the transform1an algorithm and a definitionagreeing as integers
Fig. 8 The integer Hilbert family, whose invariant factors carry the enormous determinant its conditioning is famous for.
One 6 × 6 integer matrix, 3 different ranksThe same matrix of integers, its rank computed exactly with no rounding and no threshold anywhere, over the rationals and over the fields with 2, 3, 5, 7, 11, 13, 101, 65537 elements. Over ℚ the rank is 6; over 𝔽2 and 𝔽3 it is 4 and 5. Nothing has been approximated and nothing has been decided by a tolerance — the eliminations are exact in every case, and there is no small number anywhere for a threshold to be compared against. The rank is not a property of the array of numbers; it is a property of the array together with the ring the entries are read in, and a modular algorithm that reports a rank has reported the second one.6𝔽24𝔽35𝔽56𝔽76𝔽116𝔽136𝔽1016𝔽655376rank, by the ring the entries are read inthe rank of one matrixover ℚ6over 𝔽24over 𝔽35over 𝔽56over 𝔽76nothing is rounded hereand the answer still is not a property of the matrix
Fig. 9 The ranks the invariant factors predict, over eight rings.
det A = 30030, and its residue at 30 primes — 5 of which divide itEach dot is det A mod p, drawn as a fraction of p so the primes are comparable. A dot on the floor is a prime at which the elimination reports a singular matrix — and the matrix is not singular: its determinant is 30030. 5 of 30 primes here are unlucky, a rate of 16.7 per cent, which is what it looks like when the primes are small. At the 26-bit primes a modular determinant actually uses, a prime divides a 15-bit determinant with probability of order 2.24·10⁻⁷ — but the consequence is unchanged, and there is no way to see it from one residue. What sees it is the budget: computing more residues than Hadamard's bound requires, and refusing to reconstruct when the extra ones disagree.det mod p, as a fraction of p3713a prime that divides the answerdet A3·10⁴primes swept30unlucky5rate0.17det, in bits15singular mod p is not singularand one residue cannot tell them apart
Fig. 10 The primes dividing the last invariant factor, which are the unlucky ones and the only ones.
8 × 8: three exact determinants agree to the digit, and the float one does notdet A = -8650618 on a random matrix of order 8, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 2 word-sized primes put back together by the Chinese remainder theorem. The three differ by exactly zero — as integers, not to a tolerance. The floating-point LU of the same matrix returns -8.650618·10⁶, a relative error of 2.153·10⁻¹⁶, which is what a determinant of 24 bits does to a significand of 53. The modular route's entries never exceed 26 bits, which is why the number of primes has to be decided in advance: Hadamard's bound says 33 bits are needed and 2 primes supply them.Bareiss24 bitsrationals23 bitsmodular26 bitsthe answer24 bitsHadamard33 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 2 primes0floating-point LU2.2·10⁻¹⁶det A = -8650618three routes, one integerand no tolerance anywhere in the comparison
Fig. 11 The product of the invariant factors, computed three ways without ever computing them.
One lattice, two bases: an orthogonality defect of 7.071 reduced to 1The dots are the lattice generated by (1, 0) and (7, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 7.0711 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before7.1defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 12 The lattice these forms are descriptions of, and a basis that describes it badly.
Backward stable at every size, and wrong from n = 16The number of spanning trees of the complete graph on n vertices, by Kirchhoff's theorem: the determinant of the Laplacian with one row and column deleted, which is nⁿ⁻² by Cayley's formula and is therefore a whole number known in advance. It is computed twice — in BigInt rationals, where the answer is exact, and by the site's own pivoted elimination in binary64. The filled curve is the relative error of the elimination, which never leaves the rounding level: worst 6·10⁻¹⁵ across the whole range, so the algorithm is backward stable at every size. The dashed curve is the spacing between consecutive doubles at the answer's own magnitude, relative to the answer. Where they cross, at n = 16, the count has 17 digits and a binary64 has sixteen: rounding to the nearest integer cannot recover it, because the nearest two representable numbers there are 8 apart. The error is committed by the format and not by the elimination, which is a distinction no residual can make.5791113151710⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹vertices of the complete graphrelative sizethe algorithm is not the problemsizes counted14worst relative error6·10⁻¹⁵first wrong at n =16digits in the answer17spacing of doubles there8largest integer a double holds9·10¹⁵the elimination stays at the rounding levelthe format runs out
Fig. 13 A spanning-tree count, which is the order of the cokernel of a graph’s Laplacian.
Three exact eliminations of the same random matrix, and the widest number each one formsEvery route here returns the same determinant exactly, so there is no error to plot and the y-axis is the length of the intermediates in bits. At n = 10 the answer itself is 37 bits and Hadamard's bound allows 42. Fraction-free elimination never forms a number wider than 37 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 36 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 30683 bits — 829 times the width of the fraction-free route and 829 times the width of the answer. All three are correct.345678910110¹10²10³10⁴nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn10answer37Hadamard bound42fraction-free37reduced rationals36unreduced3.1·10⁴the error is zero on every curvethe cost is the length of the numbers
Fig. 14 The growth that appears in the Hermite transform without any fractions being involved.
log₁₀|det H_n| by three routes, to n = 22The exact rational determinant of the Hilbert matrix falls to 10^-274 at n = 22. The accumulated logarithm of the pivots follows it to n = 13 and then departs, reaching 10^-225 — wrong by 49 orders of magnitude and still an ordinary-looking number. The product of the pivots is a separate curve that ends at n = 22, where it underflows to exactly zero.25811141720-300-250-200-150-100-500nlog₁₀|det H_n|exact rationalΣ log|u_ii|Π u_iithree routes, one theoremexact at the largest n-274accumulated logarithm-225decades of disagreement49smallest pivot at that n4·10⁻¹⁷every pivot is a normal numberat every size on this axis
Fig. 15 The float determinant, which is the summary this essay is about the inadequacy of.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a wide matrix of order 4 is the diagonal [1, 1, 1, 715250895253], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 715250895253], and the two agree entry for entry. Their product is 715250895253, which is |det A| = 715250895253. The Hermite form of the same matrix reaches 65 bits against the Smith form's 40, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss439 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-7.2·10¹¹Π invariants7.2·10¹¹SNF widest40HNF widest65det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 16 Wide entries at order four, where the definition runs fifty minors.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a unitriangular matrix of order 4 is the diagonal [1, 1, 1, 1], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1], and the two agree entry for entry. Their product is 1, which is |det A| = 1. The Hermite form of the same matrix reaches 1 bits against the Smith form's 1, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A1Π invariants1SNF widest1HNF widest1det of the transform1an algorithm and a definitionagreeing as integers
Fig. 17 An isomorphism of the lattice, with every invariant factor 1.
5 × 5: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a hilbert matrix of order 5 is the diagonal [1, 3, 6, 42, 504], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 3, 6, 42, 504], and the two agree entry for entry. Their product is 381024, which is |det A| = 381024. The Hermite form of the same matrix reaches 12 bits against the Smith form's 14, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss22 bitss33 bitss45 bitss59 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A3.8·10⁵Π invariants3.8·10⁵SNF widest14HNF widest12det of the transform1an algorithm and a definitionagreeing as integers
Fig. 18 The integer Hilbert family, whose last invariant factor is enormous.
One 5 × 5 integer matrix, 3 different ranksThe same matrix of integers, its rank computed exactly with no rounding and no threshold anywhere, over the rationals and over the fields with 2, 3, 5, 7, 11, 13, 101, 65537 elements. Over ℚ the rank is 5; over 𝔽2 and 𝔽3 it is 3 and 4. Nothing has been approximated and nothing has been decided by a tolerance — the eliminations are exact in every case, and there is no small number anywhere for a threshold to be compared against. The rank is not a property of the array of numbers; it is a property of the array together with the ring the entries are read in, and a modular algorithm that reports a rank has reported the second one.5𝔽23𝔽34𝔽55𝔽75𝔽115𝔽135𝔽1015𝔽655375rank, by the ring the entries are read inthe rank of one matrixover ℚ5over 𝔽23over 𝔽34over 𝔽55over 𝔽75nothing is rounded hereand the answer still is not a property of the matrix
Fig. 19 The ranks the invariant factors predict, at order five.
One 8 × 8 integer matrix, 3 different ranksThe same matrix of integers, its rank computed exactly with no rounding and no threshold anywhere, over the rationals and over the fields with 2, 3, 5, 7, 11, 13, 101, 65537 elements. Over ℚ the rank is 8; over 𝔽2 and 𝔽3 it is 6 and 7. Nothing has been approximated and nothing has been decided by a tolerance — the eliminations are exact in every case, and there is no small number anywhere for a threshold to be compared against. The rank is not a property of the array of numbers; it is a property of the array together with the ring the entries are read in, and a modular algorithm that reports a rank has reported the second one.8𝔽26𝔽37𝔽58𝔽78𝔽118𝔽138𝔽1018𝔽655378rank, by the ring the entries are read inthe rank of one matrixover ℚ8over 𝔽26over 𝔽37over 𝔽58over 𝔽78nothing is rounded hereand the answer still is not a property of the matrix
Fig. 20 And at order eight, where two invariant factors are even.
det A = 30030, and its residue at 44 primes — 5 of which divide itEach dot is det A mod p, drawn as a fraction of p so the primes are comparable. A dot on the floor is a prime at which the elimination reports a singular matrix — and the matrix is not singular: its determinant is 30030. 5 of 44 primes here are unlucky, a rate of 11.4 per cent, which is what it looks like when the primes are small. At the 26-bit primes a modular determinant actually uses, a prime divides a 15-bit determinant with probability of order 2.24·10⁻⁷ — but the consequence is unchanged, and there is no way to see it from one residue. What sees it is the budget: computing more residues than Hadamard's bound requires, and refusing to reconstruct when the extra ones disagree.det mod p, as a fraction of p311a prime that divides the answerdet A3·10⁴primes swept44unlucky5rate0.11det, in bits15singular mod p is not singularand one residue cannot tell them apart
Fig. 21 The primes dividing the last invariant factor, swept further out.
6 × 6: three exact determinants agree to the digit, and the float one does notdet A = -40098 on a random matrix of order 6, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 1 word-sized prime put back together by the Chinese remainder theorem. The three differ by exactly zero — as integers, not to a tolerance. The floating-point LU of the same matrix returns -4.0098·10⁴, a relative error of 3.629·10⁻¹⁶, which is what a determinant of 16 bits does to a significand of 53. The modular route's entries never exceed 26 bits, which is why the number of primes has to be decided in advance: Hadamard's bound says 23 bits are needed and 1 prime supplies them.Bareiss16 bitsrationals13 bitsmodular26 bitsthe answer16 bitsHadamard23 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 1 prime0floating-point LU3.6·10⁻¹⁶det A = -40098three routes, one integerand no tolerance anywhere in the comparison
Fig. 22 Their product, computed three exact ways.
Three exact eliminations of the same random matrix, and the widest number each one formsEvery route here returns the same determinant exactly, so there is no error to plot and the y-axis is the length of the intermediates in bits. At n = 9 the answer itself is 25 bits and Hadamard's bound allows 37. Fraction-free elimination never forms a number wider than 25 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 25 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 5947 bits — 238 times the width of the fraction-free route and 238 times the width of the answer. All three are correct.3456789110¹10²10³10⁴nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn9answer25Hadamard bound37fraction-free25reduced rationals25unreduced5947the error is zero on every curvethe cost is the length of the numbers
Fig. 23 The growth a Hermite transform suffers with no fractions in it.
One lattice, two bases: an orthogonality defect of 20.02 reduced to 1The dots are the lattice generated by (1, 0) and (20, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 20.025 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before20defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 24 A basis of the lattice these forms are canonical descriptions of.
The exact solution of a random system is longer than the systemAx = b with A a random integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 8 the question occupies 256 bits — 8² entries of 4 bits each — and the answer occupies 377, a ratio of 1.47. Every entry is a ratio of two determinants by Cramer's rule, checked here by multiplying each one back by det A and comparing it with the determinant of the column-replaced matrix as an integer — so every denominator divides det A and none of them is longer than its 24 bits, while a numerator can be, at 25 here. The answer IS that long, whatever route produced it. That is a floor no exact solver can get under, and it is why the modular route reconstructs the answer rather than eliminating its way to it.34567810²nbitsthe answerthe question · det Abits in, bits outn8question256answer377det A24widest part25the answer is the floorand no route writes it down more cheaply
Fig. 25 Whether a system of this kind has an integral answer is a different question.
6 × 6: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a random matrix of order 6 is the diagonal [1, 1, 1, 1, 1, 40098], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1, 1, 40098], and the two agree entry for entry. Their product is 40098, which is |det A| = 40098. The Hermite form of the same matrix reaches 27 bits against the Smith form's 16, and its transform has determinant -1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitss50 bitss615 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A-4·10⁴Π invariants4·10⁴SNF widest16HNF widest27det of the transform-1an algorithm and a definitionagreeing as integers
Fig. 26 Six by six, where the definition runs 924 minors.
4 × 4: the invariant factors, computed twice by routes with no algorithm in commonThe Smith normal form of a pascal matrix of order 4 is the diagonal [1, 1, 1, 1], reached by unimodular row and column operations, with each entry dividing the next — a property the elimination does not give and which has to be enforced and asserted. The same numbers computed from the definition — the gcd of all k × k minors, over the gcd of all (k−1) × (k−1) minors — are [1, 1, 1, 1], and the two agree entry for entry. Their product is 1, which is |det A| = 1. The Hermite form of the same matrix reaches 5 bits against the Smith form's 5, and its transform has determinant 1, so the lattice the rows generate is unchanged.s10 bitss20 bitss30 bitss40 bitsinvariant factors, in bitstwo routes, and a conserved quantitydet A1Π invariants1SNF widest5HNF widest5det of the transform1an algorithm and a definitionagreeing as integers
Fig. 27 Pascal at order four, every invariant factor 1.
One 9 × 9 integer matrix, 3 different ranksThe same matrix of integers, its rank computed exactly with no rounding and no threshold anywhere, over the rationals and over the fields with 2, 3, 5, 7, 11, 13, 101, 65537 elements. Over ℚ the rank is 9; over 𝔽2 and 𝔽3 it is 7 and 8. Nothing has been approximated and nothing has been decided by a tolerance — the eliminations are exact in every case, and there is no small number anywhere for a threshold to be compared against. The rank is not a property of the array of numbers; it is a property of the array together with the ring the entries are read in, and a modular algorithm that reports a rank has reported the second one.9𝔽27𝔽38𝔽59𝔽79𝔽119𝔽139𝔽1019𝔽655379rank, by the ring the entries are read inthe rank of one matrixover ℚ9over 𝔽27over 𝔽38over 𝔽59over 𝔽79nothing is rounded hereand the answer still is not a property of the matrix
Fig. 28 The ranks those factors predict at order nine.
8 × 8: three exact determinants agree to the digit, and the float one does notdet A = 3458508270104059228258152 on a wide matrix of order 8, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 4 word-sized primes put back together by the Chinese remainder theorem. The three differ by exactly zero — as integers, not to a tolerance. The floating-point LU of the same matrix returns 3.45850827·10²⁴, a relative error of 3.105·10⁻¹⁶, which is what a determinant of 82 bits does to a significand of 53. The modular route's entries never exceed 26 bits, which is why the number of primes has to be decided in advance: Hadamard's bound says 87 bits are needed and 4 primes supply them.Bareiss82 bitsrationals77 bitsmodular26 bitsthe answer82 bitsHadamard87 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 4 primes0floating-point LU3.1·10⁻¹⁶det A = 3458508270104059228258152three routes, one integerand no tolerance anywhere in the comparison
Fig. 29 Their product, on wide entries.
det A = 30030, and its residue at 36 primes — 5 of which divide itEach dot is det A mod p, drawn as a fraction of p so the primes are comparable. A dot on the floor is a prime at which the elimination reports a singular matrix — and the matrix is not singular: its determinant is 30030. 5 of 36 primes here are unlucky, a rate of 13.9 per cent, which is what it looks like when the primes are small. At the 26-bit primes a modular determinant actually uses, a prime divides a 15-bit determinant with probability of order 2.24·10⁻⁷ — but the consequence is unchanged, and there is no way to see it from one residue. What sees it is the budget: computing more residues than Hadamard's bound requires, and refusing to reconstruct when the extra ones disagree.det mod p, as a fraction of p311a prime that divides the answerdet A3·10⁴primes swept36unlucky5rate0.14det, in bits15singular mod p is not singularand one residue cannot tell them apart
Fig. 30 The primes dividing the last one.
Three exact eliminations of the same wide matrix, and the widest number each one formsEvery route here returns the same determinant exactly, so there is no error to plot and the y-axis is the length of the intermediates in bits. At n = 9 the answer itself is 91 bits and Hadamard's bound allows 98. Fraction-free elimination never forms a number wider than 91 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 89 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 182755 bits — 2010 times the width of the fraction-free route and 2010 times the width of the answer. All three are correct.3456789110¹10²10³10⁴10⁵nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn9answer91Hadamard bound98fraction-free91reduced rationals89unreduced1.8·10⁵the error is zero on every curvethe cost is the length of the numbers
Fig. 31 The Hermite transform’s growth, in the field’s unit.
One lattice, two bases: an orthogonality defect of 5.099 reduced to 1The dots are the lattice generated by (1, 0) and (5, 1) — every one of them, out to ±4 in each coefficient. The long pair of arrows is that basis; the short pair is what LLL returns after 1 steps, in exact rational arithmetic with δ = 3/4. The two bases generate the same set of points, which is checked rather than drawn: the lattice determinant is 1 before and 1 after, and every step of the reduction is a unimodular operation, which is what makes that so. What the reduction changes is the orthogonality defect — the product of the basis vectors' lengths over the determinant — from 5.099 to 1. One is the floor, and it is attained only by an orthogonal basis.the same lattice, twicewhat the reduction may not changedet, before1det, after1defect, before5.1defect, after1LLL steps1the determinant is the invariantand the defect is what is being reduced
Fig. 32 A lattice, and a basis that describes it badly.
The determinant's length, and the bound that decides how many primes to use before any of them is chosenSolid: Hadamard's bound on |det A|, the product of the row 2-norms, in bits. Dotted: the determinant's actual length. The bound is what a modular determinant budgets against — at n = 10 the random family needs 42 bits, which is 2 word-sized primes at 26 bits each, and that count is fixed before the first residue is computed. On a Sylvester Hadamard matrix of order 8 the bound is 13 bits and the determinant has 13, so the bound is attained rather than merely satisfied. On the unit triangular family the determinant is 1 at every size while the bound grows, which is the gap the budget pays for: a matrix can have a determinant of one and rows that are long.345678910110¹10²nbitsthe budget and what it buysrandom, bound42random, actual37primes needed2Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 33 Hadamard bounding the determinant these factors multiply to.

What links here

Computed from the collection, not written here: the essays that point at this one.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

DeterminantExact arithmeticHermite normal formInvariant factorsLatticeSmith normal formUnimodular