Exact arithmetic, and what it costs instead

The answer is longer than the question

An exact solution of an integer system is a vector of fractions, each of them a ratio of two determinants. So the output carries 2n long integers where the input carried n² short ones, and no algorithm can write it down more cheaply — the length of the answer is a floor under every exact solver rather than a property of one.

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

The first two essays in this field were about intermediates: numbers the algorithm forms on the way and could in principle avoid forming. Fraction-free elimination avoids most of them, the modular route avoids all of them, and the difference between the best and worst arrangements of the same arithmetic was four orders of magnitude.

This essay is about the number that cannot be avoided, because it is the answer.

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 = 11 the question occupies 484 bits — 11² entries of 4 bits each — and the answer occupies 729, a ratio of 1.51. 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 33 bits, while a numerator can be, at 37 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.3456789101110²10³nbitsthe answerthe question · det Abits in, bits outn11question484answer729det A33widest part37the answer is the floorand no route writes it down more cheaply
Fig. 1 An eleven by eleven integer system: 484 bits of question, 729 bits of answer. Every entry of the solution is a ratio of two determinants, and the lower curve is the determinant’s own length, which is what each of those parts costs.

What an exact solution is

Solve Ax = b with A an integer matrix and b an integer vector. The solution is a vector of rational numbers, and Cramer’s rule says exactly which ones:

xᵢ  =  det(Aᵢ) / det(A)

where Aᵢ is A with its i-th column replaced by b. That is usually quoted as a terrible algorithm, which it is — n+1 determinants where one elimination would do. Read as a statement about the answer rather than about a method, it is not an algorithm at all and it is exact information about how large the output must be.

Every entry has a denominator dividing det A. So no denominator is longer than det A, and the whole vector is 2n integers each of at most that length. On a matrix with b-bit entries det A has about n(b + ½log n) bits, so the answer occupies roughly 2n²·b bits where the question occupied n²·b.

That is checked here rather than quoted. Each computed entry is multiplied back by det A and the product compared, as an integer, with det(Aᵢ) computed independently. They agree at every size, which means the reduced fraction really is that ratio and the denominator bound really does hold. It is the same shape of check the field uses everywhere — an algorithm against a definition rather than against a faster version of itself — and here the definition is a rule from 1750 that nobody computes with.

The claim that had to be dropped

The natural thing to assert is that no part of the answer is longer than det A. It is false, and the measurement said so: on an eleven by eleven the widest numerator is 37 bits against a determinant of 33.

The reason is immediate once it is seen. The numerator is det(Aᵢ), a determinant of a different matrix — one column of A swapped out for b — and if b has larger entries than that column did, that determinant can be larger. What is exactly true is the denominator statement, because the reduced denominator divides det A and division cannot lengthen an integer.

The exact solution of a wide system is longer than the systemAx = b with A a wide integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 10 the question occupies 1000 bits — 10² entries of 10 bits each — and the answer occupies 2058, a ratio of 2.06. 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 103 bits, while a numerator can be, at 105 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²10³nbitsthe answerthe question · det Abits in, bits outn10question1000answer2058det A103widest part105the answer is the floorand no route writes it down more cheaply
Fig. 2 Three-digit entries, where every part of the answer is longer and the ratio between the two curves is unchanged. The size of the entries shifts both curves and does not tilt either.

That distinction matters for the field’s cost model. A solver can be judged against the length of the answer, and the answer’s length is a known function of the matrix — but the function is max over i of the length of det(Aᵢ), not the length of det A, and a bound written for the second is wrong for a right-hand side with large entries in it.

Why this is a floor and not a cost

The distinction between an intermediate and an output is the whole reason this essay is separate from the two before it.

An intermediate is a choice. Unreduced rational elimination forms 1,422,165-bit numbers on a twelve by twelve; fraction-free elimination forms 40-bit ones; both return the same answer, so the million and a half bits were never necessary. That is the shape of every performance argument on this site — the same result, at a different price, because of how the work was arranged.

An output is not a choice. If the answer is 729 bits then any routine that produces the answer produces 729 bits, and a routine that produces fewer has produced something else. There is no arrangement of the arithmetic that gets under it and no cleverness that helps.

So the exact-arithmetic cost model has two floors under it and they behave differently. The intermediate floor is the answer’s own length, reached by fraction-free elimination and by the modular route, and the distance from an algorithm to that floor is the algorithm’s fault. The output floor is the answer’s own length again, and nothing is anybody’s fault.

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 intermediate picture from the field’s first essay, for comparison: the lower group is at the floor and the upper curve is a choice about the inner loop.

What it forces on the algorithms

Two consequences follow directly, and both are visible in what the field’s routines actually do.

A modular route must reconstruct rather than eliminate to the end. Working modulo primes keeps every intermediate under 26 bits, which is the whole advantage — but the answer has 729 bits in it, so those bits have to come from somewhere. They come from combining many residues, and the combination is the Chinese remainder theorem for a determinant and rational reconstruction for a solution. The output floor is why the modular route has a second half at all.

A returned inverse is n times worse than a returned solution. An exact inverse of an integer matrix is a matrix of n² rationals, each a ratio of an (n−1) × (n−1) cofactor to det A. So it occupies about 2n³·b bits against the solution’s 2n²·b — and the essay that argues against forming an inverse makes the case in floating point on grounds of stability and operation count. Here the argument is shorter and harder: the object is n times larger than the question, and the size is not negotiable.

The exact solution of a hilbert system is longer than the systemAx = b with A a hilbert integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 9 the question occupies 1944 bits — 9² entries of 24 bits each — and the answer occupies 193, a ratio of 0.0993. 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 73 bits, while a numerator can be, at 21 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.345678910²nbitsthe answerthe question · det Abits in, bits outn9question1944answer193det A73widest part21the answer is the floorand no route writes it down more cheaply
Fig. 4 The integer Hilbert family — the classical ill-conditioned matrix, cleared of denominators — where the answer is short because the system was built to have one, and the determinant is long anyway.

The measurement, size by size

The hero’s two curves are worth reading as numbers rather than as slopes, because the ratio between them is the whole quantity and it moves slowly.

At n = 3 the question is 27 bits and the answer 33, a ratio of 1.22. At n = 7 it is 196 against 292, a ratio of 1.49. At n = 9 it falls back to 1.40 and at n = 11 it is 484 against 729, a ratio of 1.51. The answer is about half again as long as the question, the factor climbs slowly, and it is not monotone — the ninth case is below the seventh, because the length of a determinant is the length of one particular integer and one particular integer can be small. Both quantities are n² times something and the somethings differ by a logarithm.

That is a much less dramatic statement than the four orders of magnitude the intermediates gave, and it is deliberately reported that way. The field’s headline number belongs to a choice about the inner loop; this one belongs to the problem, and it is small. A reader who took away only exact arithmetic is expensive because the numbers get long would have the intermediate story and the output story confused, and would conclude that exact solving is infeasible when what is infeasible is one particular arrangement of it.

An answer that is short for a matrix that is not

The families separate two things this essay could otherwise be read as conflating.

The unit triangular family has a determinant of 1 at every size, so every denominator is 1 and every entry of the solution is an integer. The answer is genuinely short — it is as short as the right-hand side — and the question is the usual size. There is no floor to speak of, and there is also no work: the system is already solved.

The Pascal family also has a determinant of 1, and its entries reach twenty bits by n = 12. Here the denominators are all 1 and the numerators are not: the answer is a vector of integers whose lengths come from the entries rather than from the determinant. So an answer can be long because the matrix is large, or because the determinant is, and these two families separate the causes.

The exact solution of a pascal system is longer than the systemAx = b with A a pascal integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 12 the question occupies 2880 bits — 12² entries of 20 bits each — and the answer occupies 100, a ratio of 0.0347. 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 10 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.345678910111210²nbitsthe answerthe question · det Abits in, bits outn12question2880answer100det A1widest part10the answer is the floorand no route writes it down more cheaply
Fig. 5 Pascal, where every denominator is 1 because the determinant is, and the answer is still not short.

The general statement is the one Cramer’s rule gives and neither family contradicts: the answer’s length is decided by the determinants of the column-replaced matrices, and those are bounded by Hadamard, and the bound is attained on some families and enormously slack on others.

The right-hand side is part of the question, and it is usually forgotten

There is a practical consequence of the numerator being det(Aᵢ) rather than anything about A alone, and it is the kind of thing that turns up as a surprise in a running system.

Scale the right-hand side by an integer c. The matrix is untouched, the determinant is untouched, and the solution is exactly c times what it was — so every numerator has grown by the length of c and every denominator has not. A system solved with a right-hand side in millimetres and the same system solved with the same right-hand side in nanometres produce answers of different lengths, by twenty bits an entry, for the same physical question.

In floating point that is invisible: a scaling of b is a scaling of x, the relative error is unchanged, and the essay on units and conditioning makes the case that only a scaling of the matrix can move anything that matters. Exactly, the units reach the cost. They do not reach the accuracy, because there is none to reach — they reach the number of bits the answer occupies and therefore the time and the memory.

The repair is the obvious one and it is worth stating because it is not obvious that it is needed: divide out the content of b before solving, and multiply it back afterwards. It is free, and nothing in the arithmetic will ever tell anybody it was skipped.

Two determinants, and one of them is usually enough

The denominator of every entry divides det A, so all n entries share a denominator, and that changes what the answer should be returned as.

A vector of n independent fractions is 2n integers. The same vector written as a single integer vector over one common denominator is n+1 integers, and the common denominator can be taken as det A itself — which is a number the solver computed anyway. So the natural exact return type is not a list of fractions; it is a pair, an integer vector and one scalar, and it is about half the size.

That representation is also what makes the answer checkable in integers. With x = y/d for an integer vector y and an integer d, the statement Ax = b becomes

A·y  =  d·b

which is an identity between integer vectors: no division, no rationals, no tolerance. It is the strongest form of verification available anywhere on this site — stronger than a residual, because a residual is a small number that somebody has to decide is small enough, and this is an equality between two lists of integers.

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. 6 The determinant that serves as the common denominator, computed three ways. It is the one number the whole answer is written over.

Where this sits against the rest of the site

Almost every cost argument on this site is about work: flop counts that stopped predicting the time, an ordering that changes a contraction’s price by two million, a factorisation kept because recomputing it costs more. All of them are arguments about arrangement, and all of them have a better arrangement in them somewhere.

The output floor is a different kind of statement and there are only two others like it here. One is the storage a hierarchical format needs, where a rank decides how many numbers there are and no arrangement changes the count. The other is the border-rank sequence, where getting one digit closer costs a fixed factor in the size of the terms, for ever, because that is what the approximation is.

In each case the quantity being paid for is the answer rather than the route to it, and the fill an elimination produces is the near miss worth naming: that one looks like an output floor and is not, because a different ordering changes it. The correct response to a real one is not a better algorithm. It is to ask whether the answer that long is the answer that was wanted — which for an exact solve very often it is not, and the field’s last essay is about the case where it certainly is not.

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. 7 The case where paying for an exact answer buys nothing: data measured to ten digits, an exact solve with a zero residual, and an answer wrong in the first.

What the modular route has to do about it

The output floor is the reason the modular route is a two-stage algorithm rather than a one-stage one, and the stages have completely different characters.

The first stage is arithmetic modulo a prime, where nothing grows, everything is a machine word, and the whole computation is as fast as a float elimination and rather more predictable. Done once it produces a solution vector modulo p, which is n residues — n·26 bits, a fraction of the answer’s size, and useless on its own.

The second stage is recovery, and it is where the answer’s length gets paid for. There are two routes and the field takes both: combine enough residues by the Chinese remainder theorem until the product of the moduli passes Hadamard’s bound, which reconstructs an integer; or solve modulo a single prime power, lifting digit by digit, and recover the rational from its residue. The first needs a bound on the answer, the second needs a bound on both parts of each fraction, and both bounds come from the same place.

What neither can do is reconstruct an answer that has more bits in it than the moduli supply. That is the output floor showing up as an arithmetic condition rather than as a philosophical one, and it is the subject of the three essays that follow.

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 = 11 the random family needs 47 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.34567891011110¹10²nbitsthe budget and what it buysrandom, bound47random, actual33primes needed2Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 8 The budget the first route works to: enough primes that their product exceeds the bound on the answer, decided before any residue is computed.
Recovering 355/113 from its residue: nothing below 2^18, everything aboveThe fraction 355/113 is reduced modulo a prime just above 2^e and then reconstructed from that one residue by the extended Euclidean algorithm. Below e = 18 the reconstruction returns a different fraction or refuses; at and above it, it returns 355/113 exactly, at every e tried. The crossover is not a property of the algorithm: a residue determines a rational uniquely once the modulus exceeds twice the square of the LARGER of the two parts, which here is 2^17.94, and below that there are two fractions with the same residue and both parts small enough. The measured first success is 2^18. There is no band in which the answer is is nearly right — the value returned below the cliff is a perfectly good fraction that is not this one.2^18modulus, as a power of twoa lattice with one short vectornumerator355denominator1132·max(n, d)², bits18first recovered at18moduli tried42below the bound there are two answersand the algorithm cannot prefer one
Fig. 9 And the condition the second route works to: below a modulus twice the square of the longer part, the residue does not determine the fraction at all.

At other settings

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 = 12 the question occupies 144 bits — 12² entries of 1 bits each — and the answer occupies 35, a ratio of 0.243. 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.345678910111210¹nbitsthe answerthe question · det Abits in, bits outn12question144answer35det A1widest part3the answer is the floorand no route writes it down more cheaply
Fig. 10 Unit triangular: every denominator is 1, the answer is an integer vector, and the two curves nearly meet.
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 = 13 the question occupies 676 bits — 13² entries of 4 bits each — and the answer occupies 1155, a ratio of 1.71. 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 44 bits, while a numerator can be, at 46 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.34567891011121310²10³nbitsthe answerthe question · det Abits in, bits outn13question676answer1155det A44widest part46the answer is the floorand no route writes it down more cheaply
Fig. 11 Out to thirteen, where the question is 676 bits and the answer a little over a thousand.
The exact solution of a hilbert system is longer than the systemAx = b with A a hilbert integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 7 the question occupies 931 bits — 7² entries of 19 bits each — and the answer occupies 135, a ratio of 0.145. 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 49 bits, while a numerator can be, at 16 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.3456710²nbitsthe answerthe question · det Abits in, bits outn7question931answer135det A49widest part16the answer is the floorand no route writes it down more cheaply
Fig. 12 The ill-conditioned family at small sizes, where the determinant is already thirty bits.
11 × 11: three exact determinants agree to the digit, and the float one does notdet A = 7034835863 on a random matrix of order 11, 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.03483586·10⁹, a relative error of 3.267·10⁻¹⁴, which is what a determinant of 33 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 48 bits are needed and 2 primes supply them.Bareiss35 bitsrationals35 bitsmodular26 bitsthe answer33 bitsHadamard48 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 2 primes0floating-point LU3.3·10⁻¹⁴det A = 7034835863three routes, one integerand no tolerance anywhere in the comparison
Fig. 13 The determinant that every denominator divides, reached three ways.
8 × 8: three exact determinants agree to the digit, and the float one does notdet A = 778350798225 on a hilbert matrix of order 8, 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 7.7835078·10¹¹, a relative error of 2.322·10⁻⁸, which is what a determinant of 40 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 141 bits are needed and 6 primes supply them.Bareiss60 bitsrationals19 bitsmodular26 bitsthe answer40 bitsHadamard141 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 6 primes0floating-point LU2.3·10⁻⁸det A = 778350798225three routes, one integerand no tolerance anywhere in the comparison
Fig. 14 And on the ill-conditioned family, where the float route has lost the answer entirely.
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 = 9 the answer itself is 73 bits and Hadamard's bound allows 203. 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 24 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 487668 bits — 5360 times the width of the fraction-free route and 6680 times the width of the answer. All three are correct.3456789110¹10²10³10⁴10⁵10⁶nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn9answer73Hadamard bound203fraction-free91reduced rationals24unreduced4.9·10⁵the error is zero on every curvethe cost is the length of the numbers
Fig. 15 The intermediates on the same family, where the fraction-free route still tracks the answer.
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 = 12 the random family needs 52 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.3456789101112110¹10²nbitsthe budget and what it buysrandom, bound52random, actual40primes needed3Hadamard n = 8, bound13Hadamard n = 8, actual13the count is decided by a theorembefore any arithmetic happens
Fig. 16 Hadamard’s bound, which bounds the numerators of the answer as well as the intermediates.
Every boxed entry is a 5 × 5 minor of the matrix beside itA 5 × 5 random 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 15 bits.1-2-6-7-474-26-12-5-8-524-394151435A, the matrix as given1-2-6-7-401840552700112217207000-2877-34670000-22616after 4 fraction-free steps5 × 5 minors30 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 17 The last fraction-free step, where the single surviving entry is the determinant every denominator divides.
The exact solution of a wide system is longer than the systemAx = b with A a wide integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 12 the question occupies 1440 bits — 12² entries of 10 bits each — and the answer occupies 2859, a ratio of 1.99. 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 121 bits, while a numerator can be, at 122 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.345678910111210²10³nbitsthe answerthe question · det Abits in, bits outn12question1440answer2859det A121widest part122the answer is the floorand no route writes it down more cheaply
Fig. 18 Wide entries out to twelve, where the answer passes a thousand bits.
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 An exact Hilbert solution used as ground truth, which is an answer of exactly this shape.
Backward and forward error of two routes to x, on 30×30 systems across eight decades of κBoth routes start from the same LU factorisation. The LU solve's backward error is 2.2·10⁻¹⁷ at every conditioning — a flat line at the unit roundoff. Multiplying by the explicitly formed inverse gives 4.5·10⁻⁵ at κ = 10¹⁴, a slope of 0.94 against κ. The two forward errors, drawn above them, are 2.8·10⁻⁴ and 0.015 — within a factor of 54, which is why the difference between the two methods is invisible to anyone measuring how wrong the answer is.10²10⁴10⁶10⁸10¹⁰10¹²10¹⁴10⁻¹⁸10⁻¹⁵10⁻¹²10⁻⁹10⁻⁶10⁻³1κ₂(A)relative errorforward, A⁻¹bforward, A\bbackward, A⁻¹bbackward, A\bat κ = 10¹⁴η, LU solve2.2·10⁻¹⁷η, via the inverse4.5·10⁻⁵forward, LU solve2.8·10⁻⁴forward, via the inverse0.015one factorisation, two ways to use itand one of them forfeits the backward error
Fig. 20 The float argument against forming an inverse, which this essay makes on size instead.
Train ranks at each of the 5 cuts of a 6-index tensor on 6 points a side, four familiesCut the index list after position k, put the first k indices on the rows and the rest on the columns, and take the rank of the matrix that results. There are 5 such cuts and each rank is an ordinary matrix rank. sin(x₁ + … + x_d) has rank exactly two at every one of them, for every d, because the addition formula separates it into two terms at every cut — a rank written down rather than measured, and the computed values are 2, 2, 2, 2, 2. The reciprocal family climbs to 10, the product family is one everywhere, and independent normal entries reach 216, which is the largest rank the cut allows. Storage runs sinsum 120, reciprocal 1,800, product 36, noise 95,976 against 46,656 entries.012345603672108144180216cut after index krank of the reshapesinsum · 2 2 2 2 2reciprocal · 6 9 10 9 6product · 1 1 1 1 1noise · 6 36 216 36 65 cuts, 5 rankssinsum stored120reciprocal stored1800product stored36noise stored9.6·10⁴entries4.7·10⁴one rank per cutand one of them is a theorem
Fig. 21 Another output floor: a format whose storage is decided by a rank rather than by an arrangement.
How much a perturbation of the right-hand side is amplified, κ = 10⁶The cumulative distribution of the amplification factor over two hundred random perturbation directions, with the condition number marked as the upper limit.110¹10²10³10⁴10⁵10⁶10⁷00.250.50.751amplification of the input perturbationfraction of directions at or belowκ = 10·10⁵worst found 7.6·10⁵6×6, 200 directionsmedian reaches 0.29 of κ
Fig. 22 The amplifier that decides whether an answer this long was worth computing.
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 = 7 the question occupies 196 bits — 7² entries of 4 bits each — and the answer occupies 292, a ratio of 1.49. 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 24 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.3456710²nbitsthe answerthe question · det Abits in, bits outn7question196answer292det A24widest part24the answer is the floorand no route writes it down more cheaply
Fig. 23 Small systems, where the ratio between question and answer is 1.49.
The exact solution of a pascal system is longer than the systemAx = b with A a pascal integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 9 the question occupies 1134 bits — 9² entries of 14 bits each — and the answer occupies 58, a ratio of 0.0511. 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 8 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.345678910²nbitsthe answerthe question · det Abits in, bits outn9question1134answer58det A1widest part8the answer is the floorand no route writes it down more cheaply
Fig. 24 Pascal, where every denominator is 1 and the numerators still grow.
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 = 11 the answer itself is 33 bits and Hadamard's bound allows 47. Fraction-free elimination never forms a number wider than 35 bits, because each of its intermediates is a minor of the original matrix. Rational elimination that reduces every fraction to lowest terms reaches 35 bits and pays a gcd on every arithmetic operation to stay there. Rational elimination that does not reduce reaches 341287 bits — 9750 times the width of the fraction-free route and 10300 times the width of the answer. All three are correct.34567891011110¹10²10³10⁴10⁵nwidest intermediate, in bitsrationals, not reducedfraction-free · rationals reduced · the answerone answer, three widthsn11answer33Hadamard bound47fraction-free35reduced rationals35unreduced3.4·10⁵the error is zero on every curvethe cost is the length of the numbers
Fig. 25 The intermediates, which are a choice, beside an answer that is not.
6 × 6: three exact determinants agree to the digit, and the float one does notdet A = 1 on a unitriangular 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 1, a relative error of 0, 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 7 bits are needed and 1 prime supplies them.Bareiss1 bitsrationals1 bitsmodular26 bitsthe answer1 bitsHadamard7 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 1 prime0floating-point LU0det A = 1three routes, one integerand no tolerance anywhere in the comparison
Fig. 26 A determinant of 1, so every denominator of the answer is 1 as well.
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. 27 The elimination whose last entry is the common denominator.
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. 28 The bound on the numerators as well, taken over the column-replaced matrices.
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. 29 The invariant factors whose product is that denominator.
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^-12 the answer is wrong by 2.049·10⁻¹², which is 2.05 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⁻⁸10⁻⁶10⁻⁴10⁻²1relative error in the datarelative error in the answerthe answer's errorthe data's errornothing here is the arithmetic'sdata error10⁻¹²answer error2·10⁻¹²amplification2rounding committed0residual0the residual is exactly zeroand the answer is wrong anyway
Fig. 30 Whether an answer this long was worth computing, on a well-conditioned system.
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. 31 The modular route the output floor forces to have a second stage.
One 7 × 7 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 7; over 𝔽2 and 𝔽3 it is 5 and 6. 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.7𝔽25𝔽36𝔽57𝔽77𝔽117𝔽137𝔽1017𝔽655377rank, by the ring the entries are read inthe rank of one matrixover ℚ7over 𝔽25over 𝔽36over 𝔽57over 𝔽77nothing is rounded hereand the answer still is not a property of the matrix
Fig. 32 Rank over three rings, which the same elimination decides.
The exact solution of a hilbert system is longer than the systemAx = b with A a hilbert integer matrix and b chosen so the answer is a genuine vector of fractions. At n = 8 the question occupies 1216 bits — 8² entries of 19 bits each — and the answer occupies 117, a ratio of 0.0962. 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 40 bits, while a numerator can be, at 16 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 outn8question1216answer117det A40widest part16the answer is the floorand no route writes it down more cheaply
Fig. 33 The ill-conditioned family, whose determinant is long at every size.
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 = 5 the question occupies 100 bits — 5² entries of 4 bits each — and the answer occupies 140, a ratio of 1.4. 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 15 bits, while a numerator can be, at 15 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.34510²nbitsthe answerthe question · det Abits in, bits outn5question100answer140det A15widest part15the answer is the floorand no route writes it down more cheaply
Fig. 34 The smallest sizes, where the ratio is 1.22.
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. 35 The intermediates on wide entries.
6 × 6: three exact determinants agree to the digit, and the float one does notdet A = -522130948717689337 on a wide matrix of order 6, 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 -5.22130949·10¹⁷, a relative error of 2.451·10⁻¹⁶, which is what a determinant of 59 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 65 bits are needed and 3 primes supply them.Bareiss59 bitsrationals59 bitsmodular26 bitsthe answer59 bitsHadamard65 bitswidest number formedrelative error against the exact answerfraction-free (Bareiss)0rational elimination0modular, 3 primes0floating-point LU2.5·10⁻¹⁶det A = -522130948717689337three routes, one integerand no tolerance anywhere in the comparison
Fig. 36 The determinant every denominator divides, on a wide matrix.
Every boxed entry is a 3 × 3 minor of the matrix beside itA 4 × 4 wide 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 30 bits.-257325-86896-994-523-996278116-612-894131-704-870-299A, the matrix as given-257325-868960457461-8373497949000-6.462·10⁸-3.553·10⁸00-1.051·10⁹-7.16·10⁷after 2 fraction-free steps3 × 3 minors13 divisions, all exactthe intermediates are minorswhich is why the divisions come out whole
Fig. 37 The elimination that produces it.
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. 38 The bound on both parts of every entry.
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. 39 The invariant factors of an ill-conditioned integer matrix.
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. 40 The reduction the reconstruction step is, in two dimensions.

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 lengthCramers ruleDeterminantExact arithmeticFraction-free eliminationHadamard boundOutput size