Exact arithmetic, and what it costs instead

Every intermediate is a minor

Fraction-free elimination divides by the previous pivot at every step and the division is always exact. Not usually, not for these entries — always, because the number being divided is a determinant with that pivot as a factor, which is a theorem and is checked here against the minors themselves.

Worth reading first: Elimination is a sequence of choices · The number that decides nothing · An answer with no error in it.

An elimination over the integers has an obvious problem: the step that removes an entry needs a division, and integers are not closed under it. The standard repair is to move to the rationals and pay the price the previous essay measured — either a greatest common divisor on every operation, or a million and a half bits.

There is a third repair, and it looks at first like a trick. Do not divide by the pivot. Multiply through by it, subtract, and then divide the whole thing by the pivot from the previous step:

aᵢⱼ  ←  (aₖₖ·aᵢⱼ  −  aᵢₖ·aₖⱼ) / aₖ₋₁,ₖ₋₁

with the convention that the pivot before the first step is 1. Every quantity in that line is an integer, and the claim is that the quotient is an integer too — at every step, on every matrix, with no fallback and no remainder.

Every boxed entry is a 3 × 3 minor of the matrix beside itA 5 × 5 random matrix and its state after 2 steps of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 25 divisions came out exact. The reason is that the entry at (i, j) is exactly the 3 × 3 minor of the ORIGINAL matrix on rows 0…1 and i, columns 0…1 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 9 bits.1-2-6-7-474-26-12-5-8-524-394151435A, the matrix as given1-2-6-7-401840552700112217207003943011710017279153after 2 fraction-free steps3 × 3 minors25 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 1 A five by five integer matrix and its state after two fraction-free steps. Every entry in the boxed block is a three by three minor of the matrix on the left, and every division that produced one came out whole.

It is not a trick, and the reason is the whole content of this essay.

What the entry is

After k steps of the recurrence above, the entry at position (i, j) is not “the matrix, partly eliminated”. It is exactly this determinant:

| a₀,₀  …  a₀,ₖ₋₁   a₀,ⱼ  |
|  ⋮          ⋮        ⋮   |
| aₖ₋₁,₀ … aₖ₋₁,ₖ₋₁  aₖ₋₁,ⱼ |
| aᵢ,₀   …  aᵢ,ₖ₋₁   aᵢ,ⱼ  |

a (k+1) × (k+1) minor of the original matrix, on the first k rows together with row i, and the first k columns together with column j. Not of the partly-eliminated matrix. Of the matrix as it arrived.

That is Sylvester’s identity, and once it is stated the exactness of the division is not a separate fact. The numerator formed by the step is a (k+1) × (k+1) determinant multiplied by the k × k one sitting above it, and the thing being divided out is that k × k determinant. The quotient is a determinant, so it is an integer.

Checked against the minors, not against a second elimination

The claim is easy to state and easy to believe, which is exactly the situation in which this site insists on a second route. So the check is a cofactor expansion of the original matrix: for each boxed entry, the minor Sylvester’s identity names is computed by the definition, recursively, without any elimination anywhere in it, and compared to the entry as an integer.

That is deliberately the slow route. An elimination checked against a faster elimination shares every assumption that could be wrong; the two agree because they are the same argument written twice. The cofactor expansion is exponential in the size of the minor and it is affordable at these sizes precisely because these sizes are the ones the figure prints.

Every boxed entry is a 4 × 4 minor of the matrix beside itA 6 × 6 random matrix and its state after 3 steps of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 50 divisions came out exact. The reason is that the entry at (i, j) is exactly the 4 × 4 minor of the ORIGINAL matrix on rows 0…2 and i, columns 0…2 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 12 bits.1-2-6-7-474-26-12-5-8-524-394151435-6-5-33-29-46184A, the matrix as given1-2-6-7-4706302718-3300354255168-3030009210382500036813054-3795000290423883342after 3 fraction-free steps4 × 4 minors50 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 2 Six by six, after three steps, where each boxed entry is a four by four minor and the cofactor check is running twenty-four determinants of order four.

There is one thing the check cannot cover and it is worth saying rather than hiding. Sylvester’s identity is about the matrix in the order the rows arrived. If a pivot is zero and the elimination interchanges rows, the intermediates are minors of the permuted matrix, and the check as written declines to run rather than reporting a false agreement. Every family drawn here has nonzero pivots throughout, and the routine that computes determinants for the rest of the field does interchange rows and does not make the minor claim.

What it costs, which is the point

The exactness is pleasant. The reason the algorithm exists is the size bound that follows from it.

An intermediate is a minor, so its magnitude is bounded by Hadamard’s bound on that minor: the product of the two-norms of the k+1 rows involved. For entries of b bits that is at most (k+1)·(b + ½log(k+1)) bits — linear in the step index. The elimination cannot form a number much larger than the determinant it is heading for, because everything it forms is a determinant of a submatrix.

Compare that with the unreduced rational recurrence, where the new numerator is a product of two old numerators and the length doubles per step. One is arithmetic that stays inside the answer’s own scale; the other leaves it in the third step and never comes back.

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 = 12 the answer itself is 40 bits and Hadamard's bound allows 52. Fraction-free elimination never forms a number wider than 40 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 39 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 1422165 bits — 35600 times the width of the fraction-free route and 35600 times the width of the answer. All three are correct.3456789101112110¹10²10³10⁴10⁵10⁶nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn12answer40Hadamard bound52fraction-free40reduced rationals39unreduced1.4·10⁶the error is zero on every curvethe cost is the length of the numbers
Fig. 3 The bound in practice. The fraction-free curve tracks the determinant’s own length within a bit or two at every size, and the unreduced rational curve is a straight line on a logarithmic axis, which is what doubling per step looks like.

The step, entry by entry

The recurrence is short enough to follow completely on a four by four, and following it is the fastest way to see why the previous pivot is the right thing to divide by.

At the first step the previous pivot is 1, so the step is just aₖₖ·aᵢⱼ − aᵢₖ·aₖⱼ: every new entry is an ordinary two by two determinant of the original matrix. Nothing has been divided yet and nothing needs to be.

Every boxed entry is a 2 × 2 minor of the matrix beside itA 4 × 4 random matrix and its state after 1 step of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 9 divisions came out exact. The reason is that the entry at (i, j) is exactly the 2 × 2 minor of the ORIGINAL matrix on rows 0…0 and i, columns 0…0 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 6 bits.1-2-6-7-474-26-12-5-8-524A, the matrix as given1-2-6-70-1-20-3001138370-21-46-52after 1 fraction-free step2 × 2 minors9 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 4 One step on a four by four. Every boxed entry is a two by two determinant of the matrix beside it, formed by one multiply-multiply-subtract and no division at all.

At the second step the entries being combined are already two by two determinants, so their products are four factors deep and the result is a four-factor quantity where a three by three determinant is wanted. What removes the surplus factor is precisely the two by two determinant that was the pivot — which is why the divisor is the previous pivot and not the current one, and why it is a single division rather than a search for a common factor.

Every boxed entry is a 3 × 3 minor of the matrix beside itA 4 × 4 random matrix and its state after 2 steps of fraction-free elimination. Each of the 4 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 13 divisions came out exact. The reason is that the entry at (i, j) is exactly the 3 × 3 minor of the ORIGINAL matrix on rows 0…1 and i, columns 0…1 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 10 bits.1-2-6-7-474-26-12-5-8-524A, the matrix as given1-2-6-70-1-20-300018229300-374-578after 2 fraction-free steps3 × 3 minors13 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 5 The second step of the same matrix, where the divisions begin and every one of them is exact.

The families where nothing happens, and why they are the useful ones

Two families in this field are constructed so that the algorithm has no room to be clever, and they are how any growth claim gets a floor.

The unit lower triangular family is already eliminated. Every pivot is 1, every division is by 1, and every intermediate is 1 or 0. Any growth measured on it is the routine’s own bookkeeping rather than the matrix’s, and there is none.

The Pascal family is more interesting: its entries reach twenty bits by n = 12 and its determinant is exactly 1 at every size. So it separates two quantities that are easy to conflate. The entries are large, the answer is one, and the intermediates — being minors of a matrix whose minors are themselves binomial determinants — stay tiny. Entry size does not predict intermediate size, and intermediate size does not predict the answer’s size.

Every boxed entry is a 3 × 3 minor of the matrix beside itA 5 × 5 pascal matrix and its state after 2 steps of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 25 divisions came out exact. The reason is that the entry at (i, j) is exactly the 3 × 3 minor of the ORIGINAL matrix on rows 0…1 and i, columns 0…1 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 6 bits.111111234513610151410203515153570A, the matrix as given11111012340013600310220062253after 2 fraction-free steps3 × 3 minors25 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 6 Pascal, after two steps: every minor of the leading block is 1, so the boxed entries are all ones and the elimination has visibly done nothing.
Three exact eliminations of the same pascal 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 = 11 the answer itself is 1 bits and Hadamard's bound allows 124. Fraction-free elimination never forms a number wider than 18 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 18 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 18 bits — 1 times the width of the fraction-free route and 18 times the width of the answer. All three are correct.34567891011110¹nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn11answer1Hadamard bound124fraction-free18reduced rationals18unreduced18the error is zero on every curvethe cost is the length of the numbers
Fig. 7 The same family across sizes. The fraction-free curve is flat at one bit while Hadamard’s bound climbs past a hundred, which is the largest gap between a bound and an answer this field draws.

Three things that follow, none of them obvious from the recurrence

Stating the intermediates as minors settles several questions that would otherwise each need their own argument, and they are worth collecting because they are the reason this recurrence is the one integer libraries use rather than one of several plausible ones.

The last entry is the determinant, with no accumulation. A float LU builds its determinant as a running product of pivots, and every one of those multiplications rounds. Here the entry at the bottom right after the last step is the n × n minor — that is, the determinant — and it was never formed as a product of anything. There is no accumulated quantity to be wrong, which is why the determinant essay’s complaint about a product of pivots does not transfer.

The leading principal minors come out along the way, in order. Each pivot aₖₖ after step k−1 is the k × k leading principal minor, so the sequence of pivots is the sequence of those minors. That is a free inertia computation on a symmetric matrix — the number of sign changes in the sequence is the number of negative eigenvalues, by Sylvester’s law — and it costs nothing beyond the elimination that was going to happen anyway. The essay that counts eigenvalues by inertia does it in floating point and has to decide what a zero pivot is; here a pivot is zero or it is not.

A zero pivot is information rather than an accident. In a float elimination a small pivot triggers a row interchange and the smallness is a judgement. Here a pivot is exactly zero precisely when a leading principal minor vanishes, which is a statement about the matrix that no arithmetic made — and the interchange that follows is a decision about which nonzero minor to use next rather than about which number is safest to divide by. The two eliminations swap rows for reasons that have nothing in common, which is easy to miss because the code looks the same.

What this makes possible elsewhere

Fraction-free elimination is the reason several measurements on this site could be taken at all, and they are worth naming because the technique is invisible in them.

The spanning-tree count is a determinant of a grounded Laplacian, and Kirchhoff’s theorem makes it an integer — so a float determinant that returns 1.19999999998·10²⁰ has to be rounded, and the rounding is exactly what fails once the answer passes 2⁵³. The exact determinant does not, and the route it takes is this one.

The effective resistance between two vertices of an unweighted graph is a ratio of two such determinants, so it is a rational number with a known numerator and denominator rather than a float with a residual. Both are computed here.

And the cospectral pair — two graphs with the identical characteristic polynomial — is checked as an identity between integer polynomials rather than as an agreement between two lists of computed eigenvalues, which would be a comparison at a tolerance and would prove nothing at all about whether the polynomials are the same.

In each case the exactness is not the finding. It is the instrument that lets the finding be stated without a tolerance in it — the same role the closed-form Hilbert inverse plays in the essay that measures a float solve against a known answer, and the reason that essay can say the error rather than an estimate of the error.

The other thing a minor is: a rank certificate

Because every intermediate is a minor, a fraction-free elimination is doing something no floating point elimination can do, and it is worth naming before the field gets to rank properly.

A matrix has rank at least r exactly when some r × r minor is nonzero, and the elimination hands over one such minor at each level as it goes. So when a fraction-free elimination on a rank-deficient matrix reaches a level where every remaining entry is zero, that is not a decision about a small number: it is a proof that every minor of that size vanishes, arrived at without a threshold. Every other statement about rank on this site is a decision about where to put a line — the essay that argued that is about the line, and the cheap rank-revealing route is about what a greedy pivot rule can and cannot detect through one.

Here there is no line. A zero is a zero. What replaces the threshold as the source of trouble is which ring the entries are read in, which is a genuinely different problem and gets its own essay.

What the divisions actually cost

There is a temptation to read the exactness as free, and it is not quite.

An exact division of a 2b-bit integer by a b-bit one is not one machine operation. It is a division of long integers, and the schoolbook cost is quadratic in the length. So the step performs two multiplications of b-bit integers, a subtraction, and a division — and the division is the expensive one, at roughly the cost of the multiplications together.

That is still the good deal, and the arithmetic says why. The reduced-rational route performs a greatest common divisor per entry, and a gcd of two b-bit integers is a sequence of about b divisions rather than one. So both routes pay a length-dependent price per entry and the fraction-free route pays it once where the reduced-rational route pays it b times. The measured consequence is not in the bit-length figure at all — both routes end within a bit of each other — it is in the time, and it is the reason libraries that compute integer determinants use this recurrence.

The unreduced route is cheap per operation and its operands are the ones that leave the picture. Three ways of arranging the same n³/3 arithmetic operations, and the operation count cannot tell them apart, which is the same complaint the cost field makes about flop counts arrived at from a completely different direction.

Where it stops

The algorithm has one genuine limitation and it is not about the divisions.

Fraction-free elimination is the right route when the answer is one integer — a determinant, a resultant, a characteristic polynomial’s coefficients. It is a poor route when the answer is a large matrix of rationals, because the last thing it produces is a triangular matrix whose entries are the largest minors, and recovering a solution vector from those means dividing by them and reducing after all. That is the same shape of complaint as forming an inverse when a solve was wanted: the intermediate object is larger than the question, and paying for it is optional.

For that problem the field has a different answer: work modulo primes where nothing can grow, and reassemble. That is where the next three essays go, and the bound that makes it possible — Hadamard’s — is the same one that bounds the intermediates here.

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. 8 The bound doing its other job: deciding in advance how many word-sized primes a modular determinant needs, which is a number fixed before any residue is computed.

At other settings

Every boxed entry is a 3 × 3 minor of the matrix beside itA 5 × 5 wide matrix and its state after 2 steps of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 25 divisions came out exact. The reason is that the entry at (i, j) is exactly the 3 × 3 minor of the ORIGINAL matrix on rows 0…1 and i, columns 0…1 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 30 bits.-257325-86896-994-523-996278116-612-894131-704-870-29973890972-390570-7246836-574A, the matrix as given-257325-86896-9940195418-469898-150509-52397400-3.542·10⁸-4.333·10⁸-5.814·10⁸005.441·10⁸4.641·10⁷3.383·10⁸00-2.442·10⁸4.23·10⁷-5.447·10⁸after 2 fraction-free steps3 × 3 minors25 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 9 Three-digit entries, where the two by two minors are already six digits and the boxes are wide.
Every boxed entry is a 5 × 5 minor of the matrix beside itA 6 × 6 unitriangular matrix and its state after 4 steps of fraction-free elimination. Each of the 4 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 54 divisions came out exact. The reason is that the entry at (i, j) is exactly the 5 × 5 minor of the ORIGINAL matrix on rows 0…3 and i, columns 0…3 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 1 bits.100000110000111000111100111110111111A, the matrix as given100000010000001000000100000010000011after 4 fraction-free steps5 × 5 minors54 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 10 The floor: unit lower triangular, four steps in, every minor exactly 1.
Every boxed entry is a 6 × 6 minor of the matrix beside itA 6 × 6 random matrix and its state after 5 steps of fraction-free elimination. Each of the 1 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 55 divisions came out exact. The reason is that the entry at (i, j) is exactly the 6 × 6 minor of the ORIGINAL matrix on rows 0…4 and i, columns 0…4 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 16 bits.1-2-6-7-474-26-12-5-8-524-394151435-6-5-33-29-46184A, the matrix as given1-2-6-7-4706302718-3300354255168-303000921038250000-2106-3987000000-40098after 5 fraction-free steps6 × 6 minors55 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 11 The last step of a six by six, where the single remaining entry is the determinant itself.
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 = 10 the answer itself is 103 bits and Hadamard's bound allows 110. Fraction-free elimination never forms a number wider than 103 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 103 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 754790 bits — 7330 times the width of the fraction-free route and 7330 times the width of the answer. All three are correct.345678910110¹10²10³10⁴10⁵10⁶nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn10answer103Hadamard bound110fraction-free103reduced rationals103unreduced7.5·10⁵the error is zero on every curvethe cost is the length of the numbers
Fig. 12 Wide entries, where the fraction-free curve starts at forty bits and still tracks the answer.
Three exact eliminations of the same unitriangular 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 = 12 the answer itself is 1 bits and Hadamard's bound allows 16. Fraction-free elimination never forms a number wider than 1 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 1 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 1 bits — 1 times the width of the fraction-free route and 1 times the width of the answer. All three are correct.34567891011121nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn12answer1Hadamard bound16fraction-free1reduced rationals1unreduced1the error is zero on every curvethe cost is the length of the numbers
Fig. 13 And the family with no growth at all, which is what a flat curve on this axis looks like.
10 × 10: three exact determinants agree to the digit, and the float one does notdet A = -77985307738 on a random matrix of order 10, 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 -7.79853077·10¹⁰, a relative error of 3.913·10⁻¹⁶, which is what a determinant of 37 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 43 bits are needed and 2 primes supply them.Bareiss37 bitsrationals36 bitsmodular26 bitsthe answer37 bitsHadamard43 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 2 primes0floating-point LU3.9·10⁻¹⁶det A = -77985307738three routes, one integerand no tolerance anywhere in the comparison
Fig. 14 The three routes agreeing as integers on a ten by ten, with the float LU beside them.
8 × 8: three exact determinants agree to the digit, and the float one does notdet A = 1 on a pascal matrix of order 8, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 3 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 1, a relative error of 2.687·10⁻¹², which is what a determinant of 1 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 62 bits are needed and 3 primes supply them.Bareiss12 bitsrationals12 bitsmodular26 bitsthe answer1 bitsHadamard62 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 3 primes0floating-point LU2.7·10⁻¹²det A = 1three routes, one integerand no tolerance anywhere in the comparison
Fig. 15 A determinant of one, reached by all three exact routes and by the float route as 1.0000000000002.
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. 16 The invariant factors of the same kind of matrix, computed by an algorithm and by the definition.
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. 17 The determinant from the pivots of a float LU, which is the route this one replaces.
Growth factor under partial pivoting to n = 40: the bound, the worst case, and realityGrowth factor against matrix size on a logarithmic vertical axis. The two-to-the-n bound rises as a straight line; Wilkinson's matrix sits exactly on it; random matrices stay near one.0816243240110²10⁴10⁶10⁸10¹⁰10¹²10¹⁴matrix size ngrowth factor max|u| / max|a|the 2ⁿ⁻¹ boundworst of 30 randommedian randomWilkinson's matrix sits on the bound30 Gaussian matrices per sizeat n = 40: bound 5.5·10¹¹, worst 4.8
Fig. 18 The elimination field’s growth factor, which is the float analogue of the quantity bounded here.
The exact solution of a 13×13 Hilbert system beside the computed oneTwo columns of numbers: the exact answer, which is the integers one to thirteen, and the answer double-precision elimination returns, with the number of correct digits beside each.H13 x = b, b formed exactly so that x = (1, 2, …, 13)12345678910111213exact1.00002.00003.00133.97865.18864.993010.46720.048921.2657-2.575319.21478.906013.5113computed6.6 correct digits4.8 correct digits3.4 correct digits2.3 correct digits1.4 correct digit0.8 correct digitno correct digitsno correct digitsno correct digitsno correct digitsno correct digits0.6 correct digit1.4 correct digitbackward error2.2·10⁻¹⁷κ = 1.7·10¹⁸The algorithm solved a neighbouring problem perfectly. That problem's answer is this one.right-hand side built in BigInt rationalsthe truth is known
Fig. 19 Exact rational ground truth on the Hilbert matrix, computed by the elimination in this essay.
Elimination with and without pivoting, ε = 10⁻¹⁴The same two-by-two system solved twice. With a row swap the answer is exact; without one the upper triangular factor contains an entry of order one over epsilon and the second component of the answer is wrong.[ ε 1 ; 1 1 ] x = [ 1 ; 2 ], exact answer (1.000000, 1.000000)with partial pivoting1101U after elimination1.0000001.000000computed xbackward error 0forward error 0without10⁻¹⁴10-10·10¹³U after elimination0.9992011.000000computed xbackward error 2·10⁻⁴forward error 5.7·10⁻⁴no error is raisedgrowth 10·10¹³
Fig. 20 The row interchange, which is the one thing that puts the minor claim out of reach.
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. 21 A spanning-tree count, which is an integer determinant and is computed this way.
Every boxed entry is a 2 × 2 minor of the matrix beside itA 4 × 4 wide matrix and its state after 1 step of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 9 divisions came out exact. The reason is that the entry at (i, j) is exactly the 2 × 2 minor of the ORIGINAL matrix on rows 0…0 and i, columns 0…0 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 20 bits.-257325-86896-994-523-996278116-612-894131-704-870-299A, the matrix as given-257325-868960457461-837349794900-257937835192154782013835333729864267after 1 fraction-free step2 × 2 minors9 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 22 One step on three-digit entries, where the two by two minors are six digits wide.
Every boxed entry is a 3 × 3 minor of the matrix beside itA 5 × 5 unitriangular matrix and its state after 2 steps of fraction-free elimination. Each of the 9 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 25 divisions came out exact. The reason is that the entry at (i, j) is exactly the 3 × 3 minor of the ORIGINAL matrix on rows 0…1 and i, columns 0…1 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 1 bits.1000011000111001111011111A, the matrix as given1000001000001000011000111after 2 fraction-free steps3 × 3 minors25 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 23 The floor family after two steps, where every minor is 1 and nothing moves.
Every boxed entry is a 5 × 5 minor of the matrix beside itA 6 × 6 pascal matrix and its state after 4 steps of fraction-free elimination. Each of the 4 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 54 divisions came out exact. The reason is that the entry at (i, j) is exactly the 5 × 5 minor of the ORIGINAL matrix on rows 0…3 and i, columns 0…3 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 5 bits.111111123456136101521141020355615153570126162156126252A, the matrix as given111111012345001361000014100000150000526after 4 fraction-free steps5 × 5 minors54 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 24 Pascal at four steps, where the leading minors are all 1 at every order.
Three exact eliminations of the same hilbert 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 = 8 the answer itself is 40 bits and Hadamard's bound allows 140. Fraction-free elimination never forms a number wider than 60 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 19 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 94136 bits — 1570 times the width of the fraction-free route and 2350 times the width of the answer. All three are correct.345678110¹10²10³10⁴10⁵nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn8answer40Hadamard bound140fraction-free60reduced rationals19unreduced9.4·10⁴the error is zero on every curvethe cost is the length of the numbers
Fig. 25 The ill-conditioned family, where the fraction-free route still tracks the determinant.
12 × 12: three exact determinants agree to the digit, and the float one does notdet A = -2427874101335978867481689655837990396 on a wide matrix of order 12, computed three ways with no rounding anywhere: fraction-free elimination, elimination over the rationals, and elimination modulo 6 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 -2.4278741·10³⁶, a relative error of 1.021·10⁻¹⁴, which is what a determinant of 121 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 134 bits are needed and 6 primes supply them.Bareiss121 bitsrationals119 bitsmodular26 bitsthe answer121 bitsHadamard134 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 6 primes0floating-point LU10⁻¹⁴det A = -2427874101335978867481689655837990396three routes, one integerand no tolerance anywhere in the comparison
Fig. 26 Six primes and a 121-bit answer, reached three ways.
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 = 9 the random family needs 37 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.3456789110¹10²nbitsthe budget and what it buysrandom, bound37random, actual25primes needed2Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 27 Hadamard bounding the minors as well as the determinant.
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. 28 Invariant factors on wide entries, where the last one carries fourteen digits.
The exact solution of a unitriangular system is longer than the systemAx = b with A a unitriangular integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 10 the question occupies 100 bits — 10² entries of 1 bits each — and the answer occupies 29, a ratio of 0.29. 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 1 bits, while a numerator can be, at 3 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.34567891010¹nbitsthe answerthe question · det Abits in, bits outn10question100answer29det A1widest part3the answer is the floorand no route writes it down more cheaply
Fig. 29 A system whose answer is integral, so no denominator is formed at all.
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. 30 Rank read in three rings, computed by this elimination with no threshold.
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. 31 The determinant a unimodular step may not change, in its smallest picture.
Every boxed entry is a 2 × 2 minor of the matrix beside itA 3 × 3 random matrix and its state after 1 step of fraction-free elimination. Each of the 4 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 4 divisions came out exact. The reason is that the entry at (i, j) is exactly the 2 × 2 minor of the ORIGINAL matrix on rows 0…0 and i, columns 0…0 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 6 bits.1-2-6-7-474-26A, the matrix as given1-2-60-18-350630after 1 fraction-free step2 × 2 minors4 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 32 The smallest case, one step, four two by two determinants.
Every boxed entry is a 5 × 5 minor of the matrix beside itA 5 × 5 wide matrix and its state after 4 steps of fraction-free elimination. Each of the 1 boxed entries was formed as (pivot × entry − column × row) divided by the previous pivot, and every one of those 30 divisions came out exact. The reason is that the entry at (i, j) is exactly the 5 × 5 minor of the ORIGINAL matrix on rows 0…3 and i, columns 0…3 and j — checked here against a cofactor expansion of A rather than against a second elimination. The widest number anywhere in the picture is 52 bits.-257325-86896-994-523-996278116-612-894131-704-870-29973890972-390570-7246836-574A, the matrix as given-257325-86896-9940195418-469898-150509-52397400-3.542·10⁸-4.333·10⁸-5.814·10⁸0001.122·10¹²1.005·10¹²0000-2.58·10¹⁵after 4 fraction-free steps5 × 5 minors30 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 33 The last step on wide entries, where the surviving entry is the determinant.
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 = 13 the answer itself is 44 bits and Hadamard's bound allows 56. Fraction-free elimination never forms a number wider than 44 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 44 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 1120288 bits — 25500 times the width of the fraction-free route and 25500 times the width of the answer. All three are correct.345678910111213110¹10²10³10⁴10⁵10⁶nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn13answer44Hadamard bound56fraction-free44reduced rationals44unreduced1.1·10⁶the error is zero on every curvethe cost is the length of the numbers
Fig. 34 Out to thirteen, where the unreduced route passes four million bits.
8 × 8: three exact determinants agree to the digit, and the float one does notdet A = 4096 on a hadamard matrix of order 8, 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 4096, a relative error of 0, which is what a determinant of 13 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 14 bits are needed and 1 prime supplies them.Bareiss13 bitsrationals4 bitsmodular26 bitsthe answer13 bitsHadamard14 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 1 prime0floating-point LU0det A = 4096three routes, one integerand no tolerance anywhere in the comparison
Fig. 35 A matrix whose rows are orthogonal, so the bound is exact.
6 × 6: three exact determinants agree to the digit, and the float one does notdet A = 2435091120 on a hilbert matrix of order 6, 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 2.43509112·10⁹, a relative error of 1.329·10⁻¹¹, which is what a determinant of 32 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 85 bits are needed and 4 primes supply them.Bareiss40 bitsrationals15 bitsmodular26 bitsthe answer32 bitsHadamard85 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 4 primes0floating-point LU1.3·10⁻¹¹det A = 2435091120three routes, one integerand no tolerance anywhere in the comparison
Fig. 36 Where the float determinant has lost the answer and this route has not.
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 = 13 the random family needs 56 bits, which is 3 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.345678910111213110¹10²nbitsthe budget and what it buysrandom, bound56random, actual44primes needed3Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 37 The bound on a minor, which is the bound on an intermediate.
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. 38 The failure the fraction-free route does not have.
An exact solve of a measured 8 × 8 system, against the error the measurement put thereThe rising curve is the distance from the exact solution of a perturbed system to the exact solution of the unperturbed one, as the perturbation grows from a relative 10⁻¹⁶ to 1. Every point on it was computed with no rounding anywhere: the elimination is over the rationals, the residual of each solve is the zero vector, and the error is entirely the data's. At a measurement accurate to 10^-10 the answer is wrong by 0.07441, which is 7.4·10⁸ times the data's own error — the matrix's condition number, doing the only job left for it to do. The straight line of slope one is the whole finding: removing the arithmetic error changes nothing about this quantity, because this quantity was never about the arithmetic.10⁻¹⁶10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²110⁻⁷10⁻⁵10⁻³10⁻¹10¹relative error in the datarelative error in the answerthe answer's errorthe data's errornothing here is the arithmetic'sdata error10⁻¹⁰answer error0.074amplification7.4·10⁸rounding committed0residual0the residual is exactly zeroand the answer is wrong anyway
Fig. 39 And the question of whether the exactness was worth the divisions.

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.

Bit lengthDeterminantExact arithmeticFraction-free eliminationHadamard boundMinorSylvesters identity