Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21f2fac2fe45751

Jump to content

Methods of matrix inversion

From Wikipedia, the free encyclopedia

In linear algebra, the inverse square matrix is another square matrix such that the product is the identity matrix. There are many methods for calculating an inverse matrix, if it exists.

Gaussian elimination

[edit]

Gaussian elimination is a useful and easy way to compute the inverse of a matrix.[1] To compute a matrix inverse using this method, an augmented matrix is first created with the left side being the matrix to invert and the right side being the identity matrix. Then, Gaussian elimination is used to convert the left side into the identity matrix, which causes the right side to become the inverse of the input matrix.

For example, take the following matrix:

The first step to compute its inverse is to create the augmented matrix

Call the first row of this matrix and the second row . Then, add row 1 to row 2 This yields

Next, subtract row 2, multiplied by 3, from row 1 which yields

Finally, multiply row 1 by −1 and row 2 by 2 This yields the identity matrix on the left side and the inverse matrix on the right:

Thus, It works because the process of Gaussian elimination can be viewed as a sequence of applying left matrix multiplication using elementary row operations using elementary matrices (), such as

Applying right-multiplication using we get And the right side which is the inverse we want.

To obtain we create the augmented matrix by combining A with I and applying Gaussian elimination. The two portions will be transformed using the same sequence of elementary row operations. When the left portion becomes I, the right portion applied the same elementary row operation sequence will become A−1.

Newton's method

[edit]

A generalization of Newton's method as used for a multiplicative inverse algorithm may be convenient if it is convenient to find a suitable starting seed:

Victor Pan and John Reif have done work that includes ways of generating a starting seed.[2][3]

Newton's method is particularly useful when dealing with families of related matrices that behave enough like the sequence manufactured for the homotopy above: sometimes a good starting point for refining an approximation for the new inverse can be the already obtained inverse of a previous matrix that nearly matches the current matrix. For example, the pair of sequences of inverse matrices used in obtaining matrix square roots by Denman–Beavers iteration. That may need more than one pass of the iteration at each new matrix, if they are not close enough together for just one to be enough. Newton's method is also useful for "touch up" corrections to the Gauss–Jordan algorithm which has been contaminated by small errors from imperfect computer arithmetic.

Cayley–Hamilton method

[edit]

The Cayley–Hamilton theorem allows the inverse of A to be expressed in terms of det(A), traces and powers of A:[4]

where n is size of A, and tr(A) is the trace of matrix A given by the sum of the main diagonal. The sum is taken over s and the sets of all satisfying the linear Diophantine equation

The formula can be rewritten in terms of complete Bell polynomials of arguments as

That is described in more detail under Cayley–Hamilton method.

Eigendecomposition

[edit]

If matrix A can be eigendecomposed, and if none of its eigenvalues are zero, then A is invertible and its inverse is given by[5]

where Q is the square (N × N) matrix whose ith column is the eigenvector of A, and Λ is the diagonal matrix whose diagonal entries are the corresponding eigenvalues, that is, If A is symmetric, Q is guaranteed to be an orthogonal matrix, therefore Furthermore, because Λ is a diagonal matrix, its inverse is easy to calculate:

Cholesky decomposition

[edit]

If matrix A is positive definite, then its inverse can be obtained as[6]

where L is the lower triangular Cholesky decomposition of A, and L* denotes the conjugate transpose of L.

Solution using the adjugate

[edit]

Writing the transpose of the matrix of cofactors, known as an adjugate matrix, may also be an efficient way to calculate the inverse of small matrices, but the recursive method is inefficient for large matrices.[7] To determine the inverse, we calculate a matrix of cofactors:

so that

where |A| is the determinant of A, C is the matrix of cofactors, and CT represents the matrix transpose.

Inversion of 2 × 2 matrices

[edit]

The cofactor equation listed above yields the following result for 2 × 2 matrices. Inversion of these matrices can be done as follows:[8]

This is possible because 1/(adbc) is the reciprocal of the determinant of the matrix in question, and the same strategy could be used for other matrix sizes.

The Cayley–Hamilton method gives

Inversion of 3 × 3 matrices

[edit]

A computationally efficient 3 × 3 matrix inversion is given by

(where the scalar A is not to be confused with the matrix A).

If the determinant is non-zero, the matrix is invertible, with the entries of the intermediary matrix on the right side above given by

The determinant of A can be computed by applying the rule of Sarrus as follows:

The Cayley–Hamilton decomposition gives

The general 3 × 3 inverse can be expressed concisely in terms of the cross product and triple product. If a matrix (consisting of three column vectors, , , and ) is invertible, its inverse is given by

The determinant of A, det(A), is equal to the triple product of x0, x1, and x2—the volume of the parallelepiped formed by the rows or columns:

The correctness of the formula can be checked by using cross- and triple-product properties and by noting that for groups, left and right inverses always coincide. Intuitively, because of the cross products, each row of A–1 is orthogonal to the non-corresponding two columns of A (causing the off-diagonal terms of be zero). Dividing by

causes the diagonal entries of I = A−1A to be unity. For example, the first diagonal is:

Inversion of 4 × 4 matrices

[edit]

With increasing dimension, expressions for the inverse of A get complicated. For n = 4, the Cayley–Hamilton method leads to an expression that is still tractable:

Blockwise inversion

[edit]

Let

where A, B, C and D are matrix sub-blocks of arbitrary size and is the Schur complement of A. (A must be square, so that it can be inverted. Furthermore, A and DCA−1B must be nonsingular.[9])

Matrices can also be inverted blockwise by using the analytic inversion formula:[10]

The strategy is particularly advantageous if A is diagonal and M / A is a small matrix, since they are the only matrices requiring inversion.

The nullity theorem says that the nullity of A equals the nullity of the sub-block in the lower right of the inverse matrix, and that the nullity of B equals the nullity of the sub-block in the upper right of the inverse matrix.

The inversion procedure that led to Equation (1) performed matrix block operations that operated on C and D first. Instead, if A and B are operated on first, and provided D and M / D := ABD−1C are nonsingular,[11] the result is

Equating the upper-left sub-matrices of Equations (1) and (2) leads to

where Equation (3) is the Woodbury matrix identity, which is equivalent to the binomial inverse theorem.

If A and D are both invertible, then the above two block matrix inverses can be combined to provide the simple factorization

By the Weinstein–Aronszajn identity, one of the two matrices in the block-diagonal matrix is invertible exactly when the other is.

This formula simplifies significantly when the upper right block matrix B is the zero matrix. This formulation is useful when the matrices A and D have relatively simple inverse formulas (or pseudo inverses in the case where the blocks are not all square. In this special case, the block matrix inversion formula stated in full generality above becomes

If the given invertible matrix is a symmetric matrix with invertible block A the following block inverse formula holds[12]

where . This requires 2 inversions of the half-sized matrices A and S and only 4 multiplications of half-sized matrices, if organized properly together with some additions, subtractions, negations and transpositions of negligible complexity. Any matrix has an associated positive semidefinite, symmetric matrix , which is exactly invertible (and positive definite), if and only if is invertible. By writing matrix inversion can be reduced to inverting symmetric matrices and 2 additional matrix multiplications, because the positive definite matrix satisfies the invertibility condition for its left upper block A.

Those formulas together allow to construct a divide and conquer algorithm that uses blockwise inversion of associated symmetric matrices to invert a matrix with the same time complexity as the matrix multiplication algorithm that is used internally.[12] Research into matrix multiplication complexity shows that there exist matrix multiplication algorithms with a complexity of O(n2.371552) operations, while the best proven lower bound is Ω(n2 log n).[13]

By Neumann series

[edit]

If a matrix A has the property that

then A is nonsingular and its inverse may be expressed by a Neumann series:[14]

Truncating the sum results in an "approximate" inverse which may be useful as a preconditioner. Note that a truncated series can be accelerated exponentially by noting that the Neumann series is a geometric sum. As such, it satisfies

Therefore, only 2L − 2 matrix multiplications are needed to compute 2L terms of the sum.

More generally, if A is "near" the invertible matrix X in the sense that

then A is nonsingular and its inverse is

If it is also the case that AX has rank 1 then this simplifies to

p-adic approximation

[edit]

If A is a matrix with integer or rational entries, and we seek a solution in arbitrary-precision rationals, a p-adic approximation method converges to an exact solution in O(n4 log2 n), assuming standard O(n3) matrix multiplication is used.[15][16] The method relies on solving n linear systems via Dixon's method of p-adic approximation (each in O(n3 log2 n)) and is available as such in software specialized in arbitrary-precision matrix operations, for example, in IML.[17]

Reciprocal basis vectors method

[edit]

Given an n × n square matrix , , with n rows interpreted as n vectors (Einstein summation assumed) where the are a standard orthonormal basis of Euclidean space (), then using Clifford algebra (or geometric algebra) we compute the reciprocal (sometimes called dual) column vectors:

as the columns of the inverse matrix Note that, the place "" indicates that "" is removed from that place in the above expression for . We then have , where is the Kronecker delta. We also have , as required. If the vectors are not linearly independent, then and the matrix is not invertible (has no inverse).

References

[edit]
  1. Strang, Gilbert (2016). Introduction to Linear Algebra (5th ed.). Wellesley-Cambridge Press. ISBN 9780980232776.
  2. Pan, Victor; Reif, John (1985), Efficient Parallel Solution of Linear Systems, Proceedings of the 17th Annual ACM Symposium on Theory of Computing, Providence: ACM
  3. Pan, Victor; Reif, John (1985), Harvard University Center for Research in Computing Technology Report TR-02-85, Cambridge, MA: Aiken Computation Laboratory
  4. A proof can be found in the Appendix B of Kondratyuk, L. A.; Krivoruchenko, M. I. (1992). "Superconducting quark matter in SU(2) color group". Zeitschrift für Physik A. 344 (1): 99–115. Bibcode:1992ZPhyA.344...99K. doi:10.1007/BF01291027. S2CID 120467300.
  5. Horn, Roger A.; Johnson, Charles R. (2013). Matrix Analysis (2nd ed.). Cambridge University Press. ISBN 9780521548236.
  6. Golub, Gene H.; Van Loan, Charles F. (2013). Matrix Computations (4th ed.). Johns Hopkins University Press. ISBN 9781421407944.
  7. Horn, Roger A.; Johnson, Charles R. (2013). Matrix Analysis (2nd ed.). Cambridge University Press. ISBN 9780521548236.
  8. Strang, Gilbert (2003). Introduction to linear algebra (3rd ed.). SIAM. p. 71. ISBN 978-0-9614088-9-3., Chapter 2, page 71
  9. Bernstein, Dennis (2005). Matrix Mathematics. Princeton University Press. p. 44. ISBN 978-0-691-11802-4.
  10. Tzon-Tzer, Lu; Sheng-Hua, Shiou (2002). "Inverses of 2 × 2 block matrices". Computers & Mathematics with Applications. 43 (1–2): 119–129. Bibcode:2002CMwA...43..119L. doi:10.1016/S0898-1221(01)00278-4.
  11. Bernstein, Dennis (2005). Matrix Mathematics. Princeton University Press. p. 45. ISBN 978-0-691-11802-4.
  12. 1 2 T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, 3rd ed., MIT Press, Cambridge, MA, 2009, §28.2.
  13. Ran Raz. On the complexity of matrix product. In Proceedings of the thirty-fourth annual ACM symposium on Theory of computing. ACM Press, 2002. doi:10.1145/509907.509932.
  14. Stewart, Gilbert (1998). Matrix Algorithms: Basic decompositions. SIAM. p. 55. ISBN 978-0-89871-414-2.
  15. Haramoto, H.; Matsumoto, M. (2009). "A p-adic algorithm for computing the inverse of integer matrices". Journal of Computational and Applied Mathematics. 225 (1): 320–322. Bibcode:2009JCoAM.225..320H. doi:10.1016/j.cam.2008.07.044.
  16. Dixon, John D. (1982). "Exact Solution of Linear Equations Using P-Adic Expansions". Numerische Mathematik. 40: 137–142. doi:10.1007/BF01459082.
  17. "IML - Integer Matrix Library". cs.uwaterloo.ca. Retrieved 14 April 2018.