Topic 13 Matrices and Determinants
Matrices and determinants provide a convenient way to solve systems of linear equations (in any number of variables). Consider the system \[ \begin{matrix} 4x & + & y & & & = & 1\\ x & + & 2y & + & z & = & 2\\ 3x & - & y & + & 2z & = & -1 \end{matrix} \] Lined up like this, we can record the coefficients on the LHS into a “matrix”: \[ \begin{pmatrix} 4 & 1 & 0\\ 1 & 2 & 1 \\ 3 & -1 & 2 \end{pmatrix}. \]
13.1 Terminology
More precisely, an \(m\times n\) (read “\(m\) by \(n\)”) matrix \(A\) is a rectangular array of numbers, with \(m\) rows and \(n\) columns: \[ 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}. \] Shorthand notation: \(A=(a_{ij})_{i=1,\dots,m; j=1,\dots,n}\), or just \(A=(a_{ij})\).
The number \(a_{ij}\) is called the entry (or element) of \(A\) in the \(i^\text{th}\) row and \(j^\text{th}\) column. This can be also referred to as \((i,j)\)-entry.
Note: in \(m\times n\), the first number (\(m\)) refers to rows, and the second (\(n\)) to columns.
The “\(m \times n\)” is called the size (or order) of the matrix \(A\).
If the size of a matrix is \(n\times n\), we call such a matrix a square matrix.
If every entry of a matrix is \(0\), we call that matrix a zero matrix.
Example 13.1 \(\begin{pmatrix} 0 & 0\\ 0 & 0\end{pmatrix}\), \(\begin{pmatrix} 0 & 0 & 0\\ 0 & 0 & 0\end{pmatrix}\).
The identity or unit matrix, denoted \(I_n\), is the \(n\times n\) square matrix \[ I_n = \begin{pmatrix} 1 & 0 & 0 & \cdots & 0\\ 0 & 1 & 0 & \cdots & 0\\ 0 & 0 & 1 & \cdots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \end{pmatrix} \]
Two matrices \(A=(a_{ij})\) and \(B=(b_{ij})\) are said to be equal, if:
- they have the same size, and
- \(a_{ij}=b_{ij}\) for all \(i\) and \(j\).
The transpose of the \(m\times n\) matrix \(A=(a_{ij})\) is the \(n\times m\) matrix \(A^{T} = (a_{ji})\). In other words, transposing turns rows into columns and vice versa.
Example 13.2 \(\begin{pmatrix}1 & 2 & 5 \\ 0 & -6 & 7\end{pmatrix}^T = \begin{pmatrix}1&0\\2&-6\\5&7\end{pmatrix}\).
The sum (resp. difference) of two matrices \(A=(a_{ij})\) and \(B=(b_{ij})\) of the same size \(m\times n\) is the \(m\times n\) matrix \(C=(c_{ij})\) where \(c_{ij}=a_{ij} + b_{ij}\) (resp. \(c_{ij}=a_{ij}-b_{ij}\)).
Example 13.3 \(\begin{pmatrix}1 & 3 & 1\\ 1 & 0 & 0\end{pmatrix}+
\begin{pmatrix}0 & 0 & 5\\ 7 & -3 & 0\end{pmatrix}\)
\(=\begin{pmatrix}1+0&3+0&1+5\\1+7&0+(-3)&0+0\end{pmatrix}\)
\(=\begin{pmatrix}1&3&6\\8&-3&0\end{pmatrix}\),
\(\begin{pmatrix}3&5\\2&4\\-1&8\end{pmatrix}-\begin{pmatrix}7&2\\6&-9\\3&8\end{pmatrix}\)
\(=\begin{pmatrix}3-7&5-2\\2-6&4+9\\-1-3& 8-8\end{pmatrix}\)
\(=\begin{pmatrix}-4&3\\-4&13\\-4&0\end{pmatrix}\).
Note: The sum nor the difference of matrices of different sizes is not defined.
The product \(\lambda A\) of a number \(\lambda\) with a matrix \(A=(a_{ij})\) is the matrix \(B=(b_{ij})\) given by \(b_{ij}=\lambda a_{ij}\).
Example 13.4 \(2\cdot \begin{pmatrix} 3 & 4\\ 1 & 3\\ 2 & -2\end{pmatrix}\) \(=\begin{pmatrix}2\cdot3&2\cdot4\\ 2\cdot1&2\cdot 3\\2\cdot 2&2\cdot(-2)\end{pmatrix}\) \(=\begin{pmatrix}6&8\\2&6\\4&-4\end{pmatrix}\).
13.1.1 Multiplying matrices
First, the product of a \(1\times n\) matrix (also called a row vector) with an \(n\times 1\) matrix (also called a column vector) is the following number (or a \(1\times 1\) matrix): \[ (a_1,a_2,\dots,a_n)\cdot\begin{pmatrix}b_1\\b_2\\\vdots\\b_n\end{pmatrix} := a_1b_1 + a_2b_2 + \dots + a_nb_n. \]
Example 13.5 \((2,3)\cdot\begin{pmatrix}1\\-1\end{pmatrix}=2\cdot1+3\cdot(-1)=2-3=-1\).
\((2,4,-1)\cdot \begin{pmatrix} 0\\ 2 \\ -4\end{pmatrix}\)
\(=2\cdot0+4\cdot2+(-1)\cdot(-4)=0+8+4=12\).
In general: let \(A\) be an \(m\times n\) matrix, and let \(B\) be an \(n\times p\) matrix. Then their product \(A\cdot B\) is the \(m\times p\) matrix whose \((i,j)\)-entry is defined to be the product of the \(i^\text{th}\) row of \(A\) with the \(j^\text{th}\) column of \(B\).
Example 13.6 \(\begin{pmatrix}2&4\\9&1\end{pmatrix}\cdot \begin{pmatrix}8&7\\6&3\end{pmatrix}\) \(=\begin{pmatrix}2\cdot8+4\cdot6& 2\cdot7+4\cdot3 \\ 9\cdot8+1\cdot6& 9\cdot7+1\cdot3\end{pmatrix}\) \(=\begin{pmatrix}40&26\\78&66\end{pmatrix}\).
Example 13.7 \(\begin{pmatrix}1 & 3 & 2\\ 6 & 0 & -4\end{pmatrix}\cdot
\begin{pmatrix}1 & 0 & 1\\ 0&1&0 \\ 0& 1 & 1\end{pmatrix}\)
\(=\begin{pmatrix}1\cdot1+3\cdot0+2\cdot0& 1\cdot0+3\cdot1+2\cdot1&1\cdot1+3\cdot0+2\cdot1\\ 6\cdot1+0\cdot0+(-4)\cdot0 & 6\cdot0+0\cdot1+(-4)\cdot1 & 6\cdot1+0\cdot0+(-4)\cdot1\end{pmatrix}\)
\(=\begin{pmatrix}1&5&3\\6&-4&2\end{pmatrix}\).
Notes:
If the number of columns of \(A\) does not match the number of rows of \(B\), then the product \(AB\) is not defined.
In general \(AB\not=BA\) even if both sides are defined.
13.2 Determinants
The determinant of a square matrix \(A=(a_{ij})\) is a certain number that will be explained in the following subsections — first special cases for small matrices, and subsequently in general.
We will write \[ \det(A) = \det \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \end{pmatrix} \quad\text{ or }\quad \begin{vmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \end{vmatrix} \] for that number.
13.2.1 Determinants: formulas for small sizes
- \(\det(a_{11}) := a_{11}\)
- \(\det\begin{pmatrix}a&b\\c&d\end{pmatrix} := ad-bc\), for example \(\begin{vmatrix}2&1\\3&5\end{vmatrix}=2\cdot 5-1\cdot 3=7\).
- \(\det \begin{pmatrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{pmatrix}\) \(:= a_{11}a_{22}a_{33} + a_{12}a_{23}a_{31} + a_{13}a_{21}a_{32} - a_{13}a_{22}a_{31} - a_{11}a_{23}a_{32} - a_{12}a_{21}a_{33}\).
Example 13.8 \(\begin{vmatrix}2&0&3\\ 4&1&2\\ 1&0&3\end{vmatrix}\) \(=2\cdot1\cdot3+0\cdot2\cdot1 + 3\cdot4\cdot0 - 3\cdot1\cdot1 - 2\cdot2\cdot0 - 0\cdot4\cdot3\) \(=6-3=3\).
13.2.2 Determinants: terminology required for the general formula
We associate a sign to positions in a matrix: the \((i,j)\)-position gets \((-1)^{i+j}\). Schematically: \[ \begin{pmatrix} + & - & + & \cdots \\ - & + & - & \cdots\\ + & - & + & \cdots\\ \vdots & \vdots & \vdots & \ddots\end{pmatrix} \qquad\text{(chessboard pattern)} \] Next, the \((i,j)\)-minor of a square matrix \(A=(a_{ij})\) is the determinant of the square matrix that is left when we remove the \(i^\text{th}\) row and \(j^\text{th}\) column of \(A\).
Example 13.9 The \((2,2)\)-minor of \(\begin{pmatrix}3&4\\5&6\end{pmatrix}\) is \(3\).
Example 13.10 The \((2,1)\)-minor of \(\begin{pmatrix}2&3&4\\-1& 0 &2\\3&4&1\end{pmatrix}\) is \(\begin{vmatrix}3&4\\ 4&1\end{vmatrix}=3-16=-13\).
The \((i,j)\)-cofactor of a square matrix \(A=(a_{ij})\), denoted \(A_{ij}\), is the \((i,j)\)-minor multiplied by the sign of the \((i,j)\)-position.
Example 13.11 The \((1,2)\)-cofactor of \(\begin{pmatrix}2&-2\\1&3\end{pmatrix}\) is \(-1\).
Example 13.12 The \((2,3)\)-cofactor of \(\begin{pmatrix}1&2&0\\0&1&3\\-1&0&1\end{pmatrix}\) is \(-\begin{vmatrix}1&2\\-1&0\end{vmatrix}=-(1\cdot0-2\cdot(-1))=-2\).
13.2.3 Determinants: general definition
The determinant of the square matrix \(A=(a_{ij})\) is \[ \det(A) = a_{11}A_{11} + a_{12}A_{12} + \dots + a_{1n}A_{1n}. \]
Example 13.13 \(\det\begin{pmatrix}a&b\\c&d\end{pmatrix} = ad + b(-c)=ad-bc\).
Example 13.14 \(\begin{vmatrix}2&0&3\\4&1&2\\1&0&3\end{vmatrix}\) \(=2\cdot\begin{vmatrix}1&2\\0&3\end{vmatrix} - 0\cdot\begin{vmatrix}4&2\\1&3\end{vmatrix} + 3\cdot\begin{vmatrix}4&1\\1&0\end{vmatrix}\) \(=2\cdot(1\cdot3-2\cdot0) + 3(4\cdot0-1\cdot1)=6-3=3\).
Note: This kind of ``expansion’’ works not just along the first row, but along any row or any column, and always gives the same number! (This is a Theorem, and we will not prove it here.)
For example, using the second column: \(\begin{vmatrix}2&0&3\\4&1&2\\1&0&3\end{vmatrix}\) \(=-0\cdot\begin{vmatrix}4&2\\1&3\end{vmatrix} + 1\cdot\begin{vmatrix}2&3\\1&3\end{vmatrix} - 0\cdot\begin{vmatrix}2&3\\4&2\end{vmatrix}\) \(=2\cdot3-3\cdot1=3\).