1. Matrices#

Matrices are a set of numbers or other mathematical object that are arranged in a rectangular array. They provide us with a convenient way to represent systems of equations, sets of co-ordinates, collections of vectors and transformations. They are fundamental to the field of linear algebra which is why we are going to begin with studying them.

A matrix (plural matrices) is a rectangular array of elements which can be numbers, mathematical expressions, symbols, or even other matrices. Matrices are arranged in rows and columns and enclosed by parentheses (or sometimes square brackets), for example

\[\begin{split} \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}.\end{split}\]

This matrix contains 6 elements arranged in 2 (horizontal) rows and 3 (vertical) columns.

Definition 1.1 (Dimension of a matrix)

The dimension or size of a matrix is defined to be rows \(\times\) columns, where ‘rows’ is the number of horizontal rows and ‘columns’ the number of vertical columns of said matrix. If rows \(=\) columns we say that the matrix is a square matrix.

\[\begin{split} \begin{align*} &\,\,\,\begin{matrix} \leftarrow & \!\!\text{columns}\!\! & \rightarrow \end{matrix} \\ \begin{matrix} \uparrow \\ \text{rows} \\ \downarrow \end{matrix} &\begin{pmatrix} \square & \square & \cdots & \square \\ \square & \square & \cdots & \square \\ \vdots & \vdots & \ddots & \vdots \\ \square & \square & \cdots & \square \end{pmatrix} \end{align*} \end{split}\]

Example 1.1

Determine the dimensions of the following matrices:

(i)   \(A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\)

Solution (click to show)

\(2\times 2 \)

(ii)   \(B = \begin{pmatrix} a & b \\ c & d \\ e & f \end{pmatrix}\)

Solution (click to show)

\(3\times 2\)

(iii)   \(C = \begin{pmatrix} \sin(x) & \ln(x) & \cos(x+1) \end{pmatrix}\)

Solution (click to show)

\(1 \times 3\)

(iv)   \(D = \begin{pmatrix} 0 \end{pmatrix}\).

Solution (click to show)

\(1 \times 1\)

1.1. Indexing a matrix#

Matrices are typically labeled using uppercase characters, e.g., \(A\), and the elements of a matrix are labelled with the corresponding lowercase character, e.g. \(a\). Individual entries of a matrix are indexed using two subscript indices \(a_{ij}\) where \(i\) is the row number reading from top to bottom and \(j\) is the column number reading from left to right.

For example, let \(A\) be an \(m \times n\) matrix then

\[\begin{split} A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix}. \end{split}\]

Some alternative notation used for matrix indexing are given below

\[ a_{ij} = [A]_{ij} = A(i,j). \]

Example 1.2

Given the matrix \(A = \begin{pmatrix} 2 & 0 & -3 \\ 1 & 7 & 4 \end{pmatrix}\), write down the following elements:

(i)   \(a_{12}\);

Solution (click to show)

\(a_{12} = 0\)

(ii)   \(a_{21}\);

Solution (click to show)

\(a_{21} = -1\)

(iii)   \([A]_{13}\);

Solution (click to show)

\([A]_{13} = -3\)

(iv)   \(A(2,2)\).

Solution (click to show)

\(A(2,2) = 7\)

1.2. Matrix operations#

So far, we have given a fancy name to a rectangular array of objects and showed how we can index its elements. Now we are going to fully develop an algebra for matrices. A system, where there are operations of addition and multiplication and necessarily rules that accompany them. This system resembles that of real numbers but we will see some differences and new concepts. For simplicity, we are going to assume that the entries of our matrices are numbers, however the developed theory applies to a broader range of objects.

1.2.1. Matrix equality#

Definition 1.2 (Matrix equality)

We say that an \(m \times n\) matrix \(A\) and an \(p \times q\) matrix \(B\) are equal and write \(A = B\) if and only if both of the following conditions are satisfied:

  • they have the same dimensions, in other words \(m = p\) and \(n = q\);

  • for all \(1 \leq i \leq m\) and \(1 \leq j \leq n\), \(a_{ij} = b_{ij}\).

For example, consider the following matrices

\[\begin{split} \begin{align*} A &= \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, & B &= \begin{pmatrix} 1 & 2 & 5 \\ 3 & 4 & 6 \end{pmatrix}, & C &= \begin{pmatrix} 3^0 & \sqrt{4} \\ 1 + 2 & 2^2 \end{pmatrix}. \end{align*} \end{split}\]

Here \(A \neq B\) since \(A\) has 2 columns and \(B\) has 3 columns. However, \(A=C\) because both \(A\) and \(C\) have the same number of rows and columns and all of the corresponding elements are equal.

1.2.2. Matrix addition#

Definition 1.3 (Matrix addition and subtraction )

Let \(A\) and \(B\) be two \(m \times n\) matrices. The addition or subtraction of two \(m \times n\) matrices \(A\) and \(B\) is an \(m \times n\) matrix \(A \pm B\) defined by:

\[ [A \pm B]_{ij} = a_{ij} \pm b_{ij}, \]

where \(1 \leq i \leq m\) and \(1 \leq j \leq n\). For example, the addition or subtraction of two \(2 \times 2\) matrices is

\[\begin{split} \begin{align*} \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \pm \begin{pmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{pmatrix} = \begin{pmatrix} a_{11} \pm b_{11} & a_{12} \pm b_{12} \\ a_{21} \pm b_{21} & a_{22} \pm b_{22} \end{pmatrix}. \end{align*} \end{split}\]

The addition and subtraction of two matrices of different sizes is not defined.

Theorem 1.1 (Properties of matrix addition)

For all \(m \times n\) matrices \(A,B\) and \(C\), the following conditions are satisfied:

  • matrix addition is commutative, i.e., \(A + B = B + A\);

  • matrix addition is associative, i.e., \(A + (B + C) = (A + B) + C\).

Example 1.3

Evaluate the following:

(i)   \(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} + \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}\);

Solution (click to show)
\[\begin{split} \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} + \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} = \begin{pmatrix} 1 + 5 & 2 + 6 \\ 3 + 7 & 4 + 8 \end{pmatrix}= \begin{pmatrix}6 & 8 \\ 10 & 12 \end{pmatrix} \end{split}\]

(ii)   \(\begin{pmatrix} 2 \\ 3 \\ 5 \end{pmatrix} - \begin{pmatrix} 7 \\ -11 \\ -13 \end{pmatrix}\);

Solution (click to show)
\[\begin{split} \begin{pmatrix} 2 \\ 3 \\ 5 \end{pmatrix} - \begin{pmatrix} 7 \\ -11 \\ -13 \end{pmatrix} = \begin{pmatrix}2 - 7 \\ 3 + 11 \\ 5 + 13 \end{pmatrix} = \begin{pmatrix} -5 \\ 14 \\ 18\end{pmatrix} \end{split}\]

(iii)   \(\begin{pmatrix} 1 & 3 & 5 \\ 7 & 9 & 11 \end{pmatrix} + \begin{pmatrix}2 & 3 \\ 5 & 7 \end{pmatrix}\).

Solution (click to show)

Undefined since the left matrix is \(2\times 3\) and the right matrix is \(2\times 2\)

1.2.3. Scalar multiplication#

Definition 1.4 (Scalar multiplication)

Let \(A\) be a matrix and \(k \in \mathbb{R}\) be a scalar. The scalar multiplcation \(kA\) is defined by

\[ [kA]_{ij} = ka_{ij}, \]

i.e.,

\[\begin{split} \begin{align*} k \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix} = \begin{pmatrix} ka_{11} & ka_{12} & \cdots & ka_{1n} \\ ka_{21} & ka_{22} & \cdots & ka_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ ka_{m1} & ka_{m2} & \cdots & ka_{mn} \end{pmatrix}. \end{align*} \end{split}\]

Theorem 1.2 (Properties of scalar multiplication)

label: properties-of-scalar-multiplication-theorem

Let \(A\) and \(B\) be two \(m \times n\) matrices and \(k\) and \(\ell\) are scalars then

  • scalar multiplication is commutative: \(kA = Ak\);

  • scalar multiplication is distributive over matrix addition: \(k (A + B) = kA + kB\);

  • scalar multiplication is distributive over scalar addition: \((k + \ell)A = kA +\ell A\);

  • scalar multiplication is associative: \(k(\ell A) = (k \ell) A = \ell(kA)\);

  • multiplication by \(-1\) gives the additive inverse: \(-1 \cdot A = -A\).

Example 1.4

Evaluate the following:

(i)   \(2 \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\);

Solution (click to show)
\[\begin{split} 2 \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 2 & 4 \\ 6 & 8 \end{pmatrix} \end{split}\]

(ii)   \(\dfrac{1}{2} \begin{pmatrix} 0 & -1 \\ 3 & 2 \\ 4 &-2 \end{pmatrix}\);

Solution (click to show)
\[\begin{split} \dfrac{1}{2} \begin{pmatrix} 0 & -1 \\ 3 & 2 \\ 4 &-2 \end{pmatrix} = \begin{pmatrix} 0 & -1/2 \\ 3/2 & 1 \\ 2 & -1 \end{pmatrix} \end{split}\]

(iii)   \(a \begin{pmatrix} 1 & 6 & 4 \\ 0 & 3 & -1 \end{pmatrix}\);

Solution (click to show)
\[\begin{split} a \begin{pmatrix} 1 & 6 & 4 \\ 0 & 3 & -1 \end{pmatrix} = \begin{pmatrix} a & 6a & 4a \\ 0 & 3a & -a \end{pmatrix} \end{split}\]

(iv)   \(101 \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} - 99 \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix}\).

Solution (click to show)
\[\begin{split} 101 \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} - 99 \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} = (101 - 99) \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 2 & 4 \\ 0 & 2 \end{pmatrix}\end{split}\]

1.2.4. Matrix transpose#

Definition 1.5 (Matrix transpose)

The transpose of an \(m \times n\) matrix \(A\) is a \(n \times m\) matrix denoted by \(A^\mathsf{T}\) formed by switching the rows and columns of \(A\), i.e.,

\[ [A^\mathsf{T}]_{ij}=a_{ji}. \]

Transposing a matrix switches the rows and columns around so that row \(i\) becomes column \(i\) and column \(j\) becomes row \(j\), i.e.,

\[\begin{split} \begin{align*} \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix}^\mathsf{T} = \begin{pmatrix} a_{11} & a_{21} & \cdots & a_{m1} \\ a_{12} & a_{22} & \cdots & a_{m2} \\ \vdots & \vdots & \ddots & \vdots \\ a_{1n} & a_{2n} & \cdots & a_{mn} \end{pmatrix}. \end{align*} \end{split}\]

Theorem 1.3 (Properties of matrix transpose)

Let \(A\) and \(B\) be two square \(n \times n\) matrices and \(k\) a scalar, then

  • \((A^\mathsf{T})^\mathsf{T} = A\);

  • \((A + B)^\mathsf{T} = A^\mathsf{T} + B^\mathsf{T}\);

  • \((k A)^\mathsf{T} = k (A^\mathsf{T})\);

  • \((AB)^\mathsf{T} = B^\mathsf{T}A^\mathsf{T}\) (the product of two matrices is defined in the following section)

Example 1.5

Evaluate the following:

(i)   \(\begin{pmatrix} 1 & 3 \\ 2 & 4 \end{pmatrix}^\mathsf{T}\);

Solution (click to show)
\[\begin{split} \begin{pmatrix} 1 & 3 \\ 2 & 4 \end{pmatrix}^\mathsf{T} = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \end{split}\]

(ii)   \(\begin{pmatrix} 1 & 0 & -2 \\ 3 & -4 & 1 \end{pmatrix}^\mathsf{T}\);

Solution (click to show)
\[\begin{split} \begin{pmatrix} 1 & 0 & -2 \\ 3 & -4 & 1 \end{pmatrix}^\mathsf{T} = \begin{pmatrix} 1 & 3 \\ 0 & -4 \\ -2 & 1 \end{pmatrix} \end{split}\]

(iii)   \(\begin{pmatrix}2 & 3 & 5 \end{pmatrix}^\mathsf{T}\).

Solution (click to show)
\[\begin{split} \begin{pmatrix}2 & 3 & 5 \end{pmatrix}^\mathsf{T} = \begin{pmatrix} 2 \\ 3 \\ 5 \end{pmatrix} \end{split}\]