We introduced matrices when discussing systems of linear equations. Recall that an \(m \times n\) matrix is a rectangular array of numbers, written in the form
Note that we usually use a capital letter to denote a matrix.
In the context of systems of linear equations the main concept was row reducing a matrix to produce equivalent matrices. In different contexts, however, other operations on matrices have proved useful and we shall discuss these operations below. Before doing this, though, we will introduce some new terminology.
Definition17.1.
Two matrices are said to be equal if they are of the same size and all corresponding entries are equal.
Note that by using the symbol \(0\) to denote the zero matrix we have to tell from the context whether the \(0\) refers to a number or a matrix.
Definition17.4.
For the matrix \(A=(a_{ij})_{m \times n}\text{,}\) its transpose, denoted by \(A^T\text{,}\) is defined by \(A^T = \left(a_{ji}\right)_{n \times m}\text{.}\)
Note that this definition is saying that the rows of matrix \(A\) are the columns of its transpose \(A^T\) and vice versa.
Example17.5.
Let
\begin{equation*}
B = \begin{pmatrix}5 \amp -3 \\ 0 \amp \sqrt{2} \\ 1 \amp \frac{1}{2}\end{pmatrix}, \quad C = \begin{pmatrix} 5 \amp 0 \amp 1\\ -3 \amp a \amp b\end{pmatrix}.
\end{equation*}
For what values of \(a\) and \(b\) does \(B^T=C\text{?}\)
Answer.
\(a=\sqrt{2}, \ b=\dfrac{1}{2}\)
Solution.
Since \(B^T = \begin{pmatrix} 5 \amp 0 \amp 1\\ -3 \amp \sqrt{2} \amp \frac{1}{2}\end{pmatrix}\text{,}\)\(B^T = C\) when \(a=\sqrt{2}\) and \(b=\frac{1}{2}\text{.}\)
Definition17.6.
A square matrix is a matrix that has the same number of rows and columns.
Example17.7.
Matrix \(A\) is a square matrix whereas matrix \(B\) is not.
The \(n \times n\) identity matrix, \(I_n\), is the matrix with \(n\) rows and \(n\) columns with all entries on the main diagonal equal to \(1\) and all other entries \(0\text{,}\) i.e.
Often, when the size of the identity matrix is clear the subscript is dropped from the notation and the identity matrix is denoted just by \(I\text{.}\)
Section17.1Addition and Scalar Multiplication
Definition17.9.Matrix addition and scalar multiplication.
Let \(A\) and \(B\) be \(m \times n\) matrices, i.e., \(A=\left(a_{ij}\right)_{m \times n}\) and \(B = \left(b_{ij}\right)_{m \times n}\text{.}\) Then
Matrix addition is defined by \(A+B = \left(a_{ij} + b_{ij}\right)_{m \times n}\text{.}\)
Scalar multiplication is defined by \(kA = \left(k \cdot a_{ij}\right)_{m \times n}\) where \(k\) is a constant.
Thus, to add two matrices of the same size, add up the corresponding entries in each matrix. Matrix addition of matrices not of the same size is not defined. To multiply a matrix by a scalar, multiply each entry in the matrix by that scalar. Note that we now can also subtract two matrices by defining
\begin{equation*}
A-B = A+ (-1)B.
\end{equation*}
Example17.10.
If \(A = \begin{pmatrix} 1 \amp 2 \amp 3\\ 4 \amp 3 \amp 2\end{pmatrix}, \quad B = \begin{pmatrix} 5 \amp 3 \\ 9 \amp 2 \\ 4 \amp 3\end{pmatrix}.\) Then calculate the given expression or explain why it does not exist.
\(\displaystyle 3A+B\)
\((2A^T - B)_{32} \, \) (i.e. the entry in row \(3\text{,}\) column \(2\) of the matrix \(2A^T-B\,\))
\(\displaystyle (B^T+A)_{31}\)
Solution.
Since \(A\) is a \(2 \times 3\) matrix so will be \(3A\text{.}\) Since \(3A\) and \(B\) are not the same size we cannot add these two matrices.
Show that for any matrix \(A\,\text{,}\)\(3A = A + A + A\text{.}\) For what values of \(k\) is it true that \(kA = \underbrace{A + A + \cdots + A}_{k \mbox{ times}}\,\text{?}\)
3.
Prove that for two matrices \(A\) and \(B\) of the same size \(A+B = B+A\text{.}\)
Section17.2Matrix Multiplication
Definition17.12.
Let \(A=\left(a_{ij}\right)_{m \times n}\) and \(B = \left(b_{ij}\right)_{n \times p}\text{.}\) Then matrix multiplication is defined by
\begin{equation*}
AB = \left(\sum_{k=1}^n a_{ik}b_{kj}\right)_{m \times p}.
\end{equation*}
If we call \(C=AB\) then from this definition it can be seen:
For the matrix multiplication \(AB\) to be defined the number of columns in \(A\) has to be equal to the number of rows in \(B\text{.}\) The resulting matrix, \(C\text{,}\) has the same number of rows as \(A\) and the same number of columns as \(B\text{.}\)
Entry \(c_{ij}\) in \(C\) is found by taking the scalar (or dot) product of the \(i^{\mbox{th}}\) row vector from \(A\) with (the transpose of) the \(j^{\mbox{th}}\) column vector from \(B\text{,}\) i.e.
Since \(A\) is a \(3 \times 2\) matrix and \(B\) is \(2\times 2\) then \(AB\) is defined since \(A\) has \(2\) columns and \(B\) has \(2\) rows. The resultant matrix will be a \(3 \times 2\) matrix since \(A\) has \(3\) rows and \(B\) has \(2\) columns. Thus \(AB\) will be of the form
From the definition of matrix multiplication the following properties can be shown to hold.
Theorem17.15.Properties of Matrix Multiplication.
Let \(A\text{,}\)\(B\) and \(C\) be appropriately sized matrices. Then
\(A(BC)=(AB)C \hspace{55mm}\) (Associative Law)
\(A(B+C) = AB + AC \hspace{42mm}\) (Left Distributive Law)
\((A+B)C = AC + BC \hspace{42mm}\) (Right Distributive Law)
\(\displaystyle k(AB) = (kA)B = A(kB)\)
\(I_mA = A = AI_n\) if \(A\) is an \(m \times n\) matrix\(\hspace{5mm}\) (Identity Law)
For later reference, some properties of the transpose of a matrix with respect to the various matrix operations that we have been discussing are listed below.
Theorem17.16.Properties of Matrix Transpose.
Let \(A\) and \(B\) be appropriately sized matrices. Then
\(\displaystyle (A^T)^T = A\)
\(\displaystyle (A+B)^T = A^T + B^T \)
\(\displaystyle (kA)^T = k(A^T) \)
\(\displaystyle (AB)^T = B^TA^T \)
\((A^r)^T = (A^T)^r \) where \(r \in \mathbb{N}\text{.}\)
Example17.17.
Confirm that \((AB)^T = B^T A^T\) holds for the matrices
We can now use the properties of matrix multiplication to establish some interesting facts about the solutions to systems of linear equations. For example:
Theorem17.19.
Consider the non-homogenous system of linear equations
If (17.1) has two distinct solutions then it has an infinite number of solutions.
If (17.1) has a unique solution then (17.2) has only the trivial solution \(\mathbf{x}=\mathbf{0}\text{.}\)
If (17.1) has an infinite number of solution then so does (17.2).
Proof.
Let \(\mathbf{x} = \mathbf{u}\) and \(\mathbf{x} = \mathbf{v}\) be two distinct solutions to (17.1) and let \(\mathbf{w} = \mathbf{u} − \mathbf{v}\text{.}\) By using the properties of matrix multiplication we can see that
and so \(\mathbf{x} = \mathbf{u} + \mathbf{v}\) is another solution to (17.1), which is not possible. Thus there cannot be any non-zero solutions to (17.2).
Since (17.1) has an infinite number of solutions let \(\mathbf{x} = \mathbf{u}\) and \(\mathbf{x} = \mathbf{v}\) be two distinct solutions to (17.1). Now let \(\mathbf{w} = \mathbf{u} − \mathbf{v}\) and \(t \in \mathbb{R}\text{.}\) Then
i.e. there are an infinite number of solutions to (17.2).
Note that these arguments are general and hold for any system of \(m\) linear equations in \(n\) variables. Note also that if the system consists of \(3\) linear equations in \(3\) variables then result (17.2) above can be stated as:
Remark17.20.
Consider the system of linear equations whose augmented matrix is
Show that \((1,1,0)\) is a solution to the system of equations.
Write down all solutions to the system of equations.
Section17.4Linear Transformations
There are many applications of matrices where we view the matrix as a transformation (or mapping) that takes one vector and transforms (or maps) it to another vector. So, if \(A\) is an \(m \times n\) matrix then \(A\) can be thought of as a transformation that takes the \(n \times 1\) vector \(x\) to the \(m \times 1\) vector \(\mathbf{b} = A\mathbf{x}\text{.}\)
Since \(A\) is a \(2 \times 2\) matrix, we can think of \(A\) as a transformation that takes each vector \(x\) in the plane to another vector in the plane, \(b = A\mathbf{x}\text{.}\) Under this transformation, for example, \(\mathbf{x} = \begin{pmatrix} 2 \\ 1 \end{pmatrix}\) goes to
In fact, \(A\) is the matrix for the transformation that we would describe as a reflection in the line \(y = x\text{.}\) To see this, let the vector \((x,y)\) be transformed to the vector \((b_1,b_2)\) under this reflection. Then we know that
\begin{align*}
b_1 \amp = y = 0x +y \\
b_2 \amp = x = 1x + 0y
\end{align*}
Run the Sage cell below to see the effect of the rotation matrix \(A\) on some input (a sketch of a house).
Example17.24.
Determine the matrix for the transformation in which a reflection in the line \(y = x\) is followed by a rotation about the origin through \(\pi^c\text{.}\)
Let \(A_1 = \begin{pmatrix} 0 \amp 1 \\ 1 \amp 0\end{pmatrix}\) and \(A_2 = \begin{pmatrix} -1 \amp 0 \\ 0 \amp -1 \end{pmatrix}.\) Then, under the given transformation the vector \(\mathbf{x}\) will be mapped to the vector \(\mathbf{b}\) where
we can see that the matrix \(A\) represents a reflection in the line \(y=-x\text{.}\)
Transformations that can be represented via a matrix are called linear transformations. When the matrix is a \(2 \times 2\) matrix the transformation is called a linear transformation of the plane.
Remark17.25.
Linear transformations in 3 dimensions are also possible. The Sage cell below plots the effect of a linear transformation on three unit vectors and the parallelepiped spanned by them.
ExercisesExample Tasks
1.
Which vectors are mapped to \(\begin{pmatrix} 1 \amp 1 \amp 0 \end{pmatrix}^T\) under the transformation whose matrix is
Find the matrix for the transformation of the plane in which a rotation about the origin through \(180^{\circ}\) is followed by a reflection in the line \(y = 2x\text{.}\)
3.
Find the vector to which \(\mathbf{x} = \begin{pmatrix}1 \\ 2\end{pmatrix}\) is mapped by \(\begin{pmatrix} 3 \amp 4 \\ 1 \amp 2 \end{pmatrix}\) followed by \(\begin{pmatrix}2 \amp 1 \\ 3 \amp 3 \end{pmatrix}\) followed by \(\begin{pmatrix}-1 \amp 1 \\ -1 \amp 0\end{pmatrix}.\)