Provided two matrices are the same size we are able to add them together and their sum can be defined as C = A + B. When adding two vectors together, the numbers in the same position will be added together i.e. a_{ij} + b_{ij} =  c_{ij} and so on.

A matrix can also be multiplied by a scalar. So if  B = \lambda A then b_{ij} = \lambda a_{ij}.

\\ If you already have no idea about what I’m talking about then read Introduction to Matrices first ?

Worked examples:

Given matrices

A = \begin{bmatrix} 7 & -5 & 8\\ 3 & 5 & -2\end{bmatrix}

B = \begin{bmatrix} -1 & 4 & -9\\ 5 & -1 & 6\end{bmatrix}


a)  A + B

=  \begin{bmatrix} \underline{7} & -5 & 8\\ 3 & 5 & -2\end{bmatrix} + \begin{bmatrix} \underline{-1} & 4 & -9\\ 5 & -1 & 6\end{bmatrix} =  \begin{bmatrix} \underline{6} & -1 & -1\\ 8 & 4 & 4\end{bmatrix}.

\\ Corresponding values are simply added together.


b) 3A-2B

=  3\begin{bmatrix} 7 & -5 & 8\\ 3 & 5 & -2\end{bmatrix} - 2\begin{bmatrix} -1 & 4 & -9\\ 5 & -1 & 6\end{bmatrix}

\\ Write out the expression and then multiply out.

=  \begin{bmatrix} \underline{21} & -15 & 24\\ 9 & 15 & -6\end{bmatrix} - \begin{bmatrix} \underline{-2} & 8 & -18\\ 10 & -2 & 12\end{bmatrix}

\\ Perform appropriate operation.

=  \begin{bmatrix} \underline{23} & -23 & 42\\ -1 & 17 & -18\end{bmatrix}

\\ Voila

Matrix multiplication

We can multiply matrices together provided we’ve met certain conditions are met. For the product A\cdot{B} to exist, the number of columns of A must equal the number of rows in B. So if A is a n\cdot m matrix and B is an i\cdot j matrix then the product C = A\cdot{B} can only exist if m = i .

The result will be a matrix  C whose size is  n \cdot j.

A is  n\cdot m

B is i \cdot j

C is n \cdot j

To see how this works, let’s try out a few examples:

A = \begin{bmatrix} 8 & 7 & 4\\ 0 & -2 & 3\end{bmatrix}

B = \begin{bmatrix} -2 & 8 \\ 10 & -2\end{bmatrix}

C = \begin{bmatrix} -2 & 8 & -0\\ 10 & 5 & 12\end{bmatrix}


D = \begin{bmatrix} -2 \\ 17  \\ 12\end{bmatrix}

E = \begin{bmatrix} -2 & 8 & -18\end{bmatrix}

F = \begin{bmatrix} 3 & -17 & 6\\ 0 & 8 & -12 \\ -6 & 3 & 5 \end{bmatrix}


Consider whether the following matrices can be multiplied together:

A\cdot B

B\cdot A

C\cdot B

A \cdot B

Matrix A is a 2 by \underline{ 3 } and matrix B is a  \underline{ 2 } by 2, hence we can’t multiply. ✗

B \cdot A

Matrix B is a 2 by \underline{ 2 } and matrix A is a  \underline{ 2 } by 3, hence we can multiply. ✓

C \cdot B

Matrix C is a 2 by \underline{ 3 } and matrix B is a  \underline{ 2 } by 2, hence we can’t multiply. ✗

A\cdot F

F\cdot A

A\cdot D

A \cdot F

Matrix A is a 2 by \underline{ 3 } and matrix F is a  \underline{ 3 } by 2, hence we can multiply. ✓

F \cdot A

Matrix F is a 3 by \underline{ 3 } and matrix A is a  \underline{ 2 } by 2, hence we can’t multiply. ✗

A \cdot D

Matrix A is a 2 by \underline{ 3 } and matrix D is a  \underline{ 3 } by 1, hence we can multiply. ✓

A^2

D\cdot E

B^2

A^2

Matrix A is a 2 by \underline{ 3 } and matrix A is a  \underline{ 2 } by 3, hence can’t multiply. ✗

D \cdot E

Matrix A is a 3 by \underline{ 1 } and matrix B is a  \underline{ 1 } by 4, hence we can multiply. ✓

B^2

Matrix B is a 2 by \underline{ 2 } and matrix B is a  \underline{ 2 } by 2, hence we can multiply. ✓

\\ Note: when considering the product of the matrix “{X}\cdot{Y}“; only if the numbers that are underlined are the same (i.e. the columns of X = the number of rows in Y), then a product of {X}\cdot{Y} is possible.


Calculating the product of two matrices

Now that we have got to the point where we can “qualify” that the matrices we are dealing with can, in fact be multiplied together, we can now begin to look at the process of creating a product of two matrices by multiplying them together.

When given the following example find the product of B\cdot{A}

A = \begin{bmatrix} 8 & 7 & 4\\ 0 & -2 & 3\end{bmatrix}

B = \begin{bmatrix} -2 & 8 \\ 10 & -2\end{bmatrix}

As we saw before matrix B is a 2 by \underline{ 2 } and matrix A is a  \underline{ 2 } by 3, hence we can multiply. ✓
{B}\cdot{A} = {\begin{bmatrix} -2 & 8 \\ 10 & -2\end{bmatrix}}\cdot{\begin{bmatrix} 8 & 7 & 4\\ 0 & -2 & 3\end{bmatrix}}

\\ B is a \underline{2} by 2 and A is a 2 by \underline{3} so the product X will be a {2}\cdot{3} matrix.

{B}\cdot{A} = {\begin{bmatrix}  \underline{\emph{-2}} & \underline{\emph{8}} \\ 10 & -2\end{bmatrix}}\cdot{\begin{bmatrix}  \underline{\emph{8}} & 7 & 4\\ \underline{\emph{0}} & -2 & 3\end{bmatrix}}

\\ Firstly: we deal with the first row of B and the first column of A.

X = {\begin{bmatrix}  ((-2)\cdot{8}+8\cdot{0}) & ? & ?\\ ? & ? & ?\end{bmatrix}}

\\ The first row is multiplied by the first column and then the second and then the third.

X = {\begin{bmatrix}  ((-2)\cdot{8}+8\cdot{0}) & ((-2)\cdot{7}+8\cdot{(-2)}}) & ((-2)\cdot{4}+8\cdot{3}})\\ ? & ? & ?\end{bmatrix} = {\begin{bmatrix}  -16 & -30 & 16\\ ? & ? & ?\end{bmatrix}

Note: The first row of B is multiplied by the first column of A which populates the first row of the new matrix X (which we already know is a 2\cdot{3} matrix).

{B}\cdot{A} = {\begin{bmatrix} -2 & 8 \\ \underline{10} & \underline{-2}\end{bmatrix}}\cdot{\begin{bmatrix} \underline{8} & 7 & 4\\ \underline{0} & -2 & 3\end{bmatrix}}

\\ Second row of B by the first column of A, and then second and then third columns as before.

X = {\begin{bmatrix}  ((-2)\cdot{8}+8\cdot{0}) & ((-2)\cdot{7}+8\cdot{(-2)}}) & ((-2)\cdot{4}+8\cdot{3}})\\((10)\cdot{8}+(-2)\cdot{0}) & (10\cdot{7}+(-2)\cdot{(-2)}}) & (10\cdot{4}+(-2)\cdot{3}})\end{bmatrix} = {\begin{bmatrix}  -16 & -30 & 16\\ 80 & 74 & 34\end{bmatrix}

Some important rules about matrices

  • In general:  \boxed{{A\cdot{B}}\neq{B\cdot{A}}}
  • If C =A\cdot{B} then c_{ij} is found by multiplying ith row of A by the jth column of B.
  • In the product A\cdot{B}, because A is in front of B, we say that A “premultiplies” B.
  • In the product A\cdot{B} we would say that B “postmultiplies” A.
  • When you premultiply or postmultiply any matrix by an appropriate size identity matrix the same as the original input matrix, hence both of the following statements hold true.

A\cdot{I} = A

I\cdot{A} = A

Note: I is the identity matrix and A is the matrix being considered, so if it is possible to multiply two together, we’ll just get the same answer anyway if we do. So don’t!

Leave a Comment

Your email address will not be published. Required fields are marked *