Main content

## Algebra (all content)

### Unit 20: Lesson 9

Properties of matrix multiplication- Defined matrix operations
- Matrix multiplication dimensions
- Intro to identity matrix
- Intro to identity matrices
- Dimensions of identity matrix
- Is matrix multiplication commutative?
- Associative property of matrix multiplication
- Zero matrix & matrix multiplication
- Properties of matrix multiplication
- Using properties of matrix operations
- Using identity & zero matrices

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Is matrix multiplication commutative?

Sal checks whether the commutative property applies for matrix multiplication. In other words, he checks whether for any two matrices A and B, A*B=B*A (the answer is NO, by the way). Created by Sal Khan.

## Want to join the conversation?

- In the 2x2 example, the products were different, but they have the same determinant. Is there any significance to this? Is it because one of the matrices is diagonal?(30 votes)
- good observation!

This is true en general; even though AB =/=BA we have the result:

Det(AB)=DetA · DetB

which is clearly symmetric. but note that A and B must be nxn and have Det =/= 0(25 votes)

- How would one go about reversing the A x B = C to find B given A and C?(3 votes)
- You can take the inverse of A and multiply C by that matrix:

A^(-1) x A x B = A^(-1) x C

I x B = A^(-1) x C

B = A^(-1) x C(14 votes)

- Are their other kinds of multiplication that are non-commuintive or is it just for matrices?(5 votes)
- Yes! Matrices are members of non commutative ring theory. Non commutative ring theory deals specifically with rings that are non-commutative with respect to multiplication. (For now lets just call a ring some algebraic structure - but I encourage you to do your own research!) These types of groups are not that well understood as are commutative rings. Examples would be Hamilton's quaternions, which are an extension of the complex numbers, and any algebraic group that is not abelian.

I encourage you to look up the following mathematical terms:

group, ring, abelian, quaternion, commutative and non-commutative (in the general sense)

to see how they are related.

Keep Studying!(10 votes)

- How would matrix multiplication apply to real life scenarios?(6 votes)
- This is mainly used in computer graphics and is mentioned in this video https://www.khanacademy.org/math/algebra2/algebra-matrices/Basic_matrix_operations/v/introduction-to-the-matrix and this practice

https://www.khanacademy.org/math/algebra2/algebra-matrices/Basic_matrix_operations/e/representing-relationships-with-matrices(5 votes)

- Are there any special cases where matrix multiplication is commutative? Or does it not stand true for every matrix multiplication?(4 votes)
- Yes, if the matrices are SQUARE and identical. But that is pretty rare.(6 votes)

- I've had this thought for a while, when you add matrices , couldnt the mathematicians have said that ,for example

M= [2,4,] and A = [2,3,3,]

[ 4,2] [ 3,2,3]

cant you just pretend that the 3rd column is there but just full of zeros so you would get

?`M+A = [4,7,3,]`

[ 7,4,3](4 votes)- No

M is a 2x2 matrix, the 2x3 matrix M' that you came up with is not M at all(3 votes)

- In what types of problems would it be helpful to know if matrix multiplication is commutative?(3 votes)
- Matrix multiplication is NOT commutative. The only sure examples I can think of where it is commutative is multiplying by the identity matrix, in which case B*I = I*B = B, or by the zero matrix, that is, 0*B = B*0 = 0.

There is a special case involving Simultaneous Diagonalization, and when both matrices are diagonal, but that is beyond this course.(5 votes)

- I noticed in the 2x2, that the ones that didn't match up to the -6 and 6 (4 and 9) were 2/3 and 3/2 (reciprocals) of the -6 and 6... Was that just coincidental, or is there any significance to that?(2 votes)
- This occurred only because the one matrix had zeros in it's antidiagonal. If non-zero values had been inserted in the antidiagonal, then the two commutative results would have no discernible correlation.
`┌ ┐`

│ 1 2 │

A = │ │

│ -3 -4 │

└ ┘

┌ ┐

│ -2 1 │

B = │ │

│ 1 -3 │

└ ┘

┌ ┐

│ 0 -5 │

A•B = │ │

│ 2 9 │

└ ┘

┌ ┐

│ -5 -8 │

B•A = │ │

│ 10 14 │

└ ┘

http://en.wikipedia.org/wiki/Main_diagonal(4 votes)

- What's a scalar?(2 votes)
- A number, plain and simple. A number that is a matrix or a vector, just a number, that is a scalar.(2 votes)

- What is the difference between a vector , a matrix and a tensor??(2 votes)

## Video transcript

Voiceover:We know that the multiplication of scalar quantities is commutative. For example, 5 times 7 is
the same thing as 7 times 5, and that's obviously just
a particular example. I could give many, many more. 3 times negative 11 is the same
thing as negative 11 times 3 and the whole point of commutativity ... I could never say it ... is that it doesn't matter what order that I'm multiplying in. This is the same thing
as negative 11 times 3. Or if we wanted to speak in general terms, if I have the scalar a and I
multiply it times the scalar b, that's going to be the same thing as multiplying the scalar
b times the scalar a. Now what I want to do in
this video is think about whether this property of commutativity, whether the commutative property of multiplication of scalars, whether there is a similar property for the multiplication of matrices, whether it's the case that
if I had two matrices, let's say matrix capital
A and matrix capital B, whether it's always the
case that that product, the resulting matrix here is the same as the product of matrix B and matrix A, just swapping the order. I encourage you ... so
is this always true? It might be sometimes true, but in order for us to say
that matrix multiplication is commutative, that it
doesn't matter what order we are multiplying it, we have to figure out is
this always going to be true? I encourage you to pause this video and think about that for a little bit. Let's just think through a few things. First of all, let's just
think about matrices of different dimensions. Let's say I have a matrix here. Let's say that matrix
A is a, I don't know, let's say it is a 5 by 2 matrix, 5 by 2 matrix, and matrix B is a 2 by 3 matrix. The product AB is going
to have what dimensions? If I multiply these two, you're
going to get a third matrix. Let's just call that C for now. You're going to get a third matrix C. What are going to be the dimensions of C? We know, first of all, that
this product is defined under our convention of
matrix multiplication because the number of columns that A has is the same as the number of rows B has, and the resulting rows and column are going to be the rows
of A and the columns of B. So C is going to be a 5 by 3 matrix, a 5 by 3 matrix. Now what about the other way around? What would B times A be? Once again, I encourage
you to pause the video. If you were to take B, let me copy and paste that, and multiply that times A, so I'm really just switching
the order of the multiplication so copy and paste. If we take that product right over there, what is that going to be equal to? What is this? What is this right over
here going to be equal to? The first question is, is matrix
multiplication even defined for these two matrices? When you look at the number
of columns that B has and the number of rows that A has, you see that it actually is not defined, that we have a different
number of columns for B and a different number of rows for A. Here, the product is not defined, is not defined, so this immediately is a pretty big clue that this isn't always going to be true. Here, AB, the product AB is defined, and you'll end up with a 5 by 3 matrix. The product here, BA, isn't even defined. This is already ... We're already seeing that
this is not the case, that order matters when
you are multiplying, when you are multiplying matrices. To make things a little bit more concrete, let's actually look at a matrix. You might be saying, oh,
maybe this doesn't work only when it's not defined, but hey, maybe it works
if we're always to do square matrices or matrices
where both products are always defined in some way, or maybe some other case. Let's look at a case where we're dealing with 2 by 2 matrices and
see whether order matters. Let's say I have the matrix. Let's say I have the matrix
1, 2, negative 3, negative 4, and I want to multiply that by the matrix, by the matrix negative
2, 0, 0, negative 3. What's that product going to be? Once again, I encourage
you to pause the video and think about that. Let's think it through, and
we've done this many times now. This first entry here is going to be, we're essentially going to look
at this row and this column, so it's 1 times negative
2, which is negative 2, plus 2 times 0. This is going to be negative 2. Now, for this entry, for this entry over here, we'll look at this row and this column, 1 times 0, which is 0,
plus 2 times negative 3, which is negative 6. Then for this entry, we
would look at this row and this column. Negative 3 times negative 2 is positive 6 plus negative 4 times 0,
which is just positive 6. We're going to have positive 6. Then finally, for this entry, it's going to be the second
row times the second column. Negative 3 times 0 is 0. Negative 4 times negative
3 is positive 12, so fair enough. Now what if we did it
the other way around? What if we were to multiply
negative 2, 0, 0, negative 3 times 1, 2, negative 3, negative 4? What's this going to be equal to? As always, it's a good
idea to try to pause it and work through it on your own. Let's think about this. Negative 2 times 1 is negative
2, plus 0 times negative 3, so that's going to be negative 2. So far, it's looking pretty good. Then if you have negative
2 times 2 is negative 4, plus 0 times negative 4 is negative 4. We already see that these two things aren't going to be equal,
but let's just finish it, just so that we have a
feeling of completion. This entry right over here is going to be the second row, first column, 0 times 1 plus negative 3
times negative 3 is positive 9. Once again, it doesn't match up. Then finally, 0 times 2 is 0 plus negative 3 times
negative 4 is positive 12. That one actually did match up, but clearly, these two products
are not the same thing. The order with which even those defined, it doesn't matter whether you take the yellow one times the purple one or the purple one times the yellow one. Both of those result in a defined product, but we see it's not the same product. Once again, another case showing that multiplication of
matrices is not commutative.