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.

### Course: Precalculus>Unit 7

Lesson 8: Using matrices to transform the plane

# Using matrices to transform the plane: Composing matrices

2X2 matrices can define transformations for the entire plane. In this worked example, we see how to find a single matrix that defines the same transformation as the composition of two other matrices. Created by Sal Khan.

## Want to join the conversation?

• Again, please rethink this section - this is a weird linear algebra lesson, stuck in precalculus before we even introduced any matrix operation properly or understanding.

I can appreciate this, but you've probably lost a lot of people here.
• I think it's fine
• At Sal stops the video to think about how Matrices work as compositions. Generally for some rudimentary functions f(x) = x+5 and g(x) = x-3, (f o g)(x) would implement g(x) into f(x) like (f o g)(x) = (x-3)+5. However, at when Sal composes B o A, he multiplies the columns of the B matrix by individual A entries, which appears backwards as B is being implemented into A, indicative of the composition A o B. I was wondering if somebody could explain the reasoning behind that choice and why it apparently flips or why my logic is flawed?
• Function composition is written right-to-left, so the composition of B, then A is written as the matrix AB. In your example, f◦g(x) first applies g to x, then applies f to the result. We define matrix multiplication so as to match this convention.
• When I multiply these two matrices, it is giving me different values from when I compose a matrix from the two matrices. This makes me conclude matrix multiplication is different from matrix composition is that right?

Edit: Matrix multiplication is the same thing as matrix composition. The key to understanding this is paying closer attention to the commutative property that does not exist in matrix multiplication. Matrix multiplication is read from the right to the left and the reason that I was getting results was because I was multiplying from left to right.

Hope this helps someone who faced the same issue as me.
• matrix multiplication and matrix composition are two different operations on matrices that can produce different results.

Matrix multiplication involves multiplying corresponding elements of two matrices and adding the results. It is denoted by *. The number of columns in the first matrix must equal the number of rows in the second matrix for multiplication to be defined.

Matrix composition is the operation of applying one matrix transformation followed by another. It is denoted by ∘. The composition of matrices A and B, written A ∘ B, has the effect of first applying B and then applying A. So if v is a column vector, (A ∘ B)v = A(Bv).

For example, let:

A = [[1, 2],
[3, 4]]

B = [[5, 6],
[7, 8]]

Then:

A * B = [[19, 22],
[43, 50]]

A ∘ B = [[43, 46],
[95, 106]]

As you can see, while matrix multiplication produces a matrix of the product sums, matrix composition produces a matrix by applying the transformations in succession. The results are quite different!

So in summary, the main differences between the two operations are:

Matrix Multiplication:

Denoted by *
Defined only if the number of columns of the first matrix equals the number of rows of the second matrix.
Calculates the product sums of corresponding elements.
Matrix Composition:

Denoted by ∘
Applies the matrix transformations in succession.
Defined for all matrices of appropriate sizes.
Gives a different result than matrix multiplication.
(1 vote)
• How matrix multiplication is different from the transformation composition in this context? Can we just say that if you want to apply transformation of matrix A first and matrix B second, you can just multiply BA matrix by your vector? And if so, why not using multiplication notation here? It sounds much more intuitive to me
• Hi, The Dreams Wind
To me, this video is kind of an introduction to matrix multiplication, which is taught (at least in the precalculus course) a few lessons later. I think the purpose of this lesson is for us to understand matrix multiplication before we even get to it, so that when we do learn it we're like, "Oh, I already knew this; I just didn't know I did. Matrix multiplication doesn't seem so daunting after all!"
I don't know... that's my idea, heh.
Good luck!
• Am I the only one who is having a hard time seeing how this is a composition? It seems like the first and the second step are totally different? We don't even do anything with the first matrix. 🧐🤔
• yes
It seems like just matrix multiplication
• just treat this 2x2 matrix as 2 of the 2x1 matrix (which means two separate vectors).

[0;5] [2;-1] (';' means newline) is basically:
[0;5]= 0*[1;0] + 1*[0;1]
[2;-1] = 2*[1;0] + -1*[0;1]

Applying transformation [-3,0 ; 1,4] only means :
[0;5]'= 0*[-3;1] + 1*[0;4]
[2;-1]'= 2*[-3;1] + -1*[0;4]
• That's correct! The transformation matrix [−3 0; 1 4] can be applied to each of the vectors [0 5] and [2 −1] separately by multiplying each vector by the transformation matrix.

So, we have:

``[0;5]' = [−3 0; 1 4] [0;5] = 0*[-3;1] + 1*[0;4] = [0;4]``

and

``[2;-1]' = [−3 0; 1 4] [2;-1] = 2*[-3;1] + (-1)*[0;4] = [-6;-2]``

Therefore, the transformation matrix maps the vector [0 5] to [0 4] and the vector [2 −1] to [−6 −2].
• This is not a question. I was watching the video and paused it to think about it, like Sal said :)) This is what I came up with:
[0 , 5a] + [2b , -b] = [2b , 5a-b]
If : [2b , 5a-b] = [x , y] then I have:
2b* [1 , 0] + (5a-b)*[0 , 1]
And if the transformation matrix B is applied to this point, I'll have:
2b*[-3 , 1] + (5a-b)*[0 , 4] = [-6b , 2b]+[0 , 20a-4b] = [-6b , 20a-2b]
So for any point [a , b] I can find the image under these two transformation put together as one formula!
• Sal said, for B of A, that you would apply the function A first then input it into B, but in the example, he inputted matrix B into A. Why is that?