Study Guide

Matrices - Matrix Operations

Advertisement - Guide continues below

Matrix Operations

What are we going to do with these matrices now that we've made them our faithful servants? Use them to solve equations, that's what. We'll add 'em, we'll subtract 'em, and we'll stare at 'em. Why don't you just take a picture? It'll last longer.

  • Basics

    As always, there you are with two equations staring you dead in the face.

    For example:

    x + 4y = 6


    2x – 3y = 9

    Remember that variables are the letters, and coefficients are just the numbers in front of the variables. Since you foolishly swallowed the red pill, you need to go ahead and plug them into some matrices (plural for matrix). As usual, there are actually practical reasons to do that too, reasons that pop up in real life. More on that later.

    Now, imagine playing a game of Connect Four. In Connect Four, we take a disk-shaped game piece and drop it into the vertical game board. Then the game pieces stack up on top of one another. Building a matrix is similar: we stack the equations on top of each other within the matrix brackets.

    If we were to take the above equations and place them into a couple matrices, they'd look like this:

    That's all a matrix really is—a grid of numbers and/or variables. Because matrices are so stylish, they wear brackets. Each number or variable inside the brackets is called an entry.

    The rows of a matrix are the horizontal number groups. Take a gander at this matrix:

    In this example, row one = 2, -4, -1 and row two = 3, 3, -5.

    The columns of a matrix are the vertical number groups, so in this matrix the columns are: column one = 2, 3, column two = -4, 3, and column three = -1, -5.

    Sometimes we have to identify entries in matrices in ways that designate where they are. Take this example again:

    This is a 2 × 3 matrix, since we always put the number of rows first. This is also how we name the coordinates of each entry in the matrix. Any given entry (let's call an entry e for now) has a location inside the matrix. Since every entry has a row location (r) and column location (c), each entry is noted like this:


    That means 2 is entry e11, -4 is entry e12, -1 is entry e13, the first 3 is entry e21, the second 3 is entry e22, and -5 is entry e23.

    A square matrix has the same number of rows and columns. (They don't get invited to many parties.) Here's an example:

    Here's another:

    Here's one more, since we're feeling generous (any size goes, except for one lone digit in brackets):

    A zero matrix can have any shape or size. It's just a matrix full o' zeros. (And you thought the squares were the life of the party.)

    Here's an example:

    This one is a square zero matrix:

    Zero matrices may seem kinda goofy and pointless, but they're necessary to do arithmetic with matrices, namely addition and subtraction. Trust us, they're not as useless as they seem. Speaking of strangely useful matrices, identity matrices are up next. We need these in order to multiply matrices, divide matrices, and to find the meaning of life. Don't worry; this is simple, too. Well, two of the three things are simple…the meaning of life might take some time to figure out.

    An identity matrix is like a zero matrix, but with 1s added in. Identity matrices also have extra rules. A matrix has to do these three things to qualify as an identity matrix: (1) it must be square, (2) the diagonal line from the upper left to the lower right must have all entries equal to 1, and (3) the rest of the entries must be 0. Check it:

    In multiplication, identity matrices have the same effect on matrices that the number 1 has on numbers. After multiplying by the identity, the resulting matrix (or number) just stays the same, just like any number times 1 equals itself (9 × 1 = 9, etc.).

  • Beginning Operations

    First, we'll learn how to make a coefficient matrix. We'll start with the following examples:

    x + 4y = 6
    2x – 3y = 9

    This is all fine and dandy; we know all about coefficients. The first equation has a coefficient of 4, while the second equations has a 2 and a -3. But what's the coefficient in front of the first x? That's right; it's a 1. Therefore, our equations are equivalent to:

    1x + 4y = 6
    2x – 3y = 9

    To create the coefficient matrix, we make a matrix like this:

    With a coefficient matrix, the coefficients are the entries. And don't forget, the rows of a matrix are the horizontal number groups, and the columns are the vertical groups (like columns that hold up a ceiling). 

    Now we get to find us some determinants.

    The determinant is a special value that we can pull out of a square matrix. Determinants only associate with square matrices (insecurity, no doubt), so you can't find the determinant of a matrix that's not a square.

    To find the determinant from our coefficient matrix above, you go like this:


    (1)(-3) – (2)(4) = -5

    Why? Because you multiply down the first diagonal:

    And up the other one:

    And put a minus between them. That's it. Crisscross minus applesauce.

    We also ditch the brackets and use vertical lines instead when we're talking about determinants. So the determinant of matrix X is written as |X|.

    Looking for a formula, you math lovers? Okay.

    = ps – rq

    Important Shmoop Note: the whole crisscross-minus-applesauce thing only works with 2 × 2 matrices. Finding the determinant gets more complicated when we're dealing with 3 × 3 matrices and bigger, but we'll get into that a little later.

    Craving more fun with determinants? Check out Cramer's Rule next.

  • Cramer's Rule

    Cramer's Rule
    has nothing to do with Seinfeld, guitars, or horrible movie divorces. It has everything to do with solving systems of equations using our uptight friends, determinants. That's how Cramer rolls.

    Here are two random, innocent equations, ready to be solved by us:

    3xy = 5
    -2x + 4y = 7

    We want to learn the values of x and y, and we're tired of using our old-school substitution and elimination methods. Good news: there's a quick way to knock this out using matrices.

    First, we're gonna find the determinant of the coefficient matrix:

    D = (3)(4) – (-2)(-1) = 10

    Next, we'll find the D of the x set, Dₓ. You take D as you know it and go from there:

    Delete those x-values out of there:

    Replace 'em with the constant values from the ends of both equations, and you've got Dx:

    Dx = (5)(4) – (7)(-1) = 27

    Finally, you can find x. That's because:

    At last, our purpose becomes clear, right? Just like Hannibal, we love it when a plan comes together. Now, to find y, same bat procedure, same bat equations:

    This time you delete the y-values out and—you guessed it—substitute in the constant values to get y.

    And of course you know how to find y:

    Now we know that:

    There's only one leetle thing to remember. Remember how you learned that a fraction with a zero as a denominator is a sign of the apocalypse? If we figure out our coefficient determinant, D, is zero, that's the end of the road. We know that zero will be our denominator for both x and y, so there will either be no solutions or infinite solutions to the system of equations. That's because either the two lines represented by your two equations are parallel or the same freakin' line. What a mind-bender.

    Just when we thought we knew all there is to know about determinants, it turns out that those cute little 2 × 2 matrices are just the tip of the iceberg.

  • Cramer's Rule Redux

    Determinants and Cramer's Rule Redux: Because Things Happen in Threes

    Here's the first trick for using Cramer's Rule on 3 × 3 matrices. This does not work for 4 × 4s or larger matrices, and of course we don't need it for 2 × 2s.

    Let's say we have this saucy little 3 × 3 matrix that we'd just love to introduce to our friend Cramer, if only she would bring her friend Determinant along.

    Here's what we do to find the determinant of a 3 × 3 matrix. First, copy the left and center columns to the right of the matrix:

    You remember, of course, that the 2 × 2 Cramer's technique had us multiply diagonally from upper left to lower right, and then subtract from lower left to upper right. This is actually pretty similar. The main thing is to remember not to mix up your columns that you copy again. Now that we have our matrix and the left and center columns from it copied outside the bars, we're ready to calculate the determinant in the same way that we did the 2 × 2.

    We first multiply from the top left corner to the bottom right, and then add. We do that three times—that's why we added the first two columns again:

    D = aei + bfg + cdh

    Then we subtract up from bottom left to upper right again, just like we did before:

    D = aei + bfg + cdhgechfaidb

    And that's it.

    So in a real numbers situation:

    We first copy the first two columns just outside and to the right of the bars:

    And from here on out, it's basically plug 'n' chug:

    D = (4)(1)(4) + (1)(5)(3) + (0)(2)(0) – (3)(1)(0) – (0)(5)(4) – (4)(2)(1)
    = 16 + 15 + 0 – 0 – 0 – 8
    = 23

    Got it.

    Sample Problem

    Now, since we know how to get the determinant for a 3 × 3 matrix, here's how we solve for variables with Cramer's Rule when there are three of them. Here are our three lucky bachelors:

    2x + y – 3z = 8
    -3x + 2y + z = 10
    x – 3y + 2z = 12

    The first step is to find D, the coefficient determinant. We just learned how to do that for a 3 × 3 matrix, so let's go.

    First create the coefficient matrix:

    Whoomp! There it is. Next, find D:

    We remember our little trick, where we copy the first two columns again outside and to the right of the matrix:

    Excellent, Smithers. Now we multiply and add diagonally across from top left to bottom right:

    D = (2)(2)(2) + (1)(1)(1) + (-3)(-3)(-3)…

    We then multiply and subtract diagonally across from bottom left to top right:

    D = (2)(2)(2) + (1)(1)(1) + (-3)(-3)(-3) – (1)(2)(-3) – (-3)(1)(2) – (2)(-3)(1)


    D = 8 + 1 + (-27) – (-6) – (-6) – (-6) = 0

    Ruh roh, Shaggy! When D = 0, there can't be any exact values! (Did you remember?) We thought those equations looked suspicious. Well, how about these?

    Sample Problem

    Solve the following system of equations:

    3xy – 4z = 10
    -2x + 5y + z = 9
    -3x + 4y + 2z = 8

    First we bust out our coefficient matrix:

    You down with finding D? Yeah, you know me:

    We copy the first two columns right outside and to the right of the matrix:

    Then it's time to multiply and add diagonally across from top left to bottom right and then multiply and subtract diagonally across from bottom left to top right:

    D = (3)(5)(2) + (-1)(1)(-3) + (-4)(-2)(4) – (-3)(5)(-4) – (4)(1)(3) – (2)(-2)(-1)

    From there, it's mathematics bliss:

    D = 30 + 3 + 32 – 60 – 12 – 4 = -11

    We know that D = -11, so now we're after those other determinants. We know that these three things are true:

    We know that the way to find Dx is to substitute the constant values into the mix in place of the x-values and then use our column-copying trick to get the numbers. Time for more plug and chug. Remove the x-values:

    Replace them with the constant values:

    Copy the first two columns in our modified matrix just outside and to the right:

    Multiply and add diagonally across from top left to bottom right and then multiply and subtract diagonally across from bottom left to top right:

    Dx = (10)(5)(2) + (-1)(1)(8) + (-4)(9)(4) – (8)(5)(-4) – (4)(1)(10) – (2)(9)(-1)
    = 100 + (-8) + (-144) – (-160) – 40 – (-18)
    = 86

    Onward. We seek Dy.

    There it is, devoid of all y-values. Now we plug in the constant values and roll from there:

    Column trick:

    Plug and chug:

    Dy = (3)(9)(2) + (10)(1)(-3) + (-4)(-2)(8) – (-3)(9)(-4) – (8)(1)(3) – (2)(-2)(10)
    = 54 + (-30) + 64 – 108 – 24 –(-40)
    = -4

    Solve for y, as long as we're kickin it here:

    We are so almost there. Here we go, our little matrix, naked of all z-values:

    Substitute in the constant values:

    Ah, constant values. You complete us. Column trick:

    Plug and chug, baby:

    Dz = (3)(5)(8) + (-1)(9)(-3) + (10)(-2)(4) – (-3)(5)(10) – (4)(9)(3) – (8)(-2)(-1)
    = 120 + 27 + (-80) – (-150) – 108 – 16
    = 93

    Another triumph of the human spirit. At last we solve for our z determinant:


    Like a German opera, these are time-consuming and can feel repetitive, but the payoff feels great. And if you hate opera, or algebra, the payoff is leaving or being done, so that's even better.

This is a premium product

Tired of ads?

Join today and never see them again.

Please Wait...