Overview

On this page, we discuss arithmetic operations for matrices and their properties.

Important

The basic and advanced learning objectives listed below are meant to give you an idea of the material you should learn about this section. These are mainly intended to be used in a course which uses an Active Learning approach, where students are required to “read ahead” before each class - but can equally be used in a more traditional course setting.

Unless your teacher gives you specific instructions, it is up to you to decide how much of the listed resources you need to read or watch - you probably do not need to go through all of it. You might also want to look at the General Study Tips & Tricks page for some recommendations on how to effectively study with a math textbook and videos.

Basic learning objectives

These are the tasks you should be able to perform with reasonable fluency when you arrive at your next class meeting. Important new vocabulary words are indicated in italics.

  • Determine the size (or format) of a given matrix.
  • Identify the row vectors and column vectors of a given matrix.
  • Perform the arithmetic operations of matrix addition, subtraction, multiplication by a scalar.
  • Determine whether the product of two given matrices is defined.
  • Express a linear system as a matrix equation, and identify the coefficient matrix.
  • Express a matrix equation as a linear system.
  • Compute the transpose of a matrix.
  • Compute the trace of a square matrix.

Advanced learning objectives

In addition to mastering the basic objectives, here are the tasks you should be able to perform after class, with practice:

  • Compute matrix products using the row-column method, the column method, and the row method.
  • Determine whether the product of several matrices is defined.
  • Express the product of a matrix and a column vector as a linear combination of the columns of the matrix.
  • Write all entries of a matrix when conditions using the subscript notation are given.
  • Prove results using the definitions of arithmetic operations.

To prepare for class

Matrix Addition and multiplication by a scalar

These two operations are natural extensions of the same operations we have already seen for vectors: They are done “component-wise”, i.e. by considering corresponding components individually.

  • Watch this short video which explains this and shows some examples:

Matrix Multiplication

Matrix multiplication is defined around the operation of the dot product of a row and column vector.

  • Watch this video which explains how matrix multiplication works in detail:

  • Watch this short video which shows some examples of matrix multiplications where the size of the resulting matrix is maybe surprising:

  • Watch this video which explains the non-commutativity of matrix multiplication (i.e. the fact that the order matters) using “actions”:

  • Play around with this website, which illustrates matrix multiplication with a neat animation: http://matrixmultiplication.xyz/

    You could also use this website to quickly produce random matrices to multiply, do the multiplication yourself on paper, and then use the website to verify your results. The more matrix multiplications you do, the more efficient you will become at it.

After class

Fast matrix multiplication using Linear Combinations

There is a way to greatly accelerate the calculation of a matrix product, especially if one of the two matrices involves lots of zeroes and ones, using linear combinations:

The Column Method

By multiplying an \(m\times n\) matrix \(A\) on the right by a single \(n\times 1\) column vector \(\vec{v}\), you should convince yourself that the resulting product is:

  • an \(m\times 1\) vector
  • equal to the linear combination of the columns of \(A\), with coefficients coming from the vector \(\vec{v}\):
$$A\vec{v}=\left[\begin{array}{c|c|c|c} &&&\\C_1&C_2&C_3&C_4\\&&&\end{array}\right]\begin{bmatrix}a\\b\\c\\d\end{bmatrix}=a \begin{bmatrix}\\C_1\\~\end{bmatrix}+b \begin{bmatrix}\\C_2\\~\end{bmatrix}+c \begin{bmatrix}\\C_3\\~\end{bmatrix}+d \begin{bmatrix}\\C_4\\~\end{bmatrix}$$

This is especially useful when the vector \(\vec{v}\) contains lots of zeroes and (\(\pm\)) ones.

For example:

$$\begin{aligned}\left[\begin{array}{c|c|c|c} 1&2&3&4\\ 5&6&7&8\\ 9&10&11&12\end{array}\right]\begin{bmatrix}0\\0\\1\\1\end{bmatrix} &=0 \begin{bmatrix}1\\5\\9\end{bmatrix}+0 \begin{bmatrix}2\\6\\10\end{bmatrix}+1 \begin{bmatrix}3\\7\\11\end{bmatrix}+1 \begin{bmatrix}4\\8\\12\end{bmatrix} \\&= \begin{bmatrix}3\\ 7\\11\end{bmatrix}+\begin{bmatrix}4\\ 8\\12\end{bmatrix}=\begin{bmatrix}7\\15\\23\end{bmatrix}\end{aligned}$$

This of course gives the same result as when we use the “usual” method for calculating the product, but the advantage is that in many cases, we can immediately “see” and write down the resulting column, simply by “inspection” of the columns of the first matrix.

If instead of a vector \(\vec{v}\) we now multiply by a larger matrix \(B\), we simply think of repeating this process for each of the columns of \(B\):

$$AB=\left[\begin{array}{c|c|c|c} 1&2&3&4\\ 5&6&7&8\\ 9&10&11&12\end{array}\right]\left[\begin{array}{c|c}0&0\\0&-1\\1&0\\1&0\end{array}\right] =\left[\begin{array}{c|c}7&-2\\15&-6\\23&-10\end{array}\right]$$

The Column Method:

The \(i\)-th column in the matrix product \(AB\) can be obtained as the linear combination of the columns of \(A\), using the \(i\)-th column of \(B\) as the coefficients.

The Row Method

By considering rows instead of columns, we get the following (notice how the roles of \(A\) and \(B\) have swapped compared to the column method):

The Row Method:

The \(i\)-th row in the matrix product \(AB\) can be obtained as the linear combination of the rows of \(B\), using the \(i\)-th row of \(A\) as the coefficients.

For example:

$$\begin{bmatrix}0&1&1&0\\\hline 0&0&0&1\end{bmatrix} \begin{bmatrix}&&R_1&&\\\hline &&R_2&&\\\hline &&R_3&&\\\hline &&R_4&&\end{bmatrix} = \begin{bmatrix} 0\cdot R_1+1\cdot R_2+1\cdot R_3+0\cdot R_4\\\hline 0\cdot R_1+0\cdot R_2+0\cdot R_3+1\cdot R_4 \end{bmatrix}= \begin{bmatrix} &&R_2+R_3&&\\\hline &&R_4 && \end{bmatrix}$$
$$\begin{bmatrix}0&1&1&0\\\hline 0&0&0&1\end{bmatrix} \begin{bmatrix}1&2&3&4&5\\\hline 6&7&8&9&10\\\hline 11&12&13&14&15\\\hline 16&17&18&19&20\end{bmatrix} = \begin{bmatrix} 17&19&21&23&25\\\hline 16&17&18&19&20 \end{bmatrix}$$

Which method should you use?

  • When the first matrix, \(A\), in a product \(AB\) contains lots of zeroes and \(\pm 1\)s, then the row method can be advantageous.

  • When the second matrix, \(B\), in a product \(AB\) contains lots of zeroes and \(\pm 1\)s, then the column method can be advantageous.

  • When in doubt, simply use the “usual” method using the dot product.


Author

Gabriel Indurskis Avatar Gabriel Indurskis

Published

Last Updated

Category

linearalgebra

Tags

Feedback

Please click here if you find a mistake or broken link/video, or if you have any other suggestions to improve this page!