If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

## Multivariable calculus

### Unit 1: Lesson 2

Vectors and matrices

# Visualizing matrices

​Learn about a useful interpretation of matrices that helps to understand matrix multiplication and determinants.
In the last article we covered matrix fundamentals, but matrices are much more than tables of numbers. That's why in this article we'll discuss a way to think about matrices visually. This perspective makes a lot of what initially seems difficult about matrices become intuitive to understand. We'll only need this perspective for square matrices in multivariable calculus, so we will limit ourselves to those here.

## Matrices as movement

What is the action of a matrix? What does a matrix look like? These questions may seem nonsensical, but we will answer them both by visualizing how 2, times, 2 matrices move the 2D plane.
Here is a drawing of the plane, along with the unit vectors start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c, which stand for start color #11accd, left parenthesis, 1, comma, 0, right parenthesis, end color #11accd and start color #ca337c, left parenthesis, 0, comma, 1, right parenthesis, end color #ca337c.
Let's consider matrix A:
$A = \left[ \begin{array}{cc} \blueD{1} & \maroonD{0} \\ \blueD{1} & \maroonD{1} \end{array} \right]$
This is how the matrix acts upon the grid:
• The columns of the matrix tell us where it moves the unit vectors start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c, which again stand for start color #11accd, left parenthesis, 1, comma, 0, right parenthesis, end color #11accd and start color #ca337c, left parenthesis, 0, comma, 1, right parenthesis, end color #ca337c.
• The rest of the grid follows accordingly, always keeping grid lines parallel and evenly spaced. The origin stays frozen in place.
That means A moves start color #11accd, \imath, with, hat, on top, end color #11accd, \to, start color #11accd, left parenthesis, 1, comma, 1, right parenthesis, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c, \to, start color #ca337c, left parenthesis, 0, comma, 1, right parenthesis, end color #ca337c. Here's what that looks like:
The unit vector start color #ca337c, \jmath, with, hat, on top, end color #ca337c didn't move because it started at start color #ca337c, left parenthesis, 0, comma, 1, right parenthesis, end color #ca337c. The unit vector start color #11accd, \imath, with, hat, on top, end color #11accd moved upward one unit, and this dragged the grid with it. Notice that there's a faint copy of the original lines in the background to help us stay oriented.
Let's see the same process for another matrix.
$B = \left[ \begin{array}{cc} \blueD{0} & \maroonD{-1} \\ \blueD{-2} & \maroonD{1} \end{array} \right]$
We know B moves start color #11accd, \imath, with, hat, on top, end color #11accd, \to, start color #11accd, left parenthesis, 0, comma, minus, 2, right parenthesis, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c, \to, start color #ca337c, left parenthesis, minus, 1, comma, 1, right parenthesis, end color #ca337c. That looks like this:
Here's a question to practice.
Problem 1
Suppose we have a matrix $C = \left[ \begin{array}{cc} \blueD{2} & \maroonD{1} \\ \blueD{-1} & \maroonD{1} \end{array} \right]$.
What does the grid look like after we apply C?

To sum up, the action of a matrix is to move the entire grid. We can understand it by thinking about how it moves the unit vectors. We can visualize what this looks like by drawing a modified 2D grid.
These ideas extend into three dimensions as well. The third row of the matrix contains z-coordinates for all the unit vectors, and the third column of the matrix tells us where start color #1fab54, k, with, hat, on top, end color #1fab54 lands.
If you'd like, play around with matrices as movement with this interactive demonstration. Drag the vectors to make the grid move, and see the matrix that corresponds to the movement in the top left corner.

## How matrices move vectors

We already know how a given matrix moves the unit vectors start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c (just look at the columns), but how can we find where a matrix moves any arbitrary vector? Let's consider a specific example using the first matrix from the previous section.
$A = \left[ \begin{array}{cc} \blueD{1} & \maroonD{0} \\ \blueD{1} & \maroonD{1} \end{array} \right]$
How does A move the non-unit vector start color #e07d10, left parenthesis, 1, comma, 2, right parenthesis, end color #e07d10? Before anything, let's get a feel for this visually. First, the vector with no matrix movement:
Now, the vector after the matrix moves the grid:
The vector just comes along for the ride as the matrix moves the grid, ultimately landing on start color #e07d10, left parenthesis, 1, comma, 3, right parenthesis, end color #e07d10. This is the essence of how matrices move vectors, which is formally called matrix-vector multiplication.
Now let's go over how we could calculate this. We represent start color #e07d10, left parenthesis, 1, comma, 2, right parenthesis, end color #e07d10 as a combination of the unit vectors by saying start color #e07d10, left parenthesis, 1, comma, 2, right parenthesis, end color #e07d10, equals, start color #e07d10, 1, end color #e07d10, start color #11accd, \imath, with, hat, on top, end color #11accd, plus, start color #e07d10, 2, end color #e07d10, start color #ca337c, \jmath, with, hat, on top, end color #ca337c.
This combination remains the same after we apply A, but instead of using start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c, we use the result of applying A to start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c:
Here's what the whole process looks like in symbols.
\begin{aligned} A \left[ \begin{array}{c} \goldD{1} \\ \goldD{2} \end{array} \right] &= A\left( \goldD{1} \left[ \begin{array}{c} \blueD{1} \\ \blueD{0} \end{array} \right] + \goldD{2} \left[ \begin{array}{c} \maroonD{0} \\ \maroonD{1} \end{array} \right] \right) \\ \\ &= A\left( \goldD{1} \blueD{\hat{\imath}} + \goldD{2} \maroonD{\hat{\jmath}} \right) \\ \\ &= \goldD{1} A \blueD{\hat{\imath}} + \goldD{2} A \maroonD{\hat{\jmath}} \\ \\ &= \goldD{1} \left[ \begin{array}{c} \blueD{1} \\ \blueD{1} \end{array} \right] + \goldD{2} \left[ \begin{array}{c} \maroonD{0} \\ \maroonD{1} \end{array} \right] \\ \\ &= \left[ \begin{array}{c} 1 \\ 3 \end{array} \right] \end{aligned}
The critical step is when we break A, left parenthesis, start color #e07d10, 1, end color #e07d10, start color #11accd, \imath, with, hat, on top, end color #11accd, plus, start color #e07d10, 2, end color #e07d10, start color #ca337c, \jmath, with, hat, on top, end color #ca337c, right parenthesis into start color #e07d10, 1, end color #e07d10, A, start color #11accd, \imath, with, hat, on top, end color #11accd, plus, start color #e07d10, 2, end color #e07d10, A, start color #ca337c, \jmath, with, hat, on top, end color #ca337c. That is when we are able to represent where start color #e07d10, left parenthesis, 1, comma, 2, right parenthesis, end color #e07d10 lands in terms of where start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c land.
Let's try a couple practice questions.
Problem 2
Let $B = \left[ \begin{array}{cc} \blueD{0} & \maroonD{2} \\ \blueD{1} & \maroonD{-1} \end{array} \right]$.
Where does B move the vector $\left[ \begin{array}{c} 3 \\ 1 \end{array} \right]$ in terms of where it moves start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c?

Problem 3
Let $B = \left[ \begin{array}{cc} \blueD{0} & \maroonD{2} \\ \blueD{1} & \maroonD{-1} \end{array} \right]$.
Where does B move the vector $\left[ \begin{array}{c} 3 \\ 1 \end{array} \right]$?
$B \left[ \begin{array}{c} 3 \\ 1 \end{array} \right] = ($
comma
right parenthesis

Like in the section above, the idea behind matrices moving vectors extends into three dimensions. We just decompose our vector into a sum of start color #11accd, \imath, with, hat, on top, end color #11accd, start color #ca337c, \jmath, with, hat, on top, end color #ca337c, and start color #1fab54, k, with, hat, on top, end color #1fab54, then we use where the matrix takes all these unit vectors to find where it takes our vector.
Here's another interactive demonstration to play around with matrices moving vectors.
To learn more about matrix-vector multiplication, check out this video. To go deeper, try these videos from linear algebra.

## Matrix multiplication intuition (optional)

With the perspective of matrices as movement, we have the tools to understand what it means to multiply two matrices. The core idea is composition.
\begin{aligned} A &= \left[ \begin{array}{cc} \blueD{1} & \maroonD{1} \\ \blueD{0} & \maroonD{1} \end{array} \right] \\ \\ B &= \left[ \begin{array}{cc} \blueD{0} & \maroonD{-1} \\ \blueD{1} & \maroonD{0} \end{array} \right] \end{aligned}
The product A, B just means apply B, then apply A. When we apply A second, we treat the transformed start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c as regular vectors getting moved by A the way we learned in the previous section.
Created with this demonstration. Play around if you are interested!
To calculate the end result, we follow start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c along the two movements. First, B takes start color #11accd, \imath, with, hat, on top, end color #11accd, \to, start color #11accd, left parenthesis, 0, comma, 1, end color #11accd, right parenthesis and start color #ca337c, \jmath, with, hat, on top, end color #ca337c, \to, start color #ca337c, left parenthesis, minus, 1, comma, 0, right parenthesis, end color #ca337c. Second, we find where A takes these vectors:
\begin{aligned} \left[ \begin{array}{cc} \blueD{1} & \maroonD{1} \\ \blueD{0} & \maroonD{1} \end{array} \right] \left[ \begin{array}{c} \blueD{0} \\ \blueD{1} \end{array} \right] &= \left[ \begin{array}{c} \blueD{1} \\ \blueD{1} \end{array} \right] \\ \\ \left[ \begin{array}{cc} \blueD{1} & \maroonD{1} \\ \blueD{0} & \maroonD{1} \end{array} \right] \left[ \begin{array}{c} \maroonD{-1} \\ \maroonD{0} \end{array} \right] &= \left[ \begin{array}{c} \maroonD{-1} \\ \maroonD{0} \end{array} \right] \end{aligned}
Putting these in a matrix, we have the product. Notice that our calculations are reflected in the visual above.
$\left[ \begin{array}{cc} \blueD{1} & \maroonD{1} \\ \blueD{0} & \maroonD{1} \end{array} \right] \left[ \begin{array}{cc} \blueD{0} & \maroonD{-1} \\ \blueD{1} & \maroonD{0} \end{array} \right] = \left[ \begin{array}{cc} \blueD{1} & \maroonD{-1} \\ \blueD{1} & \maroonD{0} \end{array} \right]$
To conclude, we can think of matrix multiplication as composing the movements each matrix represents. When we follow unit vectors along these movements, we can calculate the product.
As a challenge problem, try to derive the general formula for 2, times, 2 matrix multiplication. Hint: follow start color #11accd, \imath, with, hat, on top, end color #11accd and start color #ca337c, \jmath, with, hat, on top, end color #ca337c as B moves them, then follow where A moves the already transformed vectors.
As a bonus challenge problem, try to find the formula for multiplying 3, times, 3 matrices. Hint: follow start color #11accd, \imath, with, hat, on top, end color #11accd, start color #ca337c, \jmath, with, hat, on top, end color #ca337c, and start color #1fab54, k, with, hat, on top, end color #1fab54.
To learn more about matrix multiplication, check out this video. For practice, try this exercise.

## What's next

Now that we have a solid grasp of how matrices move space, we are in a prime position to understand the final concept that we'll cover in this review series: the determinant.

## Want to join the conversation?

• does the explanation for a general formula of 2x2 matrix multiplication skip steps of exzplanation?

for example,

"first we follow i-hat."
---> [1,0], sure

"the rightmost matrix moves it to (e,g)"
---> i agree that [e,g] moves [1,0] to [e,g]

"when the left matrix moves (e,g), we can think of it as moving the combination of e[1,0] + g[0,1]
---> why can we think of it like that? where did [0,1] come from? why does it look like j-hat is now in the picture when we agreed to only follow i-hat?