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.
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 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.
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
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:
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.
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/(ad − bc) is the reciprocal of the determinant of the matrix in question, and the same strategy could be used for other matrix sizes.
(where the scalarA 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:
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:
where A, B, C and D are matrix sub-blocks of arbitrary size and :=\mathbf {D} -\mathbf {C} \mathbf {A} ^{-1}\mathbf {B} }
is the Schur complement of A. (A must be square, so that it can be inverted. Furthermore, A and D − CA−1B must be nonsingular.[9])
Matrices can also be inverted blockwise by using the analytic inversion formula:[10]
1
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:= A − BD−1C are nonsingular,[11] the result is
2
Equating the upper-left sub-matrices of Equations (1) and (2) leads to
If A and D are both invertible, then the above two block matrix inverses can be combined to provide the simple factorization
2
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]
4
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.
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 A − X has rank 1 then this simplifies to
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 log2n), 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 log2n)) and is available as such in software specialized in arbitrary-precision matrix operations, for example, in IML.[17]
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).
↑Strang, Gilbert (2016). Introduction to Linear Algebra (5thed.). Wellesley-Cambridge Press. ISBN9780980232776.
↑Pan, Victor; Reif, John (1985), Efficient Parallel Solution of Linear Systems, Proceedings of the 17th Annual ACM Symposium on Theory of Computing, Providence: ACM
↑
Pan, Victor; Reif, John (1985), Harvard University Center for Research in Computing Technology Report TR-02-85, Cambridge, MA: Aiken Computation Laboratory
↑
Bernstein, Dennis (2005). Matrix Mathematics. Princeton University Press. p.45. ISBN978-0-691-11802-4.
12T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, 3rd ed., MIT Press, Cambridge, MA, 2009, §28.2.
↑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.