Matrix multiplication is not straight-forward and an important thing to remember is that it is non-commutative (i.e. $AB{\ne}BA$ )

To multiply two matrices together you sort of multiply rows by columns. However, in order to multiply two matrices together, the matrix being post-multiplied must have the same number of columns as the matrix being pre-multiplied has rows (e.g. you cannot post-multiply a 3x2 matrix by a 3x4 matrix, but you can post-multiply a 2x3 matrix by a 3x4 matrix: the result will be a 2x4 matrix).

In general...

$\left[\begin{matrix}a_1&a_2&a_3\\b_1&b_2&b_3\end{matrix}\right]\left[\begin{matrix}c_1&c_2\\d_1&d_2\\e_1&e_2\end{matrix}\right]=\left[\begin{matrix}a_1c_1+a_2d_1+a_3e_1&a_1c_2+a_2d_2+a_3e_2\\b_1c_1+b_2d_1+b_3e_1&b_1c_2+b_2d_2+b_3e_2\end{matrix}\right]$

Another way to look at this.

• Consider the left matrix as a collection of vectors written horizontally,
• so it's one vector per row.
• Consider the right matrix as a collection of vectors written vertically,
• so it's one vector per column.
• To find an entry in the product, take the vector scalar product of the corresponding vectors in the matrices.
Although the definition of matrix multiplication seems weird and unmotivated, it arises from thinking of the matrix as a linear transformation of space.

 What follows probably belongs somewhere else. It's certainly a work in progress.
Consider a point $(x,y)$ in 2D space. We can define another point $(x',y')$ as the result of two equations:

• $a_1x+a_2y=x'$
• $b_1x+b_2y=y'$
We can see that $x'$ is the scalar product of the vectors $(a_1,a_2)$ and $(x,y).$

So $(a_1,a_2).(x,y)~=~x'.$

Similarly, $(b_1,b_2).(x,y)~=~y'.$

As a notational convenience we write these one above the other, like this:

$\left[\begin{matrix}a_1&a_2\\b_1&b_2\end{matrix}\right](x,y)~=~\left[\begin{matrix}x'\\y'\end{matrix}\right]$

We've put square brackets to help show how things are organised, and that has allowed us to write the $(x,y)$ only once, thereby avoiding repetition.

There's an inconsistency here, though, because the vector $(x,y)$ is written horizontally, and the vector $(x',y')$ is written vertically, even though each represents a point in the plane. So we rotate the $(x,y)$ around and get this:

$\left[\begin{matrix}a_1&a_2\\b_1&b_2\end{matrix}\right]\left[\begin{matrix}x\\y\end{matrix}\right]~=~\left[\begin{matrix}x'\\y'\end{matrix}\right]$

This is just a way of writing down the original equations, arranged to be compact. The 2x2 matrix holds the coefficients of the transformation.

Now there are two ways to extend this.

## Applying another transformation

Now what happens if we apply another transformation to the result? So we get these equations:

• $c_1x'+c_2y'=x''$
• $d_1x'+d_2y'=y''$
We can write that as

$\left[\begin{matrix}c_1&c_2\\d_1&d_2\end{matrix}\right]\left[\begin{matrix}x'\\y'\end{matrix}\right]~=~\left[\begin{matrix}x''\\y''\end{matrix}\right]$

Writing $(x'',y'')$ in terms of our original point $(x,y)$ we have:

$\left[\begin{matrix}c_1&c_2\\d_1&d_2\end{matrix}\right]\left[\begin{matrix}a_1&a_2\\b_1&b_2\end{matrix}\right]\left[\begin{matrix}x\\y\end{matrix}\right]~=~\left[\begin{matrix}x''\\y''\end{matrix}\right]$

If you go back to the original equation and work all this out, you'll get this:

• $(c_1a_1+c_2b_1)x~+~(c_1a_2+c_2b_2)y~=~x''$
• $(d_1a_1+d_2b_1)x~+~(d_1a_2+d_2b_2)y~=~y''$
Now we can write this as a matrix equation in its own right, and we get this:

$\left[\begin{matrix}(c_1a_1+c_2b_1)&(c_1a_2+c_2b_2)\\(d_1a_1+d_2b_1)&(d_1a_2+d_2b_2)\end{matrix}\right]\left[\begin{matrix}x\\y\end{matrix}\right]~=~\left[\begin{matrix}x''\\y''\end{matrix}\right]$

Working that out is horrendous, but it is exactly the definition of matrix multiplication.

## Applying the same transformation to a different point

Now we can look at the same transformation being applied to a different vector:

• $a_1u+a_2v=u'$
• $b_1u+b_2v=v'$
Again, we can write this compactly like this:

$\left[\begin{matrix}a_1&a_2\\b_1&b_2\end{matrix}\right]\left[\begin{matrix}u\\v\end{matrix}\right]~=~\left[\begin{matrix}u'\\v'\end{matrix}\right]$

Using our usual rules of algebra we know that $Ax+Ay~=~A(x+y).$ If we're multiplying two different things by something, we can lump them together, and show the combination being multiplied by that.

We do that with the matrices, except that we don't add them, we simply put them side-by-side and understand that that means that they are separate equations that have a common aspect to them, pre-multiplication by a particular matrix:

$\left[\begin{matrix}a_1&a_2\\b_1&b_2\end{matrix}\right]\left[\begin{matrix}x&u\\y&v\end{matrix}\right]~=~\left[\begin{matrix}x'&u'\\y'&v'\end{matrix}\right]$

This all needs to be reworked.

Mathematicians are lazy, and they want, indeed need, simple, elegant ways to write things down and work with them. Instead of working with the equation forms of these transformations it's much easier to work with the matrix forms, provided we use definitions like this that may at first appear arbitrary and unmotivated, but turn out to be concise encapsulations of otherwise nasty calculations.

DeterminantOfAMatrix
DifferenceOfTwoSquares
MathematicsTaxonomy
(none) LinearAlgebra
Matrices EquationOfALine
LinearFunction
MatrixTransformation

## You are here

MatrixMultiplication
Commutative
ScalarProduct
Vectors