ArticleslgStudy

computer science

Bareiss algorithm

Bareiss algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Bareiss algorithm rather than just read about it. In short: In mathematics, the Bareiss-Montante algorithm, named after Erwin Bareiss and René Montante, is an algorithm to calculate the determinant or the echelon form of a matrix with integer entries using only integer arithmetic; any divisions that are performed are guaranteed to be exact (there is no remainder). The method can also be used to compute the determinant of matrices with (approximated) real entries, avoiding th…

Key takeaways

  • Bareiss algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Bareiss algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Bareiss algorithm from memory before moving on to harder problems.

Reference excerpt

In mathematics, the Bareiss-Montante algorithm, named after Erwin Bareiss and René Montante, is an algorithm to calculate the determinant or the echelon form of a matrix with integer entries using only integer arithmetic; any divisions that are performed are guaranteed to be exact (there is no remainder). The method can also be used to compute the determinant of matrices with (approximated) real entries, avoiding the introduction of any round-off errors beyond those already present in the input.

Overview The definition of the determinant of a matrix involves only the operations of multiplication, addition and subtraction. Therefore the determinant of a matrix is an integer whenever all the entries are integers. However, actual computation of the determinant using the definition or Leibniz formula is impractical, as it requires O(n!) operations. Gaussian elimination has O(n3) complexity, but introduces division, which results in round-off errors when implemented using floating point numbers. Round-off errors can be avoided if all the numbers are kept as integer fractions instead of floating point. But then the size of each element grows in size exponentially with the number of rows. Bareiss brings up a question of performing an integer-preserving elimination while keeping the magnitudes of the intermediate coefficients reasonably small. Two algorithms are suggested:

Division-free algorithm — performs matrix reduction to triangular form without any division operation. Fraction-free algorithm — uses division to keep the intermediate entries smaller, but due to the Sylvester's Identity the transformation is still integer-preserving (the division has zero remainder). For completeness Bareiss also suggests fraction-producing multiplication-free elimination methods.

Algorithm The program structure of this algorithm is a simple triple-loop, as in the standard Gaussian elimination. However in this case the matrix is modified so that each Mk,k entry contains the leading principal minor [M]k,k. Algorithm correctness is easily shown by induction on k.

If the assumption about principal minors turns out to be false, e.g. if Mk−1,k−1 = 0 and some Mi,k−1 ≠ 0 (i = k,...,n) then we can exchange the k−1-th row with the i-th row and change the sign of the final answer.

History The method was first invented and published by Swiss mathematician Erwin H. Bareiss in 1968. Unaware of Bareiss discovery, it was rediscovered by René Montante in Mexico five years later. For that reason, the algorithm is also known as the "Montante method" in Hispanic countries.

Analysis During execution of the Bareiss algorithm, every integer that is computed is the determinant of a submatrix of the input matrix. This allows, using the Hadamard inequality, to bound the size of these integers. Otherwise, the Bareiss algorithm may be viewed as a variant of Gaussian elimination and needs roughly the same number of arithmetic operations. It follows that, for an n × n matrix of maximum (absolute) value 2L for each entry, the Bareiss algorithm runs in O(n3) elementary operations with an O(nn/2 2nL) bound on the absolute value of intermediate values needed. Its computational complexity is thus O(n5L2 (log(n)2 + L2)) when using elementary arithmetic or O(n4L (log(n) + L) log(log(n) + L))) by using fast multiplication.

Usage The Bareiss algorithm is not commonly used for integer matrices, because multi-modular arithmetic allows a complexity similar to that of the Bareiss algorithm with fast multiplication, and is much simpler to implement. On the other hand, the Bareiss algorithm may be used with entries in any integral domain equipped with an exact-division algorithm, and, in particular, for matrices of polynomials.

References

Worked examples

Example 1 — a first encounter with Bareiss algorithm

Start with the simplest possible case. Write down what Bareiss algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Bareiss algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Bareiss algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Bareiss algorithm

In research
Bareiss algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Bareiss algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Bareiss algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer algebra, Determinants, Exchange algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Bareiss algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Bareiss algorithm” →

How to study Bareiss algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Bareiss algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Bareiss algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Bareiss algorithm in simple terms?

In mathematics, the Bareiss-Montante algorithm, named after Erwin Bareiss and René Montante, is an algorithm to calculate the determinant or the echelon form of a matrix with integer entries using only integer arithmetic; any divisions that are performed are guaranteed to be exact (there is no rema…

Why does Bareiss algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Bareiss algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Bareiss algorithm.

Tags

  • Computer algebra
  • Determinants
  • Exchange algorithms
  • Numerical linear algebra

Keep exploring