Skip to main content

Discrete Mathematics for Computer Science: An open educational resource.

Section 11.3 Matrix Inverses

Now we come to the most useful property a matrix can have, to be invertible, meaning it has an inverse matrix. A system of linear equations only has a solution if, when it’s represented in a matrix, that matrix is invertible. Matrix inverses also allow faster solving of systems of linear equations. This property is crucial for many computer science applications, such as these from the Wikipedia article: Invertible matrix
 1 
en.wikipedia.org/wiki/Invertible_matrix
:
  • In computer graphics and image processing, invertible matrices are fundamental for transformations. Whether rotating, scaling, or translating images, these matrices facilitate seamless manipulation, contributing to the creation of visually appealing graphics.
  • The world of cybersecurity relies on invertible matrices for encryption and decryption processes. Algorithms that involve matrix operations play a crucial role in securing sensitive information, making invertible matrices indispensable in cryptographic protocols.
  • In finance, invertible matrices find applications in portfolio optimization. Efficiently managing diverse assets and risk requires mathematical models that involve invertible matrices, ensuring robust financial strategies.
  • The backbone of many machine learning algorithms is formed by invertible matrices. From feature engineering to training models, these matrices contribute to the stability and efficiency of algorithms, enhancing predictive accuracy.
  • In data science, invertible matrices are employed for dimensionality reduction techniques. Simplifying complex datasets without losing crucial information is achieved through the application of these matrices, aiding in more manageable and insightful analyses.

Subsection 11.3.1 Inverse Matrix

Definition 11.3.1. Inverse Matrix.

An n×n matrix A has an inverse, A1 if and only if AA1=A1A=I. Such a matrix is called invertible.
It is very important to observe that the inverse of a matrix, if it exists, is unique. Another way to think of this is that if it acts like the inverse, then it is the inverse.

Proof.

A1=A1I=A1(AB)=(A1A)B=IB=B.
Unlike ordinary multiplication of numbers, it can happen that A0 but A may fail to have an inverse. This is illustrated in the following example.

Example 11.3.3. A matrix without an inverse.

Let A=(1111). Does A have an inverse?
Answer.
One might think A would have an inverse because it does not equal zero. However,
(1111)(11)=(00)
and if A1 existed, this could not happen because you could write
(00)=A1((00))=A1(A(11))=
(A1A)(11)=I(11)=(11),
a contradiction. Thus the answer is that A does not have an inverse.

Example 11.3.4. Showing a matrix is an inverse.

Let A=(1112). Show (2111) is the inverse of A.
Answer.
To check this, multiply
(1112)(2111)=(1001)
and
(2111)(1112)=(1001)
showing that this matrix is indeed the inverse of A.

Subsection 11.3.2 Finding The Inverse Of A Matrix

In the last example, how would you find A1? You wish to find a matrix (xzyw) such that
(1112)(xzyw)=(1001).
This requires the solution to the systems of equations,
x+y=1,x+2y=0
and
z+w=0,z+2w=1.
Writing the augmented matrix for these two systems gives
(11.3.1)(111120)
for the first system and
(11.3.2)(110121)
for the second. Let’s solve the first system. Take (1) times the first row and add to the second to get
(111011).
Now take (1) times the second row and add it to the first to get
(102011).
Putting in the variables, this says x=2 and y=1.
Now solve the second system, ((11.3.2)) to find z and w. Take (1) times the first row and add to the second to get
(110011).
Now take (1) times the second row and add it to the first to get
(101011).
Putting in the variables, this says z=1 and w=1. Therefore, the inverse matrix is
(2111).
Didn’t the above seem rather repetitive? Note that exactly the same row operations were used in both systems. In each case, the end result was something of the form (I|v) where I is the identity and v gave a column of the inverse. In the above, (xy), the first column of the inverse was obtained first and then the second column (zw).
To simplify this procedure, you could have written
(11101201)
and row reduced until you obtained
(10210111)
and read off the inverse as the 2×2 matrix on the right side.
This is the reason for the following simple procedure for finding the inverse of a matrix. This procedure is called the Gauss-Jordan procedure.

Definition 11.3.5. Gauss-Jordan Procedure.

Suppose A is an n×n matrix. To find A1 if it exists, form the augmented n×2n matrix
(A|I)
and then, if possible do row operations until you obtain an n×2n matrix of the form
(11.3.3)(I|B).
When this has been done, B=A1. If it is impossible to row reduce to a matrix of the form (I|B), then A has no inverse.
Actually, all this shows is how to find a right inverse if it exists. Later it will be shown that the right inverse is the inverse. See the Elementary Linear Algebra book at http://www.Saylor.org.
 2 
for proof of this.

Example 11.3.6. Using Gauss-Jordan to find a matrix inverse.

Let
A=(122102311).
Find A1 if it exists.
Answer.
Set up the augmented matrix (A|I)
(122100102010311001).
Next take (1) times the first row and add to the second followed by (3) times the first row added to the last. This yields
(122100020110057301).
Then take 5 times the second row and add to -2 times the last row
(12210001005500014152).
Next take the last row and add to (7) times the top row. This yields
(714065201005500014152).
Now take (7/5) times the second row and add to the top.
(70012201005500014152).
Finally divide the top row by 7, the second row by 10 and the bottom row by 14 which yields
(1001727270101212000111451417).
Therefore, the inverse is
(1727271212011451417).

Example 11.3.7. Gauss-Jordan on a matrix with no inverse.

Let
A=(122102224).
Find A1 if it exists.
Answer.
Write the augmented matrix (A|I)
(122100102010224001).
and proceed to do row operations attempting to obtain (I|A1) . Take (-1) times the top row and add to the second. Then take (-2) times the top row and add to the bottom.
(122100020110020201).
Next add (-1) times the second row to the bottom row.
(122100020110000111).
At this point, you can see there will be no inverse because you have obtained a row of zeros in the left half of the augmented matrix (A|I) . Thus there will be no way to obtain I on the left.

Example 11.3.8. Checking Gauss-Jordan outcome correctness.

Let
A=(101111111).
Find A1 if it exists.
Answer.
Form the augmented matrix
(101100111010111001).
Now do row operations until the n×n matrix on the left becomes the identity matrix. This yields after some computations,
(1000121201011000111212)
and so the inverse of A is the matrix on the right,
(0121211011212).
Checking the answer is easy. Just multiply the matrices and see if it works.
(101111111)(0121211011212)=(100010001).
Always check your answer because if you are like some of us, you will usually have made a mistake.

Example 11.3.9. Solving systems of equations with a matrix inverse.

In this example, it is shown how to use the inverse of a matrix to find the solution to a system of equations. Consider the following system of equations. Use the inverse of a suitable matrix to give the solutions to this system.
(x+z=1xy+z=3x+yz=2).
The system of equations can be written in terms of matrices as
(11.3.4)(101111111)(xyz)=(132).
More simply, this is of the form Ax=b. Suppose you find the inverse of the matrix A1 . Then you could multiply both sides of this equation by A1 to obtain
x=(A1A)x=A1(Ax)=A1b.
This gives the solution as x=A1b. Note that once you have found the inverse, you can easily get the solution for different right hand sides without any effort. It is always just A1b. In the given example, the inverse of the matrix is
(0121211011212).
This was shown above in Example 11.3.8. Therefore, from what was just explained, the solution to the given system is
(xyz)=(0121211011212)(132)=(52232).
What if the right side of (11.3.4) had been
(013)?
What would be the solution to
(101111111)(xyz)=(013)?
By the above discussion, it is just
(xyz)=(0121211011212)(013)=(212).
This illustrates why once you have found the inverse of a given matrix, you can use it to solve many different systems easily.

Exercises 11.3.3 Exercises

1.

Let
A=(2113).
Find A1 if possible using the Gauss-Jordan method. If A1 does not exist, determine why.
Answer.
Set up augmented matrix to use Gauss-Jordan:
(21101301).
Multiply row 2 by 2:
(21102602).
Add row 1 to row 2:
(21100712).
Divide row 2 by 7:
(2110011/72/7).
Subtract row 2 from row 1:
(206/72/7011/72/7).
Divide row 1 by 2:
(106/142/14011/72/7).
The inverse is the matrix on the right:
(6/142/141/72/7)
Check by multiplying the inverse with the original matrix:
(2113)(6/142/141/72/7)=(12/14+1/74/14+2/76/14+3/72/14+6/7)=(1001)
Which is what we want.

2.

Let
A=(0153).
Find A1 if possible using the Gauss-Jordan method. If A1 does not exist, determine why.

3.

Let
A=(2130).
Find A1 if possible using the Gauss-Jordan method. If A1 does not exist, determine why.
Answer.
Set up augmented matrix to use Gauss-Jordan:
(21103001).
Subtract 3 times row 1 from 2 times row 2
(21100332).
Divide row 2 by -3
(21100112/3).
Subtract row 2 from row 1
(2002/30112/3).
Divide row 1 by 2
(1002/60112/3).
So the inverse matrix is
(01/312/3)
Check by multiplying the inverse with the original matrix:
(2130)(01/312/3)=(0+12/3+2/30+03/3+0)=(1001)
Which is what we want.

4.

Let
A=(2142).
Find A1 if possible using the Gauss-Jordan method. If A1 does not exist, determine why.

5.

Let
A=(1232144510).
Find A1 if possible using the Gauss-Jordan method. If A1 does not exist, determine why.
Answer.
Set up augmented matrix to use Gauss-Jordan:
(1231002140104510001).
Row 3 - 4* row 1:
(123100214010032401).
Row 2 - 2* row 1:
(123100032210032401).
Row 3 - row 2:
(123100032210000611).
There is no inverse. The left side cannot be made into I.

6.

Let
A=(103234102).
Find A1 if possible using the Gauss-Jordan method. If A1 does not exist, determine why.

7.

Using the inverse of the matrix, find the solution to this system:
(123214102)(xyz)=(123)
Answer.
Set up augmented matrix to use Gauss-Jordan:
(123100214010102001).
Now perform row operations: Row 2 - 2 * row 1
(123100032210102001).
Row 3 - row 1
(123100032210021101).
Row 2 1/3
(123100012/32/31/30021101).
Row 3 +2 row 2
(123100012/32/31/30001/31/32/31).
Row 3 3
(123100012/32/31/30001123).
Row 1 3 row 3
(120269012/32/31/30001123).
Row 2 2/3 row 3
(120269010012001123).
Row 1 2 row 2
(100245010012001123).
The inverse matrix is
(245012123).
(xyz)=(245012123)(123)=)(946).
Therefore, the solution is x=9,y=4,z=6.

8.

Using the inverse of the matrix, find the solution to this system:
(103234102)(xyz)=(201)

9.

Using the inverse of the matrix, find the solution to this system:
(123214102)(xyz)=(101)
Answer.
We have already calculated the inverse for this matrix above in Exercise 7, it is
(245012123).
Solving for
(xyz)=(245012123)(101)=(724).
x=7,y=2,z=4.

10.

Using the inverse of the matrix, find the solution to this system:
(103234102)(xyz)=(312)