An Efficient and Generic Algorithm for Matrix Inversion

An Efficient and Generic Algorithm for Matrix Inversion

Ahmad Farooq, Khan Hamid, Inayat Ali Shah
Copyright: © 2010 |Pages: 6
DOI: 10.4018/jtd.2010040102
(Individual Articles)
No Current Special Offers


This work presents an improvement on the simple algorithms of matrix inversion (Farooq & Hamid, 2010). This generalized algorithm supports selection of pivot randomly in the matrix thus supporting partial and full pivoting. The freedom in pivot selection can be used in minimizing the numerical error and prioritizing the variable to find the solution first. The algorithm is more suitable for finding inverse and determinant of dense matrices. The algorithm requires a mechanism for selection of pivot (e.g., selection of absolute maximum value) in the available sub-matrix and the mechanism to get the inverse from the final resultant matrix by rearranging the rows and columns. A method for assigning the sign of the determinant is also given. The algorithm is explained through solved examples. The number of arithmetic calculations performed by the algorithm is of O () however. The efficiency and simplicity of coding remains the same as of the original algorithm.
Article Preview


Farooq and Hamid (2010) presented an algorithm for matrix inversion which is simpler and efficient than the exiting techniques (Saad, 2000; Chang, 2006; Mikkawy, 2006; Vajargah, 2007) and is applicable in general irrespective of the structure of the matrix. They demonstrated that manual calculations of the algorithm are straightforward and computer implementation is extremely easy. The algorithm also utilizes minimal memory. However, the algorithm is limited in the pivot selection by allowing the pivot selection diagonally only. This work presents an extension of the same algorithm by making it generic in pivot selection.

An important feature of the algorithm is the ability to allow the user to select pivot off-diagonally during inversion. The pivots can be selected from anywhere within the legal candidates of the matrix elements using the group theory of permutations and projections. The legality of the pivot is determined by the fact that during the inverse process a row or a column can be selected only once for a pivot. The selection of the pivot can be left to the choice of the user for example to go for a maximum absolute value of an element to improve numerical accuracy.

The rest of the paper is organized as follows. In section 2 we are presenting the generic algorithm. Also a 3 x 3 matrix is inversed (and determinant calculated) by the algorithm using two different sequences of pivot selection. Future work is indicated in section 3 and the paper is concluded in section 4. Finally some references are given in the end.

The Generic Algorithm of Matrix Inversion

In many situations of matrix inversions and solution of equations it may be required to go off diagonal for some or all of the pivot elements because of the following reasons:

  • a.

    The diagonal element is zero and cannot be selected as pivot. However, if we can look for elements other than the diagonal, then in non-singular matrices we will always find a non-zero element for pivot.

  • b.

    To improve the accuracy of the result we may look for particular type of values for pivots. Let say selecting the element having maximum absolute value.

  • c.

    We are interested in particular row or column to be selected first for pivot, for example, in solution of equation the value of a variable is required to be evaluated first.

However, if pivots are selected off-diagonal the resultant matrix (after the application of the inversion algorithm) will contain the elements of the inverse but intermingled. To get the inverse, the rows and the columns of the resultant matrix have to be rearranged. Similarly the off-diagonal selection of pivots will affect the sign of the determinant and correct sign have to be determined.

In the generic algorithm the selection of pivots for the inversion of matrices and the calculation of their determinants are controlled by permutation group theory. If we take a matrix of order n then for the inverse we have to select exactly n pivots. Let jtd.2010040102.m02 is the set of pivot selections. Then jtd.2010040102.m03is the set of all bijections (possible permutations of pivot selection) on the set jtd.2010040102.m04. jtd.2010040102.m05 forms a group under the binary operation of composition of functions i.e., for any bijections jtd.2010040102.m06, jtd.2010040102.m07 where jtd.2010040102.m08 is the composition. Moreover for jtd.2010040102.m09 will denote its inverse. The number of elements in the givenjtd.2010040102.m10are equal tojtd.2010040102.m11. In this context cycles and transpositions have their usual meanings.

During the inverse calculation, pivot selection is made according to some criterion. This could be to improve accuracy, efficiency or achieve priority in the calculation of some variable. Whatever sequence, jtd.2010040102.m12 of pivot selection is made it will be on the set jtd.2010040102.m13 i.e.,jtd.2010040102.m14. Therefore, the inverse of the matrix A is then obtained when we alter the rows of the resultant matrix according to γ and columns of the resultant matrix according tojtd.2010040102.m15.

Note that for any jtd.2010040102.m16the number of non-identity permutations are either even or odd, accordingly the number of transpositions are even or odd. The signature of jtd.2010040102.m17 is defined as follows;


The determinant of A is given by, jtd.2010040102.m19, where all jtd.2010040102.m20are the pivot elements and jtd.2010040102.m21.

Note that during this process if a pivot element is found to be zero then certainly, matrix is not invertible.

Complete Article List

Search this Journal:
Volume 15: 1 Issue (2024): Forthcoming, Available for Pre-Order
Volume 14: 1 Issue (2023)
Volume 13: 4 Issues (2022): 1 Released, 3 Forthcoming
Volume 12: 4 Issues (2021)
Volume 11: 4 Issues (2020)
Volume 10: 4 Issues (2019)
Volume 9: 4 Issues (2018)
Volume 8: 4 Issues (2017)
Volume 7: 4 Issues (2016)
Volume 6: 4 Issues (2015)
Volume 5: 4 Issues (2014)
Volume 4: 4 Issues (2013)
Volume 3: 4 Issues (2012)
Volume 2: 4 Issues (2011)
Volume 1: 4 Issues (2010)
View Complete Journal Contents Listing