# 6.3 - The Inverse of a Square Matrix

## Real Numbers

When working in the real numbers, the equation ax=b could be solved for x by dividing both sides of the equation by a to get x=b/a, as long as a wasn't zero. It would therefore seem logical that when working with matrices, one could take the matrix equation AX=B and divide both sides by A to get X=B/A.

However, that won't work because ...

There is NO matrix division!

Ok, you say. Subtraction was defined in terms of addition and division was defined in terms of multiplication. So, instead of dividing, I'll just multiply by the inverse. This is the way that it has to be done.

## The Inverse of a Matrix

So, what is the inverse of a matrix?

Well, in real numbers, the inverse of any real number a was the number a-1, such that a times a-1 equaled 1. We knew that for a real number, the inverse of the number was the reciprocal of the number, as long as the number wasn't zero.

The inverse of a square matrix A, denoted by A-1, is the matrix so that the product of A and A-1 is the Identity matrix. The identity matrix that results will be the same size as the matrix A. Wow, there's a lot of similarities there between real numbers and matrices. That's good, right - you don't want it to be something completely different.

A(A-1) = I or A-1(A) = I

There are a couple of exceptions, though. First of all, A-1 does not mean 1/A. Remember, "There is no Matrix Division!" Secondly, A-1 does not mean take the reciprocal of every element in the matrix A.

## Requirements to have an Inverse

1. The matrix must be square (same number of rows and columns).
2. The determinant of the matrix must not be zero (determinants are covered in section 6.4). This is instead of the real number not being zero to have an inverse, the determinant must not be zero to have an inverse.

A square matrix that has an inverse is called invertible or non-singular. A matrix that does not have an inverse is called singular.

A matrix does not have to have an inverse, but if it does, the inverse is unique.

## Finding the Inverse the Hard Way

The inverse of a matrix A will satisfy the equation A(A-1) = I.

1. Adjoin the identity matrix onto the right of the original matrix, so that you have A on the left side and the identity matrix on the right side. It will look like this [ A | I ].
2. Row-reduce (I suggest using pivoting) the matrix until the left side is the Identity matrix. When the left side is the Identity matrix, the right side will be the Inverse [ I | A-1 ]. If you are unable to obtain the identity matrix on the left side, then the matrix is singular and has no inverse.
3. Take the augmented matrix from the right side and call that the inverse.

## Shortcut to the Finding the Inverse of a 2×2 Matrix

The inverse of a 2×2 matrix can be found by ...

1. Switch the elements on the main diagonal
2. Take the opposite of the other two elements
3. Divide all the values by the determinant of the matrix (since we haven't talked about the determinant, for a 2×2 system, it is the product of the elements on the main diagonal minus the product of the other two elements).

### Example for the shortcut

Let's go with an original matrix of

 7 -2 3 5

Step 1, switch the elements on the main diagonal would involve switching the 5 and 7.

 5 -2 3 7

Step 2, take the opposite of the other two elements, but leave them where they are.

 5 2 -3 7

Step 3, find the determinant and divide every element by that. The determinant is the product of the elements on the main diagonal minus the product of the elements off the main diagonal. That means the determinant of this matrix is 7(5) - (-3)(2) = 35 + 6 = 41. We divide every element by 41.

The inverse of the original matrix is ...

 5/41 2/41 -3/41 7/41

Now, you're saying, wait a minute - you said there was no matrix division. There is no division by a matrix. You may multiply or divide a matrix by a scalar (real number) and the determinant is a scalar.

## Using the Calculator

Now that you know how to find the identity matrix by hand, let's talk practicality. The calculator will do it for you.

### Entering a Matrix

1. Press the Matrix key (right below the X key). On the TI-83+, you will need to hit 2nd Matrix.
2. Arrow to the Edit submenu.
3. Choose a Matrix to work with. You have five to choose from with the TI-82 and ten to choose from with the TI-83. Typically, you will use [A]. Try to avoid using [E] for unspecified reasons that will be specified if you take Finite Mathematics.
4. Enter the number of rows, press enter, and then enter the number of columns, followed by enter.
5. You now enter each element in the matrix, reading from left to right and top to bottom. Press enter after each number. You may use the arrow keys to move around if you make a mistake.
6. Quit (2nd Mode) when you are done entering all the numbers.

### Using Matrices

Whenever you need to access a matrix that you have created, just hit the Matrix key and choose the appropriate matrix. I would suggest that you start using Matrix 1, Matrix 2, etc, instead of Matrix, arrow down, enter. It will go faster, and you will be doing a lot with these matrices.

### Finding the Inverse of a Matrix on a Calculator

Enter the expression [A]-1 by going Matrix 1, and then hitting the x-1 key. It will not work if you try to raise the matrix to the -1 power as in [A]^(-1).

You may have to use the right or left arrow keys to scroll through the entire matrix to write it down. Please give exact answers whenever possible.

One way of giving exact answers is to have the calculator convert the decimals to fractions for you. After all, fractions really are your friends (and I seriously mean that here). You can have the calculator do a decimal to fraction conversion by hitting Math, Enter, Enter.

Also, if you get an answer like 1.2E-12, chances are really good that number is zero and it is because of inaccuracies in the calculator that you are getting that response. Convert the number to zero.

## Why was it we needed an inverse?

One of the major uses of inverses is to solve a system of linear equations. You can write a system in matrix form as AX = B.

Now, pre-multiply both sides by the inverse of A. Make sure you meet these two conditions.

1. You must place the inverse of the matrix adjacent to the matrix. That is because Inverses need to be next to each other (very loose mathematically, but think back to functions) in order to undo each other.
2. If you multiply by putting something in front of the left side (pre-multiply), it has to go in front of the right side. If you put something behind (post-multiply) the left side, it has to go behind the right side.

Matrix Multiplication is NOT Commutative!

A-1(AX) = A-1(B) ... pre-multiply both sides by A-1

(A-1A) X = A-1 B ... use the associative property to regroup factors

I X = A-1 B ... when you multiply inverses together, they become the identity matrix

X = A-1 B ... the identity matrix is like multiplying by 1.

If AX = B, then X = A-1 B

So what you're asking in your normal cynical way is "You've just solved another equation, what does that have to do with anything?"

## Solving Systems of Linear Equations

Consider the system of linear equations

```3x + 2y - 5z =  12
x - 3y + 2z = -13
5x -  y + 4z =  10```

Write the coefficients in an A matrix.

x y z 3 2 -5 1 -3 2 5 -1 4

Write the variables in an X matrix.

 x y z

Write the constants in a B matrix.

 12 -13 10

### Verify that AX = B

This step isn't really needed, but I wanted to show you that this thing really does work.

AX will be a (3×3) × (3×1) = 3×1 matrix. The B matrix is also a 3×1 matrix, so at least the dimensions work out right.

Here's A times X.

 3 2 -5 x 3x + 2y - 5z 1 -3 2 y = 1x - 3y + 2z 5 -1 4 z 5x - 1y + 4z

Notice that turns out to be the left side of the system of equations. The B is the right hand side, so we have achieved equality. Woohoo! You can write a system of linear equations as AX = B.

So, if you can write a system of linear equations as AX=B where A is the coefficient matrix, X is the variable matrix, and B is the right hand side, you can find the solution to the system by X = A-1 B.

Place the coefficient matrix into [A] on the calculator and the right hand side into [B].

If you asked the calculator to find the inverse of the coefficient matrix, it would give you this for A-1

 5/44 3/88 1/8 -3/44 -37/88 1/8 -7/44 -13/88 1/8

You could do that, and then multiply that by B, but it would be easier just to put the whole expression into the calculator and get the answer directly. Even what is shown below is more work than is necessary.

X = A-1 B = ...

 x 5/44 3/88 1/8 12 191/88 y = -3/44 -37/88 1/8 -13 = 519/88 z -7/44 -13/88 1/8 10 111/88

There you go, x = 191/88, y = 519/88, and z = 111/88. That would be a real pain to solve by hand.

## This is easy, why don't we always do this?

The main reason is because it doesn't always work.

1. Inverses only exist for square matrices. That means if you don't the same number of equations as variables, then you can't use this method.
2. Not every square matrix has an inverse. If the coefficient matrix A is singular (has no inverse), then there may be no solution or there may be many solutions, but we can't tell what it is.
3. Inverses are a pain to find by hand. If you have a calculator, it's not so bad, but remember that calculators don't always give you the answer you're looking for.