- Montante's method
Montante's Method is a
linear algebra method to calculate solutions to systems of linear equations, and findingmatrix inverse s, adjoints anddeterminant s. It is named after its discoverer René Mario Montante.Its main feature is working exclusively using integer arithmetic for integer matrices, which allows for exact results in computer implementations.
History
The method was developed in
1973 by René Mario Montante Pardo, from the Department of Mechanical and Electric Engineering of the Universidad Autónoma de Nuevo León, in Monterrey,México.Method
The method is pivot-based, working through the matrix main diagonal and rewriting the matrix iteratively by using 2x2 determinants based on elements and pivot rows and columns. If the original matrix is integer, the method works using integers until the final step, yielding at worst rational results.
This is a pseudo-code implementation of a linear system solver for using Montante's method:
Input: An "n"x"n+1" matrix "M" holding . Output: An "n"x"n+1" matrix holding where is the identity matrix of order is a scalar and is the solution p0 ← 1 foreach t in 1 .. n pt ← mtt foreach i in 1 .. n except t foreach j in t+1 .. n mij ← ( pt * mij - mit * mtj ) / pt-1 mkt ← 0 forall k ≠ t mkk ← p forall k ≤ t return "M"
And an implementation in Ruby
def montante_solve( a ) nr = a.size nc = nr+1 # a must be n x n+1 m = Array.new # work on a copy (0 ... nr).each do |k| m [k] = Array.new(a [k] ) end p_pre = 1 # The previous pivot for t in ( 0 ... nr ) do p = m [t] [t] # The current pivot (0 .. t).each do |k| m [k] [k] = p end for i in 0 ... nr do for j in (t+1) ... nc do m [i] [j] = ( p * m [i] [j] - m [i] [t] * m [t] [j] ) / p_pre if i!=t end end p_pre = p (0 ... nr).each do |k| m [k] [t] = 0 end end return m end a = [ [2,-1,-3, 1, 3] , [1, 1,-2,-2, 2] , [3,-2, 1,-1,-2] , [1,-1, 1, 3, 1] ] p montante_solve( a )
Walkthrough
Given the following linear equation system with integer coefficients::::The augmented matrix (including the results column) is::
First iteration: keep the first row (pivot row) as-is and zero-out all but the first elements in the pivot column;
:
The current pivot at (the upper-leftmost cell), and the "previous" pivot is 1.
Each of the elements in the rest of the matrix (except the pivot row and pivot column) are obtained by the formula
:
Thus
:
Second iteration: the new pivot is at
Keep the second (pivot) row as-is, zero-out the second column except the diagonal element, replace all previous pivot elements with . Then apply the determinant formula to the remaining elements, which form a submatrix holding columns 3 to 5 and lines 1, 3 and 4.
:
:
Third iteration: as before, with pivot at .
:
Fourth iteration:
:
The solution to system (1) is then::
Wikimedia Foundation. 2010.