What...is the matrix?... by Brandon Williams
Main index...

In my tutorial that discussed the derivation of rotation matrices I gave a "quick and dirty" introduction to matrices. After reading it just now I realize how bad it was. This time I am going to make right what that tutorial did wrong. And since this is a tutorial about only matrices there are no prerequisites (yea!). This will also be a much shorter tutorial compared to my other ones and hopefully pretty in depth. Pair this up with my vector tutorial and you have a somewhat good introduction to Linear Algebra (or at least a Alg.II/Pre-Calc./Calculus class).

First we discuss some fundamentals that I hope you learned in an Algebra class, but I think is worth going over again, and that's properties of operations. Some of these are really obvious and others are even more obvious, but we need terms to stick to them so I can just call out a word and you already what it means...and there are going to be a lot of terms in this part. Note: these have nothing to do with matrices as of yet. Properties of addition first:
      Associative Property of Addition
          (a + b) + c = a + (b + c)

      Commutative Property of Addition
          a + b = b + a

      Additive Identity
          The additive identity, I, is a number which when added to
          any other number, a, will not change a.  For addition the
          identity is zero because: a + I = a  and a + 0 = a

Now I bet you are seeing just how obvious and fundamental that is. But, in any case you need to know it. Next is multiplication:

      Associative Property of Multiplication
          (a * b) * c = a * (b * c)

      Commutative Property of Multiplication
          a * b = b * a

      Distributive Property of Multiplication
          a * (b + c) = (a * b) + (a * c)

      Multiplicative Identity
          The multiplicative identity, I, is a number which when
          multiplied by any other number, a, will not change a.
          For multiplication the identity is one because: a * I = a
          and a * 1 = a

Once again pretty simple. But, just one more:

      Inverse Operation
          An operation that "reverses" another operation. Addition
          and subtraction are inverses of each other, as are multiplication
          and division.

So you've learned a few properties. So what? Well it's important to know these properties when we start examining the properties of matrices. Now for the actual matrix stuff.

Matrices are way of representing data. They are best graphically shown as a rectangular array of numbers. They can be used to arrange data, and to solve for variables in a system of equations. There are going to be quite a few terms in this part so make sure to learn them.

Every matrix is defined by its dimensions. A matrix with the dimensions m x n has m rows and n columns. Every element within a matrix is defined by its position based on its row and column. First here is what a matrix would look like:

          | M11  M12  M13  ... |
      M = | M21  M22  M23  ... |
          | M31  M32  M33  ... |
          | ...  ...  ...  ... |

You can now easily refer to any element by simply saying "M11" instead of "the element in the first row and the first column." And when writing things down the above matrix is usually denoted as [M]. The above matrix does not have any set dimensions though because I wanted to show you what one looked like and how you can refer to its elements. If we changed [M] into, say, a 3 x 4 matrix it would look something like this:

          | 2  4  1  2 |
      M = | 1  6  8  1 |
| 7 1 2 1 |

Those numbers I put there are just random also so do not worry about that. Now, since you understand how to refer to certain elements by their place in the matrix you should be able to answer a few things. Like what is the value in element M23? Go ahead and figure it would real quick. Just so you can check yourself the answer is 8.

Anyway, moving on. Next is some arithmetic using matrices. The easy stuff first: adding two matrices. Before you can add two matrices you must check that they meet a certain requirement. Two matrices can be added together if and only if they have the same number of rows and columns. Their sum will be a matrix with the same dimensions as the other two. Once that is checked you can continue with the actual arithmetic. When adding two matrices you simply add their corresponding elements. Here is a generalized example of adding two matrices, [A] and [B]:

          | a11  a12 |        | b11  b12 |
      A = | a21  a22 |    B = | b21  b22 |
          | a31  a32 |        | b31  b32 |


                  | a11 + b11   a12 + b12 |
      [A] + [B] = | a21 + b21   a22 + b22 |
                  | a31 + b31   a32 + b32 |

Everything should be pretty clear so far. I am merely adding corresponding elements in both the matrices. I find A11 in [A] and B11 in [B] and add the two and then that's the first element in the sum matrix. Some properties which of matrix addition, which you should see, is that it is commutative and associative. Here is an example with actual numbers:

          | 2  5 |        | 7  3 |
      A = | 9  4 |    B = | 1  3 |
          | 2  5 |        | 2  7 |


                  | 2 + 7   5 + 3 |   |  9   8 |
      [A] + [B] = | 9 + 1   4 + 3 | = | 10   7 |
                  | 2 + 2   5 + 7 |   |  4  12 |

Hopefully that will clear up any confusion you might have. The next arithmetic operation would be subtraction. But, this time I'm not going to give any examples because it is basically the same as addition. When subtracting two matrices you subtract their corresponding elements. Just use all the above examples except replace the "+'s" with "-'s".

Our next operation is multiplying with matrices. There are two parts to this though: multiplying a matrix by a scalar, and multiplying two matrices together. And first things first...scalar multiplication.

A scalar can be anything from a constant (ex: 5), a variable (ex: x), or an expression (ex: x + 2). To evaluate a matrix being multiplied by a scalar you simply multiply every element in the matrix by that scalar. Here is a generalized example:

            | M11  M12  M13 |
      [M] = | M21  M22  M23 |  x = scalar
            | M31  M32  M33 |
 
| x*(M11) x*(M12) x*(M13) |
x*[M] = | x*(M21) x*(M22) x*(M23) | | x*(M31) x*(M32) x*(M33) |

Multiplying a matrix by a scalar is pretty easy right? Here is an example with numbers:

            | 3  5 |
      [M] = | 9  1 |
            | 1  4 |

                 |  9x  15x |
      3x * [M] = | 27x   3x |
                 |  3x  12x |

And that's all there is to it. Now here comes something a little harder: multiplying two matrices. Just like when adding and subtracting matrices, for multiplying you must first check if the two matrices meet certain requirements. In the case for addition and subtraction the two matrices had to have the same dimensions. This time, however, if you were multiplying [A] by [B] then [A] must have the same number of columns as [B] has rows. In general, [A] must have the dimension m x p and [B] must have the dimensions p x n. All three variables (m, n, and p) can be any number.

I am going to show you the way I am comfortable with multiplying matrices. Granted, there really is only one way to multiply matrices, there are certain tricks people use to help them with it. We are going to start by looking at the simplest case of matrix multiplication: multiplying a matrix with the dimensions 1 x p and a matrix that is p x 1, which is pretty much the same as multiplying a row by a column. Graphically this is what they would look like:

                                            | b11 |
      [A] = | a11  a12  a13  a14 |      [B] = | b21 |
                                            | b31 |
                                            | b41 |
      [A] * [B] = [P]

The product of [A] and [B] is another matrix, [P]. Matrix [A] has the dimensions of 1 x 4 and [B] that of 4 x 1. Are they capable of being multiplied? Yes, because [A]'s number of columns equals the number of rows in [B]. When you finally get around to the actual multiplication the product, [P], will have the dimensions of the number of rows in [A] by the number of columns in [B]. In this case it will be a 1 x 1 matrix which is just a number. No need for the brackets in this case.

Now here is my rather lame attempt at explaining how to multiply the two above matrices. You are going to literally multiply the entire column in [B] by the row in [A]. To do this you will first take the first element in the column and multiply it by the first element in the row. Then do the same for the second, third, and forth columns/rows. You should now have four numbers. Simply add all four numbers and that is the product of the two matrices.

That was just one lame attempt at explaining it...I still have one more. This time, however, I'm going to show you graphically (which is usually better for learning purposes). This is what I am going to do. Imagine that you have the two above matrices, [A] and [B]. Now grab [B] and turn it ninety degrees counterclockwise so that element b11 on the left and element b41 is on the right. And finally place [B] right above [A] so that a11 and b11 line up. You should have something like this:

      [B] = | b11  b21  b31  b41 |
      [A] = | a11  a12  a13  a14 |

Something important to note here is that I kept the element names for [B] the same even though I changed the dimensions of the matrix. Do not let that confuse you. Ok, so this is what you are going to do next. All the elements that line up vertically you are going to multiply them together. Then once you have all of those values you are going to add them. So we can change the above to this:

      [B] = |  b11         b21         b31         b41  |
      [A] = |  a11         a12         a13         a14  |
      ---------------------------------------------------
      [P] = (b11*a11) + (b21*b12) + (b31*a13) + (b41*a14)

So that is another way of doing things. Now the reason I showed you this is because all situations where you are multiplying two matrices you can break it down into a bunch of instances like the above, sometimes making it easier to evaluate the problem. Before we move on let's have a sample problem. Try to figure this out on your own:

                                 | 5 |
      [A] = | 2  5  7 |    [B] = | 6 |
                                 | 2 |


      [A] * [B] = ?

Try to figure it out before you read anymore. If you have already figured it out then...I...got...54 as an answer. Now you know everything there is to know about multiplying a row by a column. However, when you get into matrices with larger dimensions there is still one more thing to learn. Like always, let's look at a generalized example real quick:

            | a11  a12  a13 |           | b11  b12  b13 |
      [A] = | a21  a22  a23 |     [B] = | b21  b22  b23 |
                                        | b31  b32  b33 |


      [A] * [B] = [P]

A brief description of what we have going on here. Two matrices. [A] with dimensions of 2 x 3 and [B] with dimensions of 3 x 3. They are capable of being multiplied as you should be able to tell by now. The product matrix will have the dimensions of 2 x 3. Now let's try to find the elements of the product matrix. We are going start out by finding p11 (the first element in the product matrix). To find that element you are going to use the same method we discuss above with the first row in [A] and the first column [B]. After that you solve for p21 (directly below p11). To do this use the same column from [B], but this time multiply it with the second row of [A]. Since your product matrix only has two rows you would stop there and go on to the next column. Now you do the same thing as before except use the second column in [B] and multiply it by the first and second row of [A].

Hopefully you will see some kind of pattern emerging out of all this madness. But, before I tell you the pattern I think I need to clarify something. When I say, "multiply a row by a column" I am merely talking about that method we used way above where we lines the two matrices together and solved for one value. And that's it. I just do not want to confuse you because I know this can be a lot to take in. If you understand everything so far then you are doing better than I did.

Ok, now we can talk about the pattern. If you wanted to find element pmn in the product matrix you simply multiply the mth row of [A] by the nth row of [B]. That's the pattern. Probably not as abstract as you thought. Let's look at an example with real numbers:

            | 4  1  6 |            | 4  6  1 |
      [A] = | 3  6  9 |      [B] = | 5  8  2 |
                                   | 2  5  8 |


      [A] * [B] = [P]

Ok, let's just take it one step at a time. The first thing you should always ask yourself is whether or not the matrices can be multiplied by each other. In this case, of course, they can. Next, you want to find out what the dimensions are going to be for the product matrix. The above matrices will produce a 2 x 3 matrix when multiplied.

And only until all of that is done should you start multiplying the matrices. And once you are on this part just take it one element at a time. I start with p11 and go down the column, and then go back to the top of the next column and go down again. I encourage you to solve the above yourself before you read on. This next part is just going to be my work:

            | 4  1  6 |   | 4  6  1 |
      [P] = | 3  6  9 | * | 5  8  2 |
                          | 2  5  8 |




            | (4*4 + 5*1 + 2*6)  (6*4 + 8*1 + 5*6)  (1*4 + 2*1 + 8*6) |
          = | (4*3 + 5*6 + 2*9)  (6*3 + 8*6 + 5*9)  (1*3 + 2*6 + 8*9) |


            | 33   62  54 |
          = | 60  111  87 |  < -- final answer

And that is the final answer. Did you get it right? Let's hope so because this is the best I can explain it. This also wraps up arithmetic with matrices. If you thought this was hard then you are going to hate what we are going to do near the end: inverses and determinants. But to get you ready for the rest of this stuff I made a little review for you. I made three Flash movies which will give you some more practice with the arithmetic. Go here to practice your matrix addition. Go here to practice matrix subtraction. And finally, go here to practice matrix multiplication. Those file will create matrices with random dimensions and random elements. Try to solve a few. If you cannot get it there is a button to solve the problem. It's is wierd. I had a really hard time making those. The multiplication file was one of the, if not the, hardest things I have ever done.

Next, we are going to discuss the identity matrix. If you remember the properties from the beginning of this then you should know that an identity number is one which when added to, or multiplied by another number the other number does not change. The additive identity was zero because no matter what you add zero onto it will not change anything. The mulitplicative identity is one because no matter what you multiply one by it will not change anything. Well, there are such things for matrices too.

The additive identity is merely a matrix with all its elements zero. It can have any dimensions. I doubt you need an example but here is one anyway:

            |  0   0   0  ... |
      [I] = |  0   0   0  ... |
            |  0   0   0  ... |
            | ... ... ... ... |

Now remember that the whole foundation of an additive identity is based solely on the fact that this will always hold true:

      [A] = any arbitrary matrix
      [I] = additive identity matrix (with same dimensions as [A])


      [A] + [I] = [A]  and  [I] + [A] = [A]

That should be easy enough to remember. The multiplicative identity is a little harder to come up with. The multiplicative identity matrix has square dimension. It will always have dimensions of n by n. All of the the identity's elements are zero except for the main diagonal of elements going from top left to bottom right...those elements are one. It looks like this:

            |  1   0   0   0  ... |
            |  0   1   0   0  ... |
      [I] = |  0   0   1   0  ... |
            |  0   0   0   1  ... |
            | ... ... ... ... ... |

Whenever you multiply the above matrix with any other matrix the other matrix will not change. Once again this will always hold true:

      [A] = any arbitrary matrix
      [I] = additive identity matrix (with same number of rows as [A]'s column)


      [A] * [I] = [A]  but not necessarily this,  [I] * [A] = [A]

Remember that the two matrices still have to follow the rules of multiplication for them to have a product.

Well, now I am kind of torn between what I should go to next. I was going to skip directly to determinants, but now I am thinking there are a few more things to do first. So to clear any confusion that you might have later on we are going to learn about operations within a matrix, which are called elementary row operations. There are three of them and they are used to row reduce a matrix (a term we will get into later). And finally, row reduction are going to help us with finding inverses. They are also used in many other places.

The three elementary row operations are as follow:

      1.) Switching around two rows
      2.) Multiplying a row by a constant
      3.) Adding a row times a constant to a different row

Please do not get confused with this stuff because it should be really easy. When I first heard this part right here I was entirely confused (partly because of a not so great teacher). Just think of it as adding/subtracting/dividing/multiplying numbers except within a matrix. But, don't add your own operations...only the ones above. An example of the above row operations would probably help:

      1.) Switching around two rows

              | 4  6  9 |
              | 1  9  7 | = original matrix
              | 4  1  2 |

              Switch rows two and three

              | 4  6  9 |
              | 4  1  2 | = matrix with rows switched
              | 1  9  7 |

      2.) Multiplying a row by a constant

              | 2  3  5 |
              | 3  3  6 | = original matrix
              | 2  7  4 |

              Multiply the first row by 3

              | 12  18  15 |
              |  3   3   6 | = new matrix
              |  2   7   4 |

      3.) Adding a row times a constant to a different row

              | 5  1  7 |
              | 2  1  2 | = original matrix
              | 8  2  4 |

              Summary: we are going to multiply row three by 4 and then
                       add the entire row to row one without changing
                       the original row three.
              First step: find out what row three times 4 equals

              | 32  8  16 | = row three times four

              Second step: add the above row to row one of the first matrix

              | 37  9  23 |
              |  2  1   2 | = matrix after the row operation
              |  8  2   4 |

              Note: the third row does not change even though
                    you multiply it by a constant...only the first.

See how simple those can be? We are now going to use this seemingly useless technique to row reduce a matrix. When you are row reducing a matrix you are wanting to change a matrix so that its first m by m elements form the identity matrix. Once you have it in that form the matrix is said to be in reduced row-echelon form (well not *always* but we will never get into anything were it is not). There are specific steps you have to take to row reduce a matrix. I will outline them here:

      1.) Use row operations (above) to get a one in element "11"

      2.) Fill all of the first column with zeros except for the first row
          by adding the first row times a constant to each other row (#3 above).

      3.) Use row operations (still above) to get a one in element "22"

      4.) Fill all of the second column with zeros except for the second row
          by adding the second row times a constant to each other row (#3 above).

      5.) As you can see its just regurgitation.  Just do the above over and
          over until you get the first m by m elements in the matrix to equal
          the identity matrix.

Most likely the above does not mean much to you unless you see an example. The following is just some matrix I found on a website. It is going to get quite long so pay close attention. I had actually, at first, made up my own matrix to row reduce but at the end the fractions were so crazy that I decided not use it and I just took a sample problem from a site. I tried to comment my steps thoroughly:

      Row reduce the following matrix:
                 |  4   4   3   2  0  -2 |
          [M] =  |  2   3   0  13  1  18 |
                 | -2  -2  -1  -3  0  -2 |

        - I picked a kind of hard one.  If you understand this then you should
          have no problem with any of this.  The first thing you want to do is
          get a one for M11.  To do this we are going to use the row operation #2
          and multiply row one by 1/4:

               Row1 * 1/4

                |  1   1  3/4  1/2  0  -1/2 |
              = |  2   3   0    13  1   18  |
                | -2  -2  -1    -3  0   -2  |

        - Note how I kept everything in fractional form.  Fractions are far
          easier to work with than decimals.  If you are not used to working
          with them then do so quickly.

        - Next thing we want to do is try to get a zero for M21 and M31.  Lets
          start with M21.  To do this we are going to use row operation #3 by
          adding the first row multiplied by a constant to the second row.  But,
          what constant?  It needs to be something so that when M11 is
          multiplied by it it will equal the negative of M21.  In this case the
          constant is going to be -2.  Note that row one is not going to change
          in this step.  Here is the matrix after what I described above:

               Row2 + (-2 * Row1)

                |  1   1   3/4  1/2  0  -1/2 |
              = |  0   1  -3/2   12  1    19 |
                | -2  -2   -1    -3  0    -2 |

        - That part can be hard to take in at once.  The best thing to do is
          try what I describe yourself and then check your work with mine.

        - Now we need to get M31 to have a zero too.  To do this we will use the
          same method as in the previous step except this time, the constant
          which row one will be multiplied by is going to be 2.  Here is the
          matrix after that:

               Row3 + (2 * Row1)

                |  1   1   3/4  1/2  0  -1/2 |
              = |  0   1  -3/2   12  1    19 |
                |  0   0   1/2   -2  0    -3 |

        - We are done with the first part!  We got the first column to resemble
          the identity matrix. Next, we need to get the second column to do the
          same.  We are going to start off by getting a one for element M22.
          But, hey!  There already is a one!  Yes there is.  Happy birthday, you
          can just skip that step.

        - But still not finished.  We need to get all zeros in the second column
          except for element M22.  And yes, element M32 already has a zero
          we do not even need to mess with it.  M12 still has a non zero number
          so to make it a zero we are going to do row operation #3.  Last time
          we added the first row times a constant to the other rows.  This time
          we are going to add the second row times a constant to the other rows.
          If you look at the numbers you will see that the constant should be
          a negative one.  Another way to look at is to simply subtract row two
          from row one:

               Row1 + (-1 * Row2)  or  Row1 - Row2

                |  1   0   9/4  -23/2  -1  -39/2 |
              = |  0   1  -3/2    12    1    19  |
                |  0   0   1/2    -2    0    -3  |

        - Now the first and second columns resemble the identity matrix.  We are
          almost done.  Only the third column left to deal with.  But, let's
          still take it one step at a time.  First we need a one in element
          M33.  To do this we are going use row operation #2 and multiply
          the third row by 2:

               Row3 * 2

                |  1   0   9/4  -23/2  -1  -39/2 |
              = |  0   1  -3/2    12    1    19  |
                |  0   0    1     -4    0    -6  |

        - Next we are wanting to get the entire third column full of zeros
          except for element M33.  We are going to use row operation #3 once
          again.  Let's just deal with getting M13 to equal zero for now.  This
          time we are going to add row three times a constant to row one.  The
          constant will be -9/4:

               Row1 + (-9/4 * Row3)

                |  1   0    0   -5/2  -1  -6 |
              = |  0   1  -3/2   12    1  19 |
                |  0   0    1    -4    0  -6 |

        - The best thing for you to do is to work it out yourself now that I
          think about it.  This is not easy stuff.  The arithmetic is elementary
          but putting everything together is a little harder.

        - Well, this is our last step.  All we need to do is get a zero for
          element M32.  To do this we are going to use row operation #3.  The
          constant this time will be 3/2:

               Row2 + (3/2 * Row3)

                |  1   0   0  -5/2  -1  -6 |
              = |  0   1   0    6    1  10 |
                |  0   0   1   -4    0  -6 |

Be proud of yourself if you made it through that! The last matrix is in reduced row echelon form. Also don't get that part confused: the method we just used is called row reducing and the form of the matrix after row reduction is called reduced row echelon form.

A little side note to those who hate being given information without knowing how/why it is the way it is...those elementary row operations may have confused you a little as to why you can do them. And here is the deal with that. Matrices can be used to solve a system of equations. Pretty much everyone knows how to solve an equation as long as there is only one variable in it. However, in a system of equations you have multiple equations and variables. Systems of equations are usually taught in an Algebra I class long before matrices. I was kind of hoping to get through this without having to mention it, but I shouldn't hold information back. Anyway, tying back to elementary row operations, those same operations are used in systems of equations and hold the very important property that they change nothing in the equations. Perhaps I will write something on systems of equations after this.

Before we move on there is still something I want to point out about the row reducing. I was only able to give one example because of how long the work is so I will just tell you a few things about what you would have seen if I had given you more examples. The first thing which is very obvious is that the row reduced matrix has the same dimensions as the original matrix. Also you can only row reduce matrices that have more columns than rows. If your matrix had the dimensions of m by n then n >= m. If the matrix is square (meaning with the dimensions of n by n) then the row reduced matrix is always the mulitplicative identity matrix. And last, the dimensions of the identity part of the row reduced matrix is the number of rows of the original matrix by the number of rows. So if your matrix was m by n the identity part in the row reduced matrix would be m by m.

Next thing you should know about, which is even relevant in gaming (in particular viewpoint rotations in 3d...something I did not discuss in my tutorials), is how to transpose a matrix. Transposing a matrix only means to turn an m x n matrix into a n x m matrix. However you cannot just change the dimensions of a matrix and put the elements where ever you want to. Here is the easiest type of matrix to transpose, a row matrix (a column matrix would be equally as easy):

      [A] = original matrix   [A]T = transposed matrix // the transposed matrix
                                               is denoted with a superscript "T"


      [A] = | 3  5  7  2  1 |      | 3 |
                                   | 5 |
                            [A]T = | 7 |
                                   | 2 |
                                   | 1 |

So, something which can be quickly observed is that when transposing a row or column matrix you simply "flip" the matrix upright or sideways. A higher order matrix is almost the exact same thing. The best way to approach transposing a higher order matrix is to: 1.) draw out the brackets for the new matrix 2.) look at the first column of the original matrix, flip it ninety degrees counterclockwise 3.) put that in for the first row of your new matrix 4.) do again and again until finished. An example always helps:

      Transpose the following matrix:

                 | 6  4  8  1  4  2 |
           [A] = | 9  1  4  3  8  5 |
                 | 3  6  1  3  6  1 |


         - First look at the dimensions of the matrix.  It is a 3 x 6 matrix, so
           that means that the transposed matrix will by 6 x 3.


         - Next, we are going to go through all the steps I discussed above.
           Except I am going to put it all in one step because I don't want
           to waste any more space:


                  | 6  9  3 |
                  | 4  1  6 |
                  | 8  4  1 |
           [A]T = | 1  3  3 |
                  | 4  8  6 |
                  | 2  5  1 |

Nothing difficult. But so far we have only dealt with matrices which had a number of rows that were different from the number of columns. If a matrix has the dimensions of n by n (a square matrix) then you simply reflect the elements across the main diagonal (from top-left element to bottom-right element). An example of a 3 x 3 matrix:

                 | 3  6  1 |
           [A] = | 9  1  4 |
                 | 7  2  4 |

                  | 3  9  7 |
           [A]T = | 6  1  2 |
                  | 1  4  4 |

As you can see the main diagonal did not change. All the other elements were only reflected across that diagonal.

Now we are at determinants. If anything determinants will help you see the relevance of matrices. Hitherto I discussed a few uses for matrices but determinants really tops everything off. First: what is a determinant? A determinant is only a number that can be found from the matrices elements. Even simpler, its like assigning a number to represent a matrix. However it would be rather hard (even impossible) to work backwards and find a matrix given a determinant. For right now determinants are going to have only one use: to check whether a matrix is invertible or not. Before you even start to find the determinant there is one thing you should look for first: is the matrix an n x n matrix? Determinants only exist in square matrices.

The simplest case of finding a determinant would be for a 1x1 matrix where the element is actually the determinant. I'm going to give an example, not because it's hard but so that you can become familiar with the notation we are going to be using:

      [A] = | 3 |
      det [A] = |A| = 3
         -- read as the determinant of [A]
         -- note that you have two notations.  If you were doing work on a piece
            of paper you would use straight lines to denote the determinant of a
matrix as opposed to brackets for a regular matrix. But, so that you will not get confused I'm going to use "det [A]" when typing this.

I'll discuss how to find the determinant of higher order matrices in a second, but I should probably explain this more. If a matrix has a determinant of zero then it is not capable of being inverted. This can be easily proven using the simplified case I gave above of a 1x1 matrix. The inverse of the above matrix would simply be its only element's reciprocal, so in this case it would be 1/3. If the element was zero you would have 1/0 and you cannot divide by zero.

I guess I could throw in some terminology while I am at it. If a matrix has a determinant of one then it is said to be isotropic. All matrices that are not isotropic are anisotropic. The multiplicative identity matrix has a determinant of one therefore it is isotropic.

Now, although a 1x1 matrix is the most simplified case for finding a determinant it does not really provide any insight into the method of finding a determinant. To get a feel for determinants lets look at a 2x2 matrix:

      [A] = | A  B |
            | C  D |


      det [A] = A*D - B*C

That was a generalized example that way you can see whats going on better. Now something I have been big on in all of my tutorials was that it is far better knowing how to come up with a formula than just memorizing it; thats probably the reason my tutorials get as long as they do. However, this time I am not going to explain how this equation came about. Mainly, because with the approach that we are taking I am not sure there is a derivation. I've explained everything how it would be taught in an Algebra class. The derivation of the determinant (as I know it) comes from a geometric perspective. Perhaps one day I will write how to derive the determinant in a geometric sense for those who *must* know but for now I am going to keep Algebra and Geometry separate (even though that, in a sense, is bad since everything goes together in the end anyway).

Anyway, back to the main subject here. So, the determinant for a 2x2 matrix can be found by taking the difference of the products of the elements in the diagonals. Everything so far has been pretty straightforward, but I will go ahead and give an example:

      [A] = |  3  5 |
            | -1  7 |


      det [A] = 3*7 - 5*(-1) = 21 - (-5) = 26

So from the determinant we can tell that [A] is: 1.) invertible 2.) anisotropic.

The next order of matrices would be 3x3 matrices. This will be the type of matrix which will provide the most insight into finding determinants of any order matrix. First of all, when looking at a 3x3 matrix you will see that you cannot use the same method as last time. You would actually be leaving out four elements. To find the determinant first copy down the matrix:

            | a11  a12  a13 |
      [A] = | a21  a22  a23 |
            | a31  a32  a33 |


           -- next copy the first two columns of the matrix to the right
              of the original matrix.


            | a11  a12  a13 | a11  a12
      [A] = | a21  a22  a23 | a21  a22
            | a31  a32  a33 | a31  a32


           -- Now you are going to add up the products of all the diagonals
              (starting at a11) going from left to right and subtract the
              products of the diagonals (starting at a13) going from right
              to left:


            | a11  a12  a13 | a11  a12
      [A] = | a21  a22  a23 | a21  a22
            | a31  a32  a33 | a31  a32


           det [A] = [(a11*a22*a33) + (a12*a23*a31) + (a13*a21*a32)] -
                     [(a13*a22*a31) + (a11*a23*a32) + (a12*a21*a33)]

And that is pretty straight forward. Here are some general steps to finding the determinant of a m x m matrix:

      1.)  Copy the first (m - 1) columns to the right of the original matrix

      2.)  Add up the products of the diagonals going from left to right.  Note:
           the diagonals should have a total of three elements.

      3.)  Add up the products of the diagonals going from right to left.  Once
           again the diagonals should have three elements.

      4.)  Subtract the sum of the second diagonals from the sum of the first.

You should now know how to find the determinant of any m by m matrix. We are nearing the end of the tutorial now. All that's left are inverses.

For a matrix to have an inverse two things need to happen: 1.) it has to have a non-zero determinant 2.) it has to be a square matrix m by m. Let's say you had a matrix [A]. Its inverse would be denoted with a power of negative one: [A]-1. The inverse of a matrix is another matrix (of the same dimensions) so that when you multiply it by the original matrix the identity matrix results. Like this: [A] * [A]-1 = [I].

There are many different ways of doing this. You could use the determinant and Kramer's rule. But, I haven't provided enough information (and this tutorial is too long for anything more) so I will show you how to do it with row reduction. To do this with row reduction you extend your m x m matrix by m columns and fill the new elements with the identity matrix. Something like this:

            | A  B  C |
      [A] = | D  E  F |
            | G  H  I |


         // extended matrix:


            | A  B  C  1  0  0 |
      [A] = | D  E  F  0  1  0 |
            | G  H  I  0  0  1 |

Next you are going to row reduce the matrix into reduced row echelon form:

            | 1  0  0  A'  B'  C' |
      [A] = | 0  1  0  D'  E'  F' |
            | 0  0  1  G'  H'  I' |


         // Note that A', B', C', ... are different numbers from A, B, C, ...
            It would be hard to show a generalized version of what those numbers
            are so I just denoted the change with a single quotation.

Once you have the matrix row reduced you drop the first m columns and that is your inverse matrix. I believe a sample problem is in order here:

      Find the inverse of the following matrix:

               |  2  3 |
         [A] = | -4  8 |


         -- The first thing to do is to write down the new matrix when the
            identity elements are added in.

               |  2  3  1  0 |
             = | -4  8  0  1 |


         -- Now we start row reducing.  The first thing you want to do is get a
            one for A11.  To do this we are going to multiply the first row by
            one-half:


               |  1  3/2 1/2  0 |
             = | -4   8   0   1 |


         -- Next we want to get a zero for A21.  This is done by adding the first
            row times a constant to the second row.  The constant in this case
            is going to be four:


               | 1  3/2  1/2  0 |
             = | 0   2    -3  1 |


         -- We now want to get a one for element A22.  To do this we are going
            to multiply the second row by a constant.  And the constant will be
            one-half again:


               | 1  3/2  1/2   0  |
             = | 0   1  -3/2  1/2 |


         -- And finally we need to get a zero for element A12.  This will be done
            by adding the second row times a constant to the first row.  The
            constant this time will be -3/2:


               | 1  0  11/4  -3/4 |
             = | 0  1  -3/2   1/2 |


         -- You can now take away the identity part of the matrix and you have
            your inverse:


                 | 11/4  -3/4 |
         [A]-1 = | -3/2   1/2 |

And that's all there is to inverses. Hopefully it does not seem so hard. Inverses also concludes this tutorial. After writing this I *really* want to write another from a geometric point of view so you can see how useful matrices and determinants are. Hopefully I will. As of right now I have a tutorial on two dimensional collision physics almost entirely done and then after that I have planned on writing about kinematics and mechanics. But we'll see.

Thanks for reading.

- Brandon Williams.