Let $A$, $B$, and $C$ be vectors. Suppose $A$ is $1 \times 10$, and $B$ is $10 \times 1$ and $C$ is $5 \times 1$. Then if we multiply $(AB)C$, the result is a $5 \times 1$ vector, but if we try to multiply $A(BC)$, the dimensions are not compatible. Doesn't it contradict associativity of matrix multiplication?
-
That is because: "The left multiplication of a matrix $A$ with a scalar $\lambda$ gives another matrix $\lambda A$ of the same size as $A$". – user25004 Aug 08 '13 at 02:24
-
I assume you meant to leave that comment on my answer below. Well, as I said, since a scalar is not the same thing as a $1\times 1$ matrix, your quoted passage is irrelevant to the issue. – Zev Chonoles Aug 08 '13 at 02:27
-
No, sorry I wrote it before I saw your comment to clarify my point for those who do not read answers. – user25004 Aug 08 '13 at 02:29
4 Answers
What makes you think that $(AB)C$ is a well-defined product of matrices?
In general, if $M$ is an $m\times n$ matrix and $N$ is a $p\times q$ matrix, then the product $MN$ is defined if and only if $n=p$; and when the product $MN$ is defined, it is an $m\times q$ matrix.
In the case of $M=AB$ and $N=C$, you have $$m=1,\quad n=1,\quad p=5,\quad q=1$$ so the product $(AB)C$ is not defined, so the fact that $A(BC)$ is also not defined is perfectly okay.
- 129,973
-
Because the $AB$ matrix turns to become a scalar, and scalars can multiply any matrix – user25004 Aug 08 '13 at 02:21
-
9A $1\times 1$ matrix is absolutely not the same thing as a scalar. There are certain ways of going between the two sorts of objects, but nevertheless they are different. – Zev Chonoles Aug 08 '13 at 02:21
-
That is the key source of my confusion. I treated them the same. So the definition of a matrix should cause this difference between $1\times1$ matrices and scalars. I appreciate more explanation on that from anyone here. – user25004 Aug 08 '13 at 02:41
-
@user25004 By definition you can scalar multiply any matrix but the only thing you can left-multiply by a $1\times1$ is a $1\times n$ matrix. There is no more explanation than knowing how the definition of matrix multiplication works, ultimately. – anon Aug 08 '13 at 02:44
-
-
1Why would you say that? The definition of matrix multiplication intimates that a product of an $m\times n$ and an $p\times q$ matrix only makes sense if $n=p$; in your case $n\ne p$ so the product isn't defined; case closed. Think of it this way: if $A:K^n\to K^m$ and $B:K^q\to K^p$ are linear maps (equivalently, $m\times n$ and $p\times q$ matrices respectively), how can $A\circ B$ make sense as a function if the codomain of $B$ and the domain of $A$ are not the same? – anon Aug 08 '13 at 02:58
-
1@user25004 To illustrate the difference between a $1\times1$ matrix and a scalar, consider this. Let $A$ be a square matrix with nonzero determinant. Is it true that $\det(2A)=2\det(A)$? – Chris Culter Aug 08 '13 at 03:33
$ABC$ is not defined in your case. Moreover, think of it this way: we can think of a matrix as a linear transformation. Hence, to every matrix you can associate a function which is a linear transformation. Matrix multiplication therefore becomes composition of functions. If matrix associativity is contradicted, then the associativity of composition of functions is also contradicted and that totally ruins most of the algebraic structures that we know.
- 7,379
No, it doesn't.
Associativity for an function A just means that
1) $\forall$x$\forall$y$\forall$z {A[A(x, y), z)]=A[x, A(y, z)]}, given that both A[A(x, y), z)] and A[x, A(y, z)] satisfy the definitions at hand (neither do this in your example as stated).
Associativity does not say that:
2) If x, y belong to set X, A(x, y) belongs to set X.
In other words, associativity does not imply closure. Associativity does not imply that there exists a corresponding semigroup.
With your example closure has failed, not associativity. In particular, where M indicates matrix multiplication, M(B, C) does not exist. So, M[A, M(B, C)] does not exist also. Also, although M(A, B) does exist, M[M(A, B), C] does not exist. Why? Because there has to exist a middle numeral in common to perform matrix multiplication. In other words, if you wrote Y := (a X b), Z := (c X d), and you wanted to find M(Y, Z), then b=c. If b does not equal c, then M(Y, Z) does not exist. If you wanted to find M(Z, Y), then d=a.
For your example, M(A, B), the middle numeral is 10. So, M(A, B) makes sense. But, then you have a (1 x 1) matrix for M(A, B). So, M[M(A, B), C] makes no sense since you can't first have a (1 x 1) matrix and then compose it with a (5 x 1) matrix in that order. You can compose a (5 x 1) matrix with a (1 x 1) matrix, but that comes as M[C, M(A, B)].
Now, you can compose C and A and get M(C, A). And we do have M[M(C, A), B] as meaningful. And in fact, since all we know comes as the "dimensions" of the matrices, we can check that the "dimensions" for M[C, M(A, B)] and M[M(C, A), B] do indeed match. For the first case we have:
M{(5 x 1), M[(1 x 10), (10 x 1)]}=M{(5 x 1), (1 x 1)}=(5 x 1)
For the second case we have:
M{M[(5 x 1), (1 x 10)], (10 x 1)}=M{(5 x 10), (10 x 1)}=(5 x 1).
So, on the contrary your example ends up confirming that matrix multiplication associates.
It just refutes the notion that matrix multiplication satisfies closure.
- 11,211
-
3It is not clear in what way this is connected to the question, really. – Mariano Suárez-Álvarez Aug 08 '13 at 02:33
-
I think what the answer means is that, associativity only implies that if both sides are defined they should be equal, and nothing more. – user25004 Aug 08 '13 at 02:38
-
@MarianoSuárez-Alvarez I've edited it. I wouldn't feel surprised if you found it worse than before. :) – Doug Spoonwood Aug 08 '13 at 03:03
It appears to me that there is an error in the original matrix definition. I believe your C matrix should be 1x5 and not 5x1. If C was 5x1 as originally stated, neither (AB)C nor A(BC) would be defined due to dimensional incompatibility. If C was instead 1x5, then both (AB)C and A(BC) would be defined and would be equal, even with the oddball 1x1 intermediate (AB) product.
- 1