9

Wikipedia states:

Given three matrices A, B and C, the products (AB)C and A(BC) are defined if and only the number of columns of A equals the number of rows of B and the number of columns of B equals the number of rows of C (in particular, if one of the product is defined, the other is also defined)

Row and column vectors can be thought of as just special cases of matrices. So given the above I would expect:

$$(a^Tb)c = a^T(bc)$$

However the right side is undefined because you can’t multiply two column vectors, seemingly contradicting Wikipedia. Am I mistaken? If not, can we only consider matrix multiplication to be associative in contexts where we know no intermediate matrix becomes 1x1?

2 Answers2

15

The issue is that, technically, $(a^T b)c$ doesn't exist either. You see, we often pretend $a^T b$ is the scalar $k:=a\cdot b$, but it's really a $1\times 1$ matrix whose only entry is $k$. It's one thing to left-multiply $c$ by $k$; it's another to left-multiply $c$ by the $1\times 1$ matrix itself, which you can't do. If each of these vectors has $n$ entries with $n\ne 1$, $(a\cdot b)c=kI_n c\ne kI_1 c$ ($I_1 c$ is of course undefined), where $I_m$ is the $m\times m$ identity matrix.

J.G.
  • 115,835
  • I’m a little confused by the statement that the LHS doesn’t exist. Say $a^Tb = k$. Where $k$ is a scalar. I assume we both agree this is valid. Are you claiming it is illegal to right multiply both sides by a vector $c$ to get $(a^Tb)c = (k)c$ because the left is technically a matrix matrix multiplication and the right is a scalar matrix multiplication? – Joseph Garvin Aug 30 '18 at 19:27
  • What I'm saying is that really, $a^T b = \left(\begin{array}{c} k\end{array}\right)$. Try multiplying that by $c$. – J.G. Aug 30 '18 at 19:33
  • Right, hmm. So when is it ever valid to consider $a^Tb$ a scalar? – Joseph Garvin Aug 30 '18 at 19:39
  • 8
    @JosephGarvin It's never valid, but sometimes it makes a proof shorter to ignore that fact. Suppose I want to prove $a\mapsto Ra$ preserves length when $R^T R=I_n$. People often write $a\cdot a=a^T a =a^T R^T R a=(Ra)^T Ra=(Ra)\cdot Ra$, which is nonsense because the first and last $=$ both lie. But everyone knows you really mean $a^T a =a^T R^T R a=(Ra)^T Ra\implies a\cdot a=(Ra)\cdot Ra$. This is an example of what's called abuse of notation. https://en.wikipedia.org/wiki/Abuse_of_notation – J.G. Aug 30 '18 at 19:47
0

If $a,b,c$ are vectors, say $n\times 1$, the statement of Wikipedia is not respected, since you multiply matrices $1\times n, n \times 1, n \times 1$.

But LHS exists (explained by @J.G. above).

user376343
  • 8,311