Skip to main content

Appendix B Matrices

Properties of Matrices.

A matrix is an array of numbers
\begin{equation*} \begin{pmatrix} 1 \amp 3 \amp 4\\ 4 \amp 1 \amp 9\\ \end{pmatrix} \text{.} \end{equation*}
In order to use matrices to solve systems of equations, we must understand how to multiply matrices using the dot product.
Suppose we have matrix \(\mathbf{A}\) that has the form
\begin{equation*} \mathbf{A} = \begin{pmatrix} A_{11} \amp A_{12} \amp A_{13}\\ A_{21} \amp A_{22} \amp A_{23}\\ A_{31} \amp A_{32} \amp A_{33}\\ A_{41} \amp A_{42} \amp A_{43}\\ \end{pmatrix} \end{equation*}
where \(A_{ij}\) is the matrix element in the \(i\)-th row and \(j\)-th column. Now, if we multiply a matrix by a scalar, we find
\begin{equation*} u\mathbf{A} = \begin{pmatrix} uA_{11} \amp uA_{12} \amp uA_{13}\\ uA_{21} \amp uA_{22} \amp uA_{23}\\ uA_{31} \amp uA_{32} \amp uA_{33}\\ uA_{41} \amp uA_{42} \amp uA_{43}\\ \end{pmatrix}\text{.} \end{equation*}
Let’s now say that we want to multiply matrices \(\mathbf{A}\) and \(\mathbf{B}\) to find \(\mathbf{C}=\mathbf{A}\cdot\mathbf{B}\) where
\begin{equation*} \mathbf{B} = \begin{pmatrix} B_{11} \amp B_{12}\\ B_{21} \amp B_{22}\\ B_{31} \amp B_{32}\\ \end{pmatrix}\text{.} \end{equation*}
First off, \(\mathbf{A}\cdot\mathbf{B}\) is only defined if \(\mathbf{A}\) has a number of columns that is equal to the number of rows of \(\mathbf{B}\text{.}\) In other words, \(\mathbf{A}\cdot\mathbf{B}\) is only defined for matrices where \(\mathbf{A}\) is an \(\ell\times m\) matrix and \(\mathbf{B}\) is an \(m \times n\) matrix. Now we have
\begin{equation*} \mathbf{C}=\mathbf{A}\cdot\mathbf{B} = \begin{pmatrix} A_{11} \amp A_{12} \amp A_{13}\\ A_{21} \amp A_{22} \amp A_{23}\\ A_{31} \amp A_{32} \amp A_{33}\\ A_{41} \amp A_{42} \amp A_{43}\\ \end{pmatrix} \cdot \begin{pmatrix} B_{11} \amp B_{12}\\ B_{21} \amp B_{22}\\ B_{31} \amp B_{32}\\ \end{pmatrix}\text{.} \end{equation*}
The elements of \(\mathbf{C}\) are given by
\begin{equation*} C_{ik} = \sum\limits_{j=1}^n A_{ij} B_{jk} \end{equation*}
where \(n\) is the number of columns of \(\mathbf{A}\) and equivalently the number of rows in \(\mathbf{B}\text{.}\) In other words,
\begin{equation*} C_{11} = A_{11}B_{11} + A_{12}B_{21}+A_{13}B_{31} \end{equation*}
and
\begin{equation*} C_{42} = A_{41}B_{12} + A_{42}B_{22}+A_{43}B_{32}\text{.} \end{equation*}
In other words, in order to find \(C_{ik}\text{,}\) you can multiply, element-by-element, the cells in row i of \(\mathbf{A}\) with the cells in column k of \(\mathbf{B}\text{.}\) The resulting matrix \(\mathbf{C}=\mathbf{A}\cdot\mathbf{B}\) will have the same number of rows as \(\mathbf{A}\) and same number of columns as \(\mathbf{B}\text{.}\)
The identity matrix, typically labeled \(\mathbf{I}\) is another concept that will be necessary to understand. The identity matrix is defined such that
\begin{equation*} \mathbf{I}\cdot\mathbf{A}=\mathbf{A} \end{equation*}
for any matrix \(\mathbf{A}\text{.}\) In order to have this property, the identity matrix must be a square matrix with dimensions \(n\times n\) (same number of rows and columns) with values of 1 on the diagonal and 0 everywhere else:
\begin{equation*} \begin{pmatrix} 1 \amp 0 \amp 0\\ 0 \amp 1 \amp 0\\ 0 \amp 0 \amp 1\\ \end{pmatrix}\text{.} \end{equation*}
The identity matrix can have any value of \(n\) in order to make the desired matrix multiplication work.
Now, let’s say that we have an equation
\begin{equation*} \mathbf{C}=\mathbf{A}\cdot\mathbf{B} \end{equation*}
and let’s further assume that we have prior knowledge of both \(\mathbf{C}\) and \(\mathbf{A}\text{.}\) How do we find \(\mathbf{B}\text{?}\) We cannot perform division with matrices. Instead, we use the concept of an inverse matrix. Let’s define \(\mathbf{A}^{-1}\) to be the inverse matrix of \(\mathbf{A}\) such that \(\mathbf{A}^{-1}\cdot \mathbf{A} = \mathbf{A}\cdot \mathbf{A}^{-1} = \mathbf{I}\text{.}\) Then, we can multiply both sides of our equation by \(\mathbf{A}^{-1}\) to get
\begin{equation*} \mathbf{A}^{-1}\cdot \mathbf{C} = \mathbf{A}^{-1}\cdot \mathbf{A} \cdot \mathbf{B} = \mathbf{I}\cdot\mathbf{B}=\mathbf{B}\text{.} \end{equation*}
You can learn how to find \(\mathbf{A}^{-1}\) given knowledge of \(\mathbf{A}\) in a linear algebra course. For our purposes, we will just rely on Python to invert matrices.

Connecting to systems of equations.

Coming soon.