# Why is matrix multiplication defined a certain way? [duplicate]

Why is it that when multiplying a (1x3) by (3x1) matrix, you get a (1x1) matrix, but when multiplying a (3x1) matrix by a (1x3) matrix, you get a (3x3) matrix? Why is matrix multiplication defined this way?

Why can't a (1x3) by (3x1) yield a (3x3), or a (3x1) by (1x3) yield a (1x1)? I really would like to get to the root of this problem or 'axiomatization'. Thanks.

-

## marked as duplicate by Zev Chonoles, Hagen von Eitzen, Sami Ben Romdhane, Git Gud, AmzotiJul 7 '13 at 21:02

I read the related posts as mentioned above, but I'm still unable to understand why. –  Anonymous Jul 7 '13 at 20:46
@AbhishekMallela Have you learned about linear maps and their relation to matrices? –  Git Gud Jul 7 '13 at 20:48

The idea is that a matrix represents a linear map of finite-dimensional vector spaces. A (3x1) matrix "is" a linear map $\Bbb{R} \to \Bbb{R}^3$, and so on...

Multiplying matrices amounts to composing these functions. The rules of matrix multiplication you ask about are tha classical rules of function composition. (if $f:E \to F$ and $g:F\to G$ then $g\circ f : E \to G$.)

Long story short, you need to study the relationship between matrices and linear maps.

-
Thank you, it makes sense now –  Anonymous Jul 7 '13 at 20:53
@AbhishekMallela How does this answer make sense, but the other answers in the duplicate question which you claim to have read and said didn't understand do not? –  Git Gud Jul 7 '13 at 20:55
However, if one defines the composition of (linear) functions from left to right instead of the usual backwards way, then matrix multiplication would end up the other way around, exactly as you suggested in the question. –  Berci Jul 7 '13 at 22:26
You're right, and it would be actually less confusing ! –  justt Jul 8 '13 at 7:45

Suppose \begin{align} p & = 2x + 3y \\ q & = 3x - 7y \\ r & = -8x+9y \end{align} Represent this way from transforming $\begin{bmatrix} x \\ y \end{bmatrix}$ to $\begin{bmatrix} p \\ q \\ r \end{bmatrix}$ by the matrix $$\left[\begin{array}{rr} 2 & 3 \\ 3 & -7 \\ -8 & 9 \end{array}\right].$$ Now let's transform $\begin{bmatrix} p \\ q \\ r \end{bmatrix}$ to $\begin{bmatrix} a \\ b \end{bmatrix}$: \begin{align} a & = 22p-38q+17r \\ b & = 13p+10q+9r \end{align} represent that by the matrix $$\left[\begin{array}{rr} 22 & -38 & 17 \\ 13 & 10 & 9 \end{array}\right].$$ So how do we transform $\begin{bmatrix} x \\ y \end{bmatrix}$ directly to $\begin{bmatrix} a \\ b \end{bmatrix}$?

Do a bit of algebra and you get \begin{align} a & = \bullet x + \bullet y \\ b & = \bullet x + \bullet y \end{align} and you should be able to figure out what numbers the four $\bullet$s are. That matrix of four $\bullet$s is what you get when you multiply those earlier matrices. That's why matrix multiplication is defined the way it is.

-