Inversion of matrices¶
Vectors and matrices · Chapter 4.3 · Lecture notes (PDF) · Exercises: Inversion of matrices · Slides (PDF) · App: Inverse matrix
1. Properties of the inverse matrix¶
-
Recall (see the chapter on matrices) that a square matrix \(\boldsymbol A \in \R^{n\times n}\) is invertible if there exists a matrix \(\boldsymbol A^{-1} \in \R^{n\times n}\) such that \(\boldsymbol A\boldsymbol A^{-1} = \boldsymbol A^{-1}\boldsymbol A = \boldsymbol I\). A square matrix which is not invertible is called singular.
-
In this chapter, \(\boldsymbol A'\) denotes the transpose of \(\boldsymbol A\), as in the chapter on matrices.
Proposition 1: Uniqueness of the inverse
Let \(\boldsymbol A \in \R^{n\times n}\) be invertible. If \(\boldsymbol B, \boldsymbol C \in \R^{n\times n}\) are such that \(\boldsymbol A\boldsymbol B = \boldsymbol B\boldsymbol A = \boldsymbol I\) and \(\boldsymbol A\boldsymbol C = \boldsymbol C\boldsymbol A = \boldsymbol I\), then \(\boldsymbol B = \boldsymbol C\).
Proof
Using the associativity of the matrix product, we have:
□
Proposition 2: Properties of the inverse
Let \(\boldsymbol A, \boldsymbol B \in \R^{n\times n}\) be invertible matrices. Then:
-
\(\boldsymbol A^{-1}\) is invertible and \((\boldsymbol A^{-1})^{-1} = \boldsymbol A\);
-
\(\boldsymbol A\boldsymbol B\) is invertible and \((\boldsymbol A\boldsymbol B)^{-1} = \boldsymbol B^{-1}\boldsymbol A^{-1}\);
-
\(\boldsymbol A'\) is invertible and \((\boldsymbol A')^{-1} = (\boldsymbol A^{-1})'\);
-
\(\det(\boldsymbol A) \neq 0\) and \(\det(\boldsymbol A^{-1}) = \dfrac{1}{\det(\boldsymbol A)}\).
Proof
By the uniqueness of the inverse, in each case it is enough to exhibit a matrix that multiplied on the left and on the right gives \(\boldsymbol I\).
-
From \(\boldsymbol A^{-1}\boldsymbol A = \boldsymbol A\boldsymbol A^{-1} = \boldsymbol I\), the matrix \(\boldsymbol A\) is the inverse of \(\boldsymbol A^{-1}\).
-
Using associativity:
\[ (\boldsymbol A\boldsymbol B)(\boldsymbol B^{-1}\boldsymbol A^{-1}) = \boldsymbol A(\boldsymbol B\boldsymbol B^{-1})\boldsymbol A^{-1} = \boldsymbol A\boldsymbol I\boldsymbol A^{-1} = \boldsymbol A\boldsymbol A^{-1} = \boldsymbol I, \]\[ (\boldsymbol B^{-1}\boldsymbol A^{-1})(\boldsymbol A\boldsymbol B) = \boldsymbol B^{-1}(\boldsymbol A^{-1}\boldsymbol A)\boldsymbol B = \boldsymbol B^{-1}\boldsymbol I\boldsymbol B = \boldsymbol B^{-1}\boldsymbol B = \boldsymbol I. \] -
Recall that \((\boldsymbol C\boldsymbol D)' = \boldsymbol D'\boldsymbol C'\) for all \(\boldsymbol C, \boldsymbol D \in \R^{n\times n}\): indeed, the entry \((i,j)\) of \((\boldsymbol C\boldsymbol D)'\) is the entry \((j,i)\) of \(\boldsymbol C\boldsymbol D\), i.e., \(\sum_{k=1}^n c_{jk}d_{ki} = \sum_{k=1}^n d'_{ik}c'_{kj}\), which is the entry \((i,j)\) of \(\boldsymbol D'\boldsymbol C'\). Then, since \(\boldsymbol I' = \boldsymbol I\):
\[ \boldsymbol A'(\boldsymbol A^{-1})' = (\boldsymbol A^{-1}\boldsymbol A)' = \boldsymbol I' = \boldsymbol I, \qquad (\boldsymbol A^{-1})'\boldsymbol A' = (\boldsymbol A\boldsymbol A^{-1})' = \boldsymbol I' = \boldsymbol I. \] -
From the product rule of determinants:
\[ \det(\boldsymbol A)\det(\boldsymbol A^{-1}) = \det(\boldsymbol A\boldsymbol A^{-1}) = \det(\boldsymbol I) = 1. \]Hence \(\det(\boldsymbol A)\neq 0\) and \(\det(\boldsymbol A^{-1}) = 1/\det(\boldsymbol A)\).
□
-
Note the reversed order in \((\boldsymbol A\boldsymbol B)^{-1} = \boldsymbol B^{-1}\boldsymbol A^{-1}\): since the matrix product is not commutative, in general \((\boldsymbol A\boldsymbol B)^{-1} \neq \boldsymbol A^{-1}\boldsymbol B^{-1}\).
-
Property 4 shows that a matrix with \(\det(\boldsymbol A) = 0\) cannot be invertible, i.e., it is singular.
2. Computation of the inverse¶
2.1 Gauss–Jordan method¶
Gauss–Jordan method (idea). To compute \( \boldsymbol A^{-1} \), we build the augmented matrix
and we apply elementary row operations to transform the left block into the identity matrix. If we obtain
then \( \boldsymbol B = \boldsymbol A^{-1} \).
Example 1: inverse matrix via Gauss–Jordan elimination
Let us consider
We compute the inverse matrix \(\boldsymbol A^{-1}\) with the method of Gauss–Jordan.
Since the left block is the identity matrix, we obtain:
We can verify:
Example 2: inverse matrix via Gauss–Jordan elimination
Let us consider
We compute the inverse matrix \(\boldsymbol A^{-1}\) with the method of Gauss–Jordan.
Since the left block is the identity matrix, we obtain:
Example 3: inverse matrix via Gauss–Jordan elimination with a row swap
Let us consider
We compute the inverse matrix \(\boldsymbol A^{-1}\) with the method of Gauss–Jordan. Since \(a_{11}=0\), we start with a row swap.
Since the left block is the identity matrix, we obtain:
Observation 1: Singular matrices and the Gauss–Jordan method
Let \(\boldsymbol A \in \R^{n\times n}\). If, while applying elementary row operations to \(\left(\boldsymbol A \mid \boldsymbol I\right)\), a zero row appears in the left block, then \(\det(\boldsymbol A) = 0\) and \(\boldsymbol A\) is singular: the method stops and \(\boldsymbol A^{-1}\) does not exist.
Proof
The left block is obtained from \(\boldsymbol A\) by elementary row operations. Each of them multiplies the determinant by a nonzero number (\(-1\) for a row swap, \(\lambda\neq 0\) for a row scaling, \(1\) for a row addition). A matrix with a zero row has zero determinant (Laplace expansion along that row), hence \(\det(\boldsymbol A) = 0\). By property 4 of Proposition Proposition 2, \(\boldsymbol A\) is not invertible. □
Example 4: Gauss–Jordan elimination on a singular matrix
Let us consider
We try to compute \(\boldsymbol A^{-1}\) with the method of Gauss–Jordan.
The third row of the left block is zero: the left block cannot be transformed into the identity matrix, and the method stops. Hence \(\boldsymbol A\) is singular. Indeed, the third row of \(\boldsymbol A\) is the difference of the second and the first row, and
2.2 Inverse via the adjugate matrix¶
- Recall (see the chapter on matrices) that, given \(\boldsymbol A \in \R^{n\times n}\), the cofactor of the entry \(a_{ij}\) is \(C_{ij} = (-1)^{i+j}\det(\boldsymbol A_{ij})\), where \(\boldsymbol A_{ij}\) is the minor matrix obtained from \(\boldsymbol A\) by deleting row \(i\) and column \(j\).
Definition 1: Cofactor matrix and adjugate matrix
Let \(\boldsymbol A \in \R^{n\times n}\) with \(n\ge 2\). The cofactor matrix of \(\boldsymbol A\) is the matrix \(\boldsymbol C = (C_{ij}) \in \R^{n\times n}\) of the cofactors of \(\boldsymbol A\). The adjugate matrix of \(\boldsymbol A\) is the transpose of the cofactor matrix:
Theorem 1: Adjugate formula
Let \(\boldsymbol A \in \R^{n\times n}\) with \(n\ge 2\). Then
Consequently, if \(\det(\boldsymbol A)\neq 0\), then \(\boldsymbol A\) is invertible and
Proof
The entry \((i,j)\) of \(\boldsymbol A\,\mathrm{adj}(\boldsymbol A)\) is
-
If \(i=j\), this is the Laplace expansion of \(\det(\boldsymbol A)\) along row \(i\).
-
If \(i\neq j\), this is the Laplace expansion along row \(j\) of the matrix \(\widetilde{\boldsymbol A}\) obtained from \(\boldsymbol A\) by replacing row \(j\) with row \(i\) (the cofactors \(C_{jk}\) do not depend on row \(j\)). The matrix \(\widetilde{\boldsymbol A}\) has two equal rows: swapping them leaves \(\widetilde{\boldsymbol A}\) unchanged and changes the sign of its determinant, so \(\det(\widetilde{\boldsymbol A}) = -\det(\widetilde{\boldsymbol A})\), i.e., \(\det(\widetilde{\boldsymbol A}) = 0\).
Hence \(\boldsymbol A\,\mathrm{adj}(\boldsymbol A) = \det(\boldsymbol A)\,\boldsymbol I\). The identity \(\mathrm{adj}(\boldsymbol A)\,\boldsymbol A = \det(\boldsymbol A)\,\boldsymbol I\) is obtained in the same way, using Laplace expansions along columns. If \(\det(\boldsymbol A) \neq 0\), dividing by \(\det(\boldsymbol A)\) shows that \(\frac{1}{\det(\boldsymbol A)}\mathrm{adj}(\boldsymbol A)\) is the inverse of \(\boldsymbol A\). □
Observation 2: Invertibility and determinant
A square matrix \(\boldsymbol A \in \R^{n\times n}\) is invertible if and only if \(\det(\boldsymbol A) \neq 0\).
Proof
If \(\boldsymbol A\) is invertible, then \(\det(\boldsymbol A)\neq 0\) by property 4 of Proposition Proposition 2. Conversely, if \(\det(\boldsymbol A)\neq 0\), then \(\boldsymbol A\) is invertible by Theorem Theorem 1 (for \(n=1\), \(\boldsymbol A = (a)\) with \(a\neq 0\) and \(\boldsymbol A^{-1} = (1/a)\)). □
Observation 3: Inverse of a \(2\times 2\) matrix
Let
Then
Proof
The minor matrices of \(\boldsymbol A\) are \(1\times 1\), so the cofactors are \(C_{11} = d\), \(C_{12} = -c\), \(C_{21} = -b\), \(C_{22} = a\). Hence
and the formula follows from Theorem Theorem 1. □
Inverse of a \(2\times 2\) matrix (rule). Swap the two diagonal entries, change the sign of the two off-diagonal entries, and divide by the determinant.
Example 5: inverse of a \(2\times 2\) matrix with the formula
Let us consider again
We have \(\det(\boldsymbol A) = 2\cdot 1 - 1\cdot 1 = 1 \neq 0\), hence
which is the matrix obtained with the method of Gauss–Jordan in Example Example 1.
Example 6: inverse of a \(3\times 3\) matrix with the adjugate formula
Let us consider again
By Laplace expansion along the first row:
The cofactors are:
Hence
and
which is the matrix obtained with the method of Gauss–Jordan in Example Example 2.
- For \(n=2\) (and often for \(n=3\)) the adjugate formula is convenient for computations by hand. For larger matrices, the method of Gauss–Jordan requires far fewer operations.
Try it in the lab
the same computation step by step: change the matrix and watch the steps change.
Exercises and lab¶
- Exercises · the exercise sheet of this chapter: 10 exercises with worked solutions
- Lab · Inverse matrix — Gauss–Jordan on \((\boldsymbol A \mid \boldsymbol I)\) or the cofactor formula.