Multiplying with Matrices


Given two matrices, \(A\) and \(B\), such that:

the number of columns in matix \(A\) = the number of rows in matrix \(B\)

When we multiply two vectors using the cross product we obtain a new vector. This is unlike the scalar product (or dot product) of two vectors, for which the outcome is a scalar (a number, not a vector!).


Dimensions (size) of a Matrix

Given a matrix, its dimension, or size, is written: \[m\times n\] where:

  • \(m\) is the number of rows the matrix has
  • \(n\) is the number of columns the matrix has
For example, consider the matrices \(A\) and \(B\) shown here: \[A = \begin{pmatrix} 2 & 1 & -5 \\ 0 & 7 & 8 \end{pmatrix} \quad B = \begin{pmatrix} -1 & 0 & 7 \\ 6 & 2 & -3 \\ -5 & 1 & 9 \end{pmatrix}\] We say that:
  • \(A\) is a \(2\times 3\) "two by three" matrix
  • \(B\) is a \(3\times 3\) "three by three" matrix.


"Special" Matrices

Some special cases are worth pointing out:

  • Square Metrices: matrices with as many rows as columns are known as square matrices. For instance: \[A = \begin{pmatrix} 3 & -1 \\ 2 & 0 \end{pmatrix}, \ B = \begin{pmatrix} -2 & 0 & 1 \\ 5 & -6 & 7 \\ 8 & 9 & -4 \end{pmatrix}\]

Addition & Subtraction with Matrices


Given two matrices \(A\) and \(B\), they can be added (or subtracted) to (or from) each other if and only if they have same dimension (same size).

Given \(A = \begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}\) and \(B = \begin{pmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{pmatrix} \)

\[A+B = \begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} + \begin{pmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{pmatrix} = \begin{pmatrix}a_{11} + b_{11}& a_{12} + b_{12} \\ a_{21} + b_{21} & a_{22} + b_{22} \end{pmatrix}\]

Example

Given \(A = \begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}\) and \(B = \begin{pmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{pmatrix} \)

Given the matrices \(A = \begin{pmatrix} 2 & 3 \\ 1 & -5 \end{pmatrix}\) and \(B = \begin{pmatrix} -2 & 0 \\ 7 & -1 \end{pmatrix}\) \[\begin{aligned} A + B & = \begin{pmatrix} 2 & 3 \\ 1 & -5 \end{pmatrix} + \begin{pmatrix} -2 & 0 \\ 7 & -1 \end{pmatrix} \\ & = \begin{pmatrix} 2 + (-2) & 3 + 0 \\ 1 + 7 & -5 + (-1) \end{pmatrix}\\ A + B & = \begin{pmatrix} 0 & 3 \\ 8 & -6 \end{pmatrix} \end{aligned}\]

Given the matrices \(A = \begin{pmatrix} 2 & 3 \\ 1 & -5 \end{pmatrix}\) and \(B = \begin{pmatrix} -2 & 0 \\ 7 & -1 \end{pmatrix}\) \[\begin{aligned} A - B & = \begin{pmatrix} 2 & 3 \\ 1 & -5 \end{pmatrix} - \begin{pmatrix} -2 & 0 \\ 7 & -1 \end{pmatrix} \\ & = \begin{pmatrix} 2 + (-2) & 3 + 0 \\ 1 + 7 & -5 + (-1) \end{pmatrix}\\ A + B & = \begin{pmatrix} 0 & 3 \\ 8 & -6 \end{pmatrix} \end{aligned}\]

Multiplication by a Scalar

Given a matrix \(A\), we can multiply \(A\) by any scalar \(k \in \mathbb{R}\) by multiplying each of the entries of \(A\) by \(k\). This is shown here for a \(2\times 2\) matrix: \[ k\times A = k\times \begin{pmatrix} a_{11} & a_{11} \\ a_{11} & a_{11} \end{pmatrix} = \begin{pmatrix} k\times a_{11} & k\times a_{11} \\ k\times a_{11} & k\times a_{11} \end{pmatrix} \]

Example

Given the matrix \(A\) defined as \(A = \begin{pmatrix} 1 & -3 \\ 0 & 5 \end{pmatrix}\), we can multiply this matrix by \(2\) as follows: \[\begin{aligned} 2\times A & = 2\times \begin{pmatrix} 1 & -3 \\ 0 & 5 \end{pmatrix} \\ & = \begin{pmatrix} 2\times 1 & 2\times (-3) \\ 2\times 0 & 2\times 5 \end{pmatrix} \\ 2A & = \begin{pmatrix} 2 & -6 \\ 0 & 10 \end{pmatrix} \end{aligned}\] Given the matrix \(B\) defined as \(B = \begin{pmatrix} 2 & 1 \\ -4 & 8 \\ 6 & 0 \end{pmatrix}\), we can multiply this matrix by \(-3\) as follows: \[\begin{aligned} -3 \times B & = B\\ & = \begin{pmatrix} 2 & 1 \\ -4 & 8 \\ 6 & 0 \end{pmatrix} \\ & = \begin{pmatrix} -3 \times 2 & -3 \times 1 \\ -3 \times (-4) & -3 \times 8 \\ -3 \times 6 & -3 \times 0 \end{pmatrix} \\ & = \\ -3B & = \end{aligned}\]

If you are unfamiliar with how to calculate the determinant of a 3 by 3 matrix, or you need a reminder, click on the "show more" button below.

Determinant of a 3 by 3 Matrix (Reminder/Crash Course)


Given a 3 by 3 matrix \(A\), defined as: \[A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix}\] its determinant, \(det\begin{pmatrix}A \end{pmatrix}\) is: \[\begin{aligned} det \begin{pmatrix}A \end{pmatrix} & = \begin{vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{vmatrix} \\ & = a_{11} \begin{vmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{vmatrix} - a_{12} \begin{vmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{vmatrix} + a_{13} \begin{vmatrix} a_{21} & a_{22} \\ a_{31} & a_{32} \end{vmatrix} \end{aligned}\] Where \(\begin{vmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{vmatrix}\), \(\begin{vmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{vmatrix}\) and \(\begin{vmatrix} a_{21} & a_{22} \\ a_{31} & a_{32} \end{vmatrix}\) can all be calculated using the 2 by 2 matrix determinant formula: \[\begin{vmatrix}a & b \\ c & d \end{vmatrix} = ad-bc\]

Example

Given the matrix defined as: \[A = \begin{pmatrix} 2 & 1 & 3 \\ 3 & 0 & -5 \\ 1 & -4 & 6 \end{pmatrix}\] we calculate its determinant, written \(det\begin{pmatrix}A \end{pmatrix}\), or \(\begin{vmatrix}A\end{vmatrix}\) as follows: \[\begin{aligned} det\begin{pmatrix}A\end{pmatrix} & = \begin{vmatrix} 2 & 1 & 3 \\ 3 & 0 & -5 \\ 1 & -4 & 6 \end{vmatrix} \\ & = 2 \begin{vmatrix} 0 & -5 \\ -4 & 6 \end{vmatrix} - 1 \begin{vmatrix} 3 & -5 \\ 1 & 6 \end{vmatrix} + 3 \begin{vmatrix} 3 & 0 \\ 1 & -4 \end{vmatrix} \\ & = 2 \begin{pmatrix}0 \times 6 - (-4)\times (-5) \end{pmatrix} - 1 \begin{pmatrix} 3 \times 6 - 1 \times (-5) \end{pmatrix} + 3 \begin{pmatrix} 3 \times (-4) - 1 \times 0 \end{pmatrix} \\ & = 2\begin{pmatrix}0 - 20 \end{pmatrix} - 1\begin{pmatrix} 18 + 5 \end{pmatrix} + 3 \begin{pmatrix} -12 - 0 \end{pmatrix} \\ & = 2 \begin{pmatrix}-20\end{pmatrix} - 1 \begin{pmatrix}23\end{pmatrix} + 3 \begin{pmatrix}-12\end{pmatrix} \\ & = -40 - 23 - 36 \\ det\begin{pmatrix}A\end{pmatrix} & = -99 \end{aligned}\]

Cross Product

Given two vectors \(\vec{u} = \begin{pmatrix}u_1 \\ u_2 \\ u_3 \end{pmatrix}\) and \(\vec{v} = \begin{pmatrix}v_1 \\ v_2 \\ v_3 \end{pmatrix}\), the vector product, or cross product, \(\vec{u}\times \vec{v}\) equals to the determinant of the 3 by 3 matrix defined as: \[A = \begin{pmatrix} \vec{i} & \vec{j} & \vec{k} \\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3 \end{pmatrix}\] Notice that:

  • the components in the first row consist of the unit base vectors \(\vec{i}\), \(\vec{j}\) and \(\vec{k}\) (this will always be the first row),
  • the second row is the first vector in the product \(\vec{u}\times \vec{v}\), so in this case \(\vec{u}\),
  • the third row is the second vector in the product \(\vec{u}\times \vec{v}\), so in this case \(\vec{v}\).

So, for the vectors \(\vec{u}\) and \(\vec{v}\) stated further-up, the cross product, \(\vec{u}\times \vec{v}\) is given by: \[\vec{u}\times \vec{v} = \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3 \end{vmatrix}\] \[\begin{aligned} \vec{u}\times \vec{v} & = \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3 \end{vmatrix} \\ & = \vec{i}\begin{vmatrix} u_2 & u_3 \\ v_2 & v_3 \end{vmatrix} - \vec{j} \begin{vmatrix} u_1 & u_3 \\ v_1 & v_3 \end{vmatrix} + \vec{k} \begin{vmatrix} u_1 & u_2 \\ v_1 & v_2 \end{vmatrix} \\ & = \vec{i}\begin{pmatrix} u_2v_3 - v_2u_3 \end{pmatrix} - \vec{j} \begin{pmatrix} u_1v_3 - v_1u_3 \end{pmatrix} + \vec{k} \begin{pmatrix}u_1v_2 - v_1u_2 \end{pmatrix} \\ \vec{u}\times \vec{v} & = \begin{pmatrix} u_2v_3 - v_2u_3 \end{pmatrix}\vec{i} - \begin{pmatrix} u_1v_3 - v_1u_3 \end{pmatrix}\vec{j} + \begin{pmatrix}u_1v_2 - v_1u_2 \end{pmatrix}\vec{k} \end{aligned}\]


Example

Given \(\vec{u} = \begin{pmatrix} 2 \\ 1 \\ -3 \end{pmatrix}\) and \(\vec{v} = \begin{pmatrix} 4 \\ 0 \\ 5 \end{pmatrix}\), calculate their cross product \(\vec{u}\times \vec{v}\).

Solution

Using the method we just saw, we can state: \[\begin{aligned} \vec{u} \times \vec{v} & = \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 2 & 1 & -3 \\ 4 & 0 & 5 \end{vmatrix} \\ & = \vec{i} \begin{vmatrix} 1 & -3 \\ 0 & 5 \end{vmatrix} - \vec{j} \begin{vmatrix} 2 & -3 \\ 4 & 5\end{vmatrix} + \vec{k} \begin{vmatrix} 2 & 1 \\ 4 & 0 \end{vmatrix} \\ & = \vec{i} \begin{pmatrix} 1 \times 5 - 0 \times (-3)\end{pmatrix} - \vec{j} \begin{pmatrix} 2\times 5 - 4 \times (-3) \end{pmatrix} + \vec{k} \begin{pmatrix} 2\times 0 - 4 \times 1 \end{pmatrix} \\ & = \vec{i}\begin{pmatrix} 5 - 0\end{pmatrix} - \vec{j} \begin{pmatrix} 10 - (-12)\end{pmatrix} + \vec{k} \begin{pmatrix} 0 - 4 \end{pmatrix} \\ & = \vec{i} \begin{pmatrix} 5 \end{pmatrix} - \vec{j}\begin{pmatrix} 10+12 \end{pmatrix} + \vec{k} \begin{pmatrix} - 4 \end{pmatrix} \\ \vec{u} \times \vec{v} & = 5 \vec{i} - 22 \vec{j} - 4 \vec{k} \end{aligned}\] That's our final answer, we can now state that \(\vec{u} \times \vec{v} = 5 \vec{i} - 22 \vec{j} - 4 \vec{k} \).


Tutorial: Cross Product using Matrix Algebra

Given the two vectors \(\vec{a} = \begin{pmatrix} 1 \\ 5 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix} 6 \\ 3 \end{pmatrix}\), we learn add and subtract with vectors, by finding \(\vec{a}+ \vec{b}\) and \(\vec{a}- \vec{b}\). We also learn how to multiply a vector by a scalar by finding \(3.\vec{a}\).


Exercise 1

  1. Find \(\vec{a} \times \vec{b}\), given \(\vec{a} = \begin{pmatrix}2 \\ 3 \\ 4 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix} 5 \\ -2 \\ 1 \end{pmatrix}\).

  2. Find \(\vec{c}\times \vec{d}\), given \(\vec{c} = 3 \vec{i} + 5 \vec{j} - \vec{k}\) and \(\vec{d} = \vec{i} -4 \vec{j} +2 \vec{k}\).

  3. Find \(\vec{u}\times \vec{v}\), given \(\vec{u} = 6 \vec{i} - 3 \vec{k}\) and \(\vec{v} = -2 \vec{i} + \vec{j} + 5 \vec{k}\).

  4. Find \(\vec{a} \times \vec{b}\), given \(\vec{a} = \begin{pmatrix}-2 \\ 0 \\ 6 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix} 4 \\ 1 \\ 3 \end{pmatrix}\).

  5. Find \(\vec{m}\times \vec{n}\), given \(\vec{m} = -3\vec{i} + 5 \vec{j} - \vec{k}\) and \(\vec{n} = 4\vec{j} + 7 \vec{k}\).

  6. Find \(\vec{u}\times \vec{v}\), given \(\vec{u} = \begin{pmatrix}8 \\ - 1 \\ -2 \end{pmatrix}\) and \(\vec{v} = \begin{pmatrix}-3 \\ - 2 \\ -4 \end{pmatrix}\).

  7. Find \(\vec{a}\times \vec{b}\), given \(\vec{a} = 3 \vec{i} - 2 \vec{j}\) and \(\vec{b} = 5 \vec{i} + \vec{j}\).

  8. Find \(\vec{c}\times \vec{d}\), given \(\vec{c} = \begin{pmatrix} 2 \\ 3 \\ 1 \end{pmatrix}\) and \(\vec{d} = \begin{pmatrix} 0 \\ 3 \\ 5 \end{pmatrix}\).

Note: this exercise can be downloaded as a worksheet to practice with: Worksheet 1

Properties of the Cross Product


The cross product has the following properties:

  1. anti-commutativity: Given two vectors \(\vec{u}\) and \(\vec{v}\): \[\vec{u}\times \vec{v} = - \vec{v}\times \vec{u}\]
  2. distibutivity: given three vectors \(\vec{u}\), \(\vec{v}\) and \(\vec{w}\): \[\vec{u}\times \begin{pmatrix}\vec{v} + \vec{w}\end{pmatrix} = \vec{u}\times \vec{v} + \vec{u}\times \vec{w}\]
  3. multiplication by a scalar: given two vectors \(\vec{u}\) and \(\vec{v}\) and a scalar \(k\in \mathbb{R}\): \[k\begin{pmatrix}\vec{u}\times \vec{v}\end{pmatrix} = \begin{pmatrix} k\vec{u}\end{pmatrix} \times \vec{v} = \vec{u} \times \begin{pmatrix} k\vec{v}\end{pmatrix}\]
  4. collinearity of vectors: \(\vec{u} \times \vec{v} = \vec{0}\) if and only of the vectors \(\vec{u}\) and \(\vec{v}\) are collinear (\(\vec{u}\) and \(\vec{v}\) are parallel).
  5. magnitude of the cross product: given two vectors \(\vec{u}\) and \(\vec{v}\), the magnitude of the cross product is such that: \[\begin{vmatrix} \vec{u}\times \vec{v} \end{vmatrix} = \begin{vmatrix} \vec{u} \end{vmatrix}.\begin{vmatrix} \vec{v} \end{vmatrix}.sin\theta \] where \(\theta \) is the acute angle between the two vectors.

3. Multiplication by a Scalar

The fact that \(k\begin{pmatrix}\vec{u}\times \vec{v}\end{pmatrix} = \begin{pmatrix} k\vec{u}\end{pmatrix} \times \vec{v} = \vec{u} \times \begin{pmatrix} k\vec{v}\end{pmatrix}\) can often be used to simplify calculations when computing the cross product.

Example

For example, say we're given \(\vec{u} = 20\vec{i} + 60 \vec{j} + 40 \vec{k}\) and \(\vec{v} = \vec{i} + 5\vec{j} - 4\vec{k}\) and that we have to find \(\vec{u} \times \vec{v}\). Then we can use this property to make our calculations a little simpler (and therefore faster) by noticing that \(\vec{u} = 20 \begin{pmatrix} \vec{i} + 3 \vec{j} + 2 \vec{k} \end{pmatrix}\) and using this property to write: \[\begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 20 & 60 & 40 \\ 1 & 5 & -4 \end{vmatrix} = 20 \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 1 & 3 & 2 \\ 1 & 5 & -4 \end{vmatrix}\]

Example

Another example could be, to calculate \(\vec{u}\times \vec{v}\), where \(\vec{u} = 5 \vec{i} - 20 \vec{j} + 10 \vec{k}\) and \(\vec{v} = 9 \vec{i} +6 \vec{j} -3 \vec{k}\). Noticing that \(\vec{u} = 5\begin{pmatrix}1\vec{i} - 4\vec{j} + 2 \vec{k} \end{pmatrix}\) and \(\vec{v} = 3 \begin{pmatrix} 3\vec{i} + 2\vec{j} - \vec{k}\end{pmatrix}\) we can write: \[\begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 5 & -20 & 10 \\ 9 & 6 & -3 \end{vmatrix} = 5\times 3\begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 1 & -4 & 2 \\ 3 & 2 & -1\end{vmatrix} = 15\begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 1 & -4 & 2 \\ 3 & 2 & -1\end{vmatrix}\]


4. Collinearity of Vectors

The fact that \(\vec{u} \times \vec{v} = \vec{0}\) provides us with a useful test for collinearity. Indeed, to check if two vectors, \(\vec{u}\) and \(\vec{v}\), are collinear all we have to do is calculate the cross product \(\vec{u}\times \vec{v}\) then if:

  • \(\vec{u}\times \vec{v} = \vec{0}\) the two vectors are collinear
  • \(\vec{u}\times \vec{v} \neq \vec{0}\) the two vectors aren't collinear.
For instance, we can show that the vectors \(\vec{u} = \vec{i} - 3 \vec{j} + 5 \vec{k}\) and \(\vec{v} = -3 \vec{i} + 9 \vec{j} - 15 \vec{k}\) are collinear by calculating \(\vec{u}\times \vec{v}\): \[\begin{aligned} \vec{u}\times \vec{v} & = \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 1 & -3 & 5 \\ -3 & 9 & -15 \end{vmatrix} \\ & = \vec{i} \begin{vmatrix} -3 & 5 \\ 9 & -15 \end{vmatrix} - \vec{j} \begin{vmatrix} 1 & 5 \\ -3 & -15 \end{vmatrix} + \vec{k} \begin{vmatrix} 1 & -3 \\ -3 & 9 \end{vmatrix} \\ & = \vec{i} \begin{pmatrix} - 3 \times (-15) - 9 \times 5 \end{pmatrix} - \vec{j} \begin{pmatrix}1 \times (-15) - (-3)\times 5 \end{pmatrix} + \vec{k} \begin{pmatrix} 1 \times 9 - (-3)\times (-3)\end{pmatrix} \\ & = \vec{i} \begin{pmatrix} 45 - 45 \end{pmatrix} - \vec{j} \begin{pmatrix} -15 + 15 \end{pmatrix} + \vec{k} \begin{pmatrix} 9 - 9 \end{pmatrix} \\ & = 0\vec{i} + 0\vec{j} + 0\vec{k} \\ \vec{u}\times \vec{v} & = \vec{0} \end{aligned}\] Since \(\vec{u}\times \vec{v} = \vec{0}\), we can state that the vectors \(\vec{u}\) and \(\vec{v}\) are collinear.


Scan this QR-Code with your phone/tablet and view this page on your preferred device.


Subscribe to Our Channel


Subscribe Now and view all of our playlists & tutorials.