Associativity of Matrix Multiplication 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?
 A: 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.
A: $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. 
A: 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.
A: 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.
