Matrix Inverse by the Elimination Method¶
Given two square matrices of the same size, \(\ \boldsymbol{A}=[\,a_{ij}\,]_{n\times n}\ \,\text{and}\ \, \boldsymbol{B}=[\,b_{ij}\,]_{n\times n}\ \,\text{in}\ \,M_n(K)\,,\ \) \(\\\) we shall use the term 2-block for the matrix formed by appending \(\,\boldsymbol{B}\,\) onto the right side of \(\ \boldsymbol{A}:\)
Lemma. \(\,\)
We assume, as above, that \(\ \boldsymbol{A},\boldsymbol{B}\in M_n(K)\,.\)
\(\,\) If \(\ O\ \) is a row elementary operation, \(\,\) then \(\ \,O\,\left[\,\boldsymbol{A}\,|\,\boldsymbol{B}\,\right]\ =\ \left[\,O\boldsymbol{A}\,|\,O\boldsymbol{B}\,\right]\,.\)
\(\,\) Let \(\ \boldsymbol{C}\in M_n(K)\,.\ \,\) Then \(\ \,\boldsymbol{C}\, \left[\,\boldsymbol{A}\,|\,\boldsymbol{B}\,\right]\,=\, \left[\;\boldsymbol{C}\boldsymbol{A}\,|\, \boldsymbol{C}\boldsymbol{B}\;\right]\,.\)
Whereas the first statement of the Lemma is obvious, the second one may be easily validated on the grounds of the Column Rule of Matrix Multiplication.
Now suppose that \(\,\boldsymbol{A}\in M_n(K)\,\) is an invertible matrix, and that the consecutive elementary operations \(\,O_1\,,O_2,\,\dots,\,O_k\,,\ \) represented by elementary matrices \(\,\boldsymbol{E}_1,\boldsymbol{E}_2,\dots,\boldsymbol{E}_k\in M_n(K),\,\) transform \(\,\boldsymbol{A}\,\) into the reduced row echelon form (the latter is the identity matrix):
We note immediately that
Let’s apply the operations \(\,O_1\,,O_2,\,\dots,\,O_k\ \) to the 2-block \(\,\left[\,\boldsymbol{A}\,|\,\boldsymbol{I}_n\,\right].\,\) \(\\\) Using the Lemma, Theorem 2. as well as Eqs (1) and (2), we get
That way we have come up with a practical recipe to obtain the inverse of a matrix.
Proposition 3. \(\,\) Matrix Inversion Algorithm \(\,\)
Let \(\,\boldsymbol{A}\in M_n(K)\,\) be an invertible matrix. \(\\\) To find its inverse, create the 2-block \(\,\left[\,\boldsymbol{A}\,|\,\boldsymbol{I}_n\,\right]\,\) and perform elementary row operations which transform the first segment of the 2-block into the identity matrix. Then the second segment turns out to be \(\,\boldsymbol{A}^{-1}\,.\)
Example. \(\,\) Find the inverse of \(\ \boldsymbol{A}\ =\ \left[\begin{array}{rrrr} 2 & 0 & -1 & 1 \\ 1 & 1 & -1 & 0 \\ -1 & 0 & 6 & 1 \\ 1 & 0 & 1 & 1 \end{array}\right]\,.\) \(\\\)
The Sage code calculates \(\,\boldsymbol{A}^{-1}\,\) and checks the result:
sage: A = matrix(QQ,[[ 2, 0,-1, 1],
[ 1, 1,-1, 0],
[-1, 0, 6, 1],
[ 1, 0, 1, 1]])
# Create the 2-block [A|I]:
sage: AI = A.augment(identity_matrix(QQ,4))
# Transform [A|I] into [I|A^(-1)]:
sage: IA_1 = AI.rref()
# Select the second segment of the 2-block
# (columns starting from 4. to the last):
sage: A_1 = IA_1[:,4:]
# Display the product of the original matrix
# and its inverse:
sage: table([[A, '*', A_1, '=', A * A_1]])
The output reads:
The matrix \(\,\boldsymbol{A}^{-1}\,\) in question is given as the second factor on the left-hand side.