Skip to main content

Section 2.7 Matrices

Definition 2.7.1. Real matrices.

Let \(m,n\in\N.\) An \(m\times n\,\) matrix \(\,\A\) is a rectangular array or real numbers with \(m\) rows and \(n\) columns. We write \(\A\in\R^{m\times n}.\) The matrix \(\A\) can be expressed as
\begin{align*} \amp \left(\begin{array}{cccc}A_{11}\amp A_{12}\amp \cdots\amp A_{1n}\\A_{21}\amp A_{22}\amp \cdots\amp A_{2n}\\\vdots\amp \amp \ddots\amp \vdots\\ A_{n1}\amp \cdots\amp \cdots\amp A_{nn}\\\vdots\amp \amp \amp \vdots\\A_{m1}\amp \cdots\amp \cdots\amp A_{mn} \end{array} \right)\,\left(\begin{array}{cccccc}A_{11}\amp A_{12}\amp \cdots\amp A_{1m}\amp \cdots\amp A_{1n}\\ A_{21}\amp A_{22}\amp \cdots\amp A_{2m}\amp \cdots\amp A_{2n}\\ \vdots\amp \amp \ddots\amp \vdots\amp \amp \\ A_{m1}\amp \cdots\amp \cdots\amp A_{mm}\amp \cdots\amp A_{mn} \end{array} \right) \amp\\ \amp\amp\\ \amp\qquad\!\qquad\text{when } m>n\quad\qquad\qquad\qquad\qquad\text{when } m\lt n \amp \end{align*}
\begin{align*} \amp \amp \amp \amp \amp \left(\begin{array}{cccc}A_{11}\amp A_{12}\amp \cdots\amp A_{1n}\\ A_{21}\amp A_{22}\amp \cdots\amp A_{2n}\\\vdots\amp \amp \ddots\amp \vdots\\ A_{n1}\amp \cdots\amp \cdots\amp A_{nn} \end{array} \right) \amp\\ \amp \amp \amp \amp \amp \amp\\ \amp \amp \amp \amp \amp \qquad\quad\text{when } m=n\amp \end{align*}
For each \(i=1,2,\ldots,m,\,j=1,2,\ldots,n,A_{ij}\) is called the \(ij^{\text{ th}}\) entry of \(\A.\) On rare occasions, when the notation demands we will write \(A_{i,j}\) rather than \(A_{ij}.\)
For each \(i=1,\ldots,m\) the \(i^{\text{ th}}\) row of \(\A\) is a vector in \(\R^n,\) denoted \(\A_{i\ast}.\)
For each \(j=1,\ldots,n\) the \(j^{\text{ th}}\) column of \(\A\) is a vector in \(\R^m,\) denoted \(\A_{\ast j}.\)
The row vector \(\A_{i\ast}\) and the column vector \(\A_{\ast j}\) are the only vectors we’ll write without arrows.
Each \(A_{ij}\) is the unique entry found in both \(\A_{i\ast}\) and \(\A_{\ast j}.\)
We may express \(\A\) entry-wise as \(\A=\left(A_{ij}\right)\) if \(m,n\) are unambiguous from the context and \(\A=\left(A_{ij}\right)_{i,j=1}^{m,n}\) if we want to be explicit.
Whenever we state \(\A\in\R^{m\times n}\) we always assume \(m,n\in\N.\)

Example 2.7.2. Formulaic matrices.

In \(\R^{2\times3},\)
\begin{equation*} (i+j)=\left(\begin{array}{c}2\amp3\amp4\\3\amp4\amp5\end{array}\right). \end{equation*}
As another example we have
\begin{equation*} \Bigl(i\cdot j\Bigr)_{i,j=1}^{4,5}=\left(\begin{array}{r}1\amp2\amp3\amp4\amp5\\2\amp4\amp6\amp8\amp10\\3\amp6\amp9\amp12\amp15\\4\amp8\amp12\amp16\amp20\end{array}\right). \end{equation*}

Definition 2.7.3. Matrix equality.

Two matrices \(\A,\B\in\R^{m\times n}\) are equal if \(A_{ij}=B_{ij}\) for all \(i=1,\ldots,m\) and \(j=1,\ldots,n.\)

Definition 2.7.4. The zero matrix.

We will denote the \(m \times n\) matrix with all zero entries as \(\boldsymbol{0}_{m \times n}.\)

Definition 2.7.5. Square matrices.

A matrix \(\A\in\R^{m\times n}\) is called square if \(m=n.\)

Definition 2.7.6. Diagonal matrices.

A square matrix with only \(0'\)s off the diagonal \(i=j\) is called a diagonal matrix; we will always denote diagonal matrices by \(\D\) with
\begin{equation*} \D=\left(\begin{array}{cccc}D_{11}\amp 0\amp \cdots\amp 0\\0\amp D_{22}\amp \cdots\amp 0\\\vdots\amp \amp \ddots\amp \vdots\\0\amp \cdots\amp \cdots\amp D_{nn}\end{array}\right) \end{equation*}
where each of the \(D_{ii}\) may be any real number.
A vector is a matrix! Note that by Definition 2.7.1 we can represent a column vector of length \(n\) as an \(n\times 1\) matrix, and we can represent a row vector of length \(n\) as a \(1\times n\) matrix.

Definition 2.7.7. Matrix addition.

Suppose that matrices \(\A,\B\in\R^{m \times n}.\) Then the sum \(\A+\B\) is defined entry-wise as \((\A+\B)_{ij}=(A_{ij}+B_{ij}).\) The matrix sum is not defined for matrices of different sizes.

Example 2.7.8. Matrix Addition.

\begin{equation*} \left( \begin{array}{rr} 1 \amp 2 \\ 3 \amp -1 \end{array} \right) + \left( \begin{array}{rr} -1 \amp 0 \\ 2 \amp 5 \end{array} \right)=\left( \begin{array}{cc} 1+(-1) \amp 2+0 \\ \!\!3+2\, \amp -1+5 \end{array} \right)=\left( \begin{array}{rr} 0 \amp 2 \\ 5 \amp 4 \end{array} \right) \end{equation*}
Matrix addition is commutative since it is defined as entry-wise addition and addition of real numbers is commutative.

Definition 2.7.9. Scalar-matrix multiplication.

The left- or right-multiplication of \(\A\in\R^{m \times n}\) by a scalar \(s\in\R,\) denoted \(s\A\) or \(\A s\) respectively, is defined entry-wise and hence \(s\A=(sA_{ij})=\A s.\)

Example 2.7.10. Scalar-matrix multiplication.

\begin{equation*} 5\left(\begin{array}{rr}1\amp2\\3\amp-1\end{array}\right)=\left(\begin{array}{rr}5\amp10\\15\amp-5\end{array}\right). \end{equation*}

Definition 2.7.11. Matrix multiplication.

Suppose \(\A\in\R^{m\times n}\) and \(\B\in\R^{n\times p}\text{;}\) that is, suppose \(\A\) and \(\B\) are matrices with the number of columns of \(\A\) equal to the number of rows of \(\B.\) 
Then the product \(\A\B\in\R^{m\times p}\) is defined entry-wise via inner products as
\begin{equation*} (\A\B)_{ij}:=\dpr{\A_{i\ast}}{\B_{\ast j}}=\sum_{k=1}^nA_{ik}B_{kj}. \end{equation*}

Remark 2.7.12. Interpretations of matrix multiplication.

Let \(\A\in\R^{m\times n},\,\B\in\R^{n\times p},\) and \(\C\in\R^{\l\times m}.\) We focus on the matrix \(\A,\) and in particular the role of its rows and columns in 1) right-multiplication by \(\B\) and 2) left-multiplication by \(\C.\) 
  1. First we interpret the columns of the product \(\A\B\) in terms of the columns of \(\A\) and then in terms of of the rows of \(\A.\)
    The \(j^{\text{th}}\) column of the product \(\A\B\) is a linear combination of the columns of \(\A,\) whose coefficients come from the \(j^{\text{th}}\) column \(\B_{\ast j}\) of \(\B:\)
    \begin{align} \left(\A\B\right)_{\ast j}\amp=\begin{pmatrix}|\amp |\amp \amp |\\\A_{\ast1}\amp \A_{\ast2}\amp \cdots\amp \A_{\ast n}\\|\amp |\amp \amp | \end{pmatrix} \left(\begin{array}{c}|\\\B_{\ast j}\\|\end{array}\right)\notag\\ \notag\\ \amp=\begin{pmatrix}|\amp |\amp \amp |\\\A_{\ast1}\amp \A_{\ast2}\amp \cdots\amp \A_{\ast n}\\|\amp |\amp \amp | \end{pmatrix} \begin{pmatrix}B_{1j}\\B_{2j}\\\vdots\\B_{nj}\end{pmatrix}\notag\\ \notag\\ \amp=B_{1j}\A_{\ast1}+B_{2j}\A_{\ast2}+\cdots+B_{nj}\A_{\ast n}.\tag{2.7.1} \end{align}
    Right-multiplication of \(\A\) by \(\B\) has the effect of replacing the columns of \(\A\) with linear combinations of the columns of \(\A\) whose coefficients come from the columns of \(\B.\)
    Alternatively, the \(j^{\text{th}}\) column of the matrix product \(\A\B\) is comprised of dot products of each of the rows of \(\A\) with the \(j^{\text{th}}\) column of \(\B:\)
    \begin{align} \left(\A\B\right)_{\ast j}\amp=\begin{pmatrix}\,\,-\amp \A_{1\ast}\amp -\,\,\\\,\,-\amp \A_{2\ast}\amp -\,\,\\\amp \vdots\amp \\\,\,-\amp \A_{m\ast}\amp-\,\,\end{pmatrix} \left(\begin{array}{c}|\\\B_{\ast j}\\|\end{array}\right)\notag\\ \notag\\ \amp=\begin{pmatrix}\A_{1\ast}\cdot \B_{\ast j}\\\A_{2\ast}\cdot \B_{\ast j}\\\vdots\\\A_{m\ast}\cdot \B_{\ast j}\\ \end{pmatrix}.\tag{2.7.2} \end{align}
  2. Now we interpret the rows of the product \(\C\A\) in terms of the columns of \(\A\) and then in terms of of the rows of \(\A.\)
    The \(i^{\text{th}}\) row of the product \(\C\A\) is a linear combination of the rows of \(\A,\) with coefficients from the \(i^{\text{th}}\) row of \(\C:\)
    \begin{align} \left(\C\A\right)_{i\ast}\amp=\left(\,\,-\,\,\,\C_{i\ast}\,\,\,-\,\,\right)\,\begin{pmatrix}\,\,-\amp \A_{1\ast}\amp -\,\,\\\,\,-\amp \A_{2\ast}\amp -\,\,\\\amp \vdots\amp \\\,\,-\amp \A_{m\ast}\amp-\,\,\end{pmatrix}\notag\\ \notag\\ \amp=\left(\,C_{i1}\,\,C_{i2}\,\,\cdots\,\,C_{in}\,\right)\,\begin{pmatrix}\,\,-\amp \A_{1\ast}\amp -\,\,\\\,\,-\amp \A_{2\ast}\amp -\,\,\\\amp \vdots\amp \\\,\,-\amp \A_{m\ast}\amp-\,\,\end{pmatrix}\notag\\ \notag\\ \amp=C_{i1}\A_{1\ast}+C_{i2}\A_{2\ast}+\cdots C_{in}\A_{n\ast}.\tag{2.7.3} \end{align}
    Left-multiplication of \(\A\) by \(\C\) has the effect of replacing the rows of \(\A\) with linear combinations of the rows of \(\A\) whose coefficients come from the rows of \(\B.\)
    Alternatively, the \(i^{\text{th}}\) row of the product \(\C\A\) is comprised of dot products of the \(i^{\text{th}}\) row of \(\C\) with each of the columns of \(\A:\)
    \begin{align*} \!\!\!\!\!\!\!\!\left(\C\A\right)_{i\ast}\amp=\left(\,\,-\,\,\,\C_{i\ast}\,\,\,-\,\,\right)\,\begin{pmatrix}|\amp |\amp \amp |\\\A_{\ast1}\amp \A_{\ast2}\amp \cdots\amp \A_{\ast n}\\|\amp |\amp \amp | \end{pmatrix}\\ \\ \amp=\left(\dpr{\C_{i\ast}}{\A_{\ast1}}\,\,\,\quad\dpr{\C_{i\ast}}{\A_{\ast2}}\,\,\,\quad\cdots\,\,\,\quad\dpr{\C_{i\ast}}{\A_{\ast n}}\right) \end{align*}
    which is a row vector of dot products of the \(i^{\text{th}}\) row \(\C_{i\ast}\) of \(\C\) with each of the columns of \(\A.\)
Matrix multiplication is not commutative in general. Matrix multiplication is not generally commutative. In Example 2.7.13 below we offer examples of how to compute matrix products while illustrating the extent of the non-commutative nature of matrix multiplication. We will consider five matrices \(\A,\B,\C,\D,\) and \(\E\) for which
  • \(\A\B\) and \(\B\A\) are both defined but are different sizes,
  • \(\A\C\) is defined but \(\C\A\) is not defined, and
  • \(\D\E\) and \(\E\D\) are both defined and are the same sizes but are not equal.

Example 2.7.13. Matrix multiplication.

Let \(\A=\left(\begin{array}{rrr}-5\amp 8\amp -1\\2\amp 0\amp 5 \end{array}\right)\) and \(\B=\left(\begin{array}{rr}3\amp -1\\2\amp 2\\3\amp 7\end{array}\right).\)
Viewing the entries of the product matrix multiplication \(\A\B\) as dot products of the rows of \(\A\) with the columns of \(\B\) (and vice-versa for \(\B\A\)) we have
\begin{align*} \A\B=\amp\left(\begin{array}{cc}-5\cdot3+8\cdot2+-1\cdot3\amp -5\cdot-1+8\cdot2+-1\cdot7\\\,\,\,2\cdot3+0\cdot2+5\cdot3\amp\,2\cdot-1+0\cdot2+5\cdot7\,\,\end{array} \right)\\ =\amp\left(\begin{array}{rr}-2\amp 14\\21\amp 33\end{array}\right)\\ \\ \B\A=\amp\left(\begin{array}{ccc}-5\cdot3+2\cdot-1\amp8\cdot3+0\cdot-1\amp-1\cdot3+5\cdot-1\\-5\cdot2+2\cdot2\amp8\cdot2+0\cdot2\amp-1\cdot2+5\cdot2\\-5\cdot3+2\cdot7\amp8\cdot3+0\cdot7\amp-1\cdot3+5\cdot7\end{array}\right)\\ =\amp\left(\begin{array}{rrr}-17\amp 24\amp-8\\-6\amp16\amp8\\-1\amp24\amp32\end{array}\right). \end{align*}
Alternatively, viewing matrix multiplication as generating the two columns of the product of \(\A\B\) by linear combinations of the columns of \(\A\) with coefficients from the columns of \(\B\) we have
\begin{align*} \A\B=\amp\left(3\!\left(\begin{array}{r}-5\\2\end{array}\right)+2\!\left(\begin{array}{r}8\\0\end{array}\right)+3\!\left(\begin{array}{r}-1\\5\end{array}\right)\quad-1\!\left(\begin{array}{r}-5\\2\end{array}\right)+2\!\left(\begin{array}{r}8\\0\end{array}\right)+7\!\left(\begin{array}{r}-1\\5\end{array}\right)\right)\\ =\amp\left(\begin{array}{rr}-2\amp 14\\21\amp 33\end{array}\right)\\ \\ \B\A=\amp\left(\!-5\!\left(\begin{array}{r}3\\2\\3\end{array}\right)\!+\!2\!\left(\begin{array}{r}-1\\2\\7\end{array}\right)\quad\, 8\!\left(\begin{array}{r}3\\2\\3\end{array}\right)\!+\!0\!\left(\begin{array}{r}-1\\2\\7\end{array}\right)\quad-1\!\left(\begin{array}{r}3\\2\\3\end{array}\right)\!+\!5\!\left(\begin{array}{r}-1\\2\\7\end{array}\right)\!\right)\\ =\amp\left(\begin{array}{rrr}-17\amp 24\amp-8\\-6\amp16\amp8\\-1\amp24\amp32\end{array}\right). \end{align*}
This example shows that for \(\A\) and \(\B\) for which \(\A\B\) and \(\B\A\) are both defined, the two products need not be the same size.
Now let \(\C=\left(\begin{array}{rrr}3\amp -1\amp 4\\2\amp 2\amp-5\\3\amp 7\amp 0\end{array}\right).\) We have
\begin{align*} \A\C=\amp\left(\begin{array}{cc}-5\cdot3+8\cdot2+-1\cdot3\amp -5\cdot-1+8\cdot2+-1\cdot7\\\,\,\,2\cdot3+0\cdot2+5\cdot3\amp\,2\cdot-1+0\cdot2+5\cdot7\end{array}\right.\\ \amp\qquad\qquad\qquad\qquad\qquad\qquad\left.\begin{array}{c}-5\cdot4+8\cdot-5+-1\cdot0\\\,\,\,2\cdot4+0\cdot-5+5\cdot0\end{array}\right)\\ =\amp\left(\begin{array}{ccc}-2\amp 14\amp-60\\21\amp 33\amp 8\end{array}\right)\\ =\amp\left(3\!\left(\begin{array}{r}-5\\2\end{array}\right)+2\!\left(\begin{array}{r}8\\0\end{array}\right)+3\!\left(\begin{array}{r}-1\\5\end{array}\right)\quad-1\!\left(\begin{array}{r}-5\\2\end{array}\right)+2\!\left(\begin{array}{r}8\\0\end{array}\right)+7\!\left(\begin{array}{r}-1\\5\end{array}\right)\right.\\ \amp\qquad\qquad\qquad\qquad4\!\left.\left(\begin{array}{r}-5\\2\end{array}\right)-5\!\left(\begin{array}{r}8\\0\end{array}\right)+0\!\left(\begin{array}{r}-1\\5\end{array}\right)\right) \end{align*}
The point of calculating \(\A\C\) is not so much to show an additional example of how to multiply matrices, rather it is to note that although we may be able to calculate \(\A\C,\) it is possible that the product \(\C\A\) does not even exist (since the number of columns of \(\B\) is not the same as the number of rows of \(\A\)).
From the above examples we see that matrix multiplication is so non-commutative that \(\A\B\) and \(\B\A\) may not even be the same types of objects, or one product may be defined while the other is not. But even if both \(\A\B\) and \(\B\A\) are defined and the same size, they need not be equal.
Let \(\D=\left(\begin{array}{rr}6\amp -5\\2\amp 3\end{array} \right)\) and \(\E=\left(\begin{array}{rr}1\amp -2\\8\amp 7\end{array} \right).\) Then as the reader may check
\begin{align*} \D\E=\amp\left(\begin{array}{rr}-34\amp -47\\26\amp 17\end{array}\right)\qquad\text{while}\\ \E\D=\amp\left(\begin{array}{rr}2\amp -11\\62\amp -19\end{array}\right)\quad\ne\quad\D\E. \end{align*}
Since matrix multiplication is not commutative it is important to respect the order in which the matrices are multiplied when multiplying any two distinct matrices.

Remark 2.7.14. Interpretations of matrix-vector multiplication.

Let \(\A\in\R^{m\times n},\,\x\in\R^n:=\R^{n\times1},\) and \(\y\in\R^m:=\R^{1\times m}.\) We may use Remark 2.7.12 to interpret the matrix-vector multiplications \(\A\x\) and \(\y\A.\) For \(\A\x\) we have
\begin{equation*} \begin{pmatrix}|\amp |\amp \amp |\\\!\A_{\ast1}\!\!\amp\!\!\A_{\ast2}\!\!\amp\!\!\cdots\!\!\amp\!\!\A_{\ast n}\!\!\\|\amp |\amp \amp | \end{pmatrix} \begin{pmatrix}x_1\\x_2\\\vdots\\x_n \end{pmatrix} =x_1\!\left(\begin{array}{c}|\\\!\!\A_{\ast1}\!\!\\|\end{array}\right)+x_2\!\left(\begin{array}{c}|\\\!\!\A_{\ast2}\!\!\\|\end{array}\right)+\cdots+x_n\!\left(\begin{array}{c}|\\\!\!\A_{\ast n}\!\!\\|\end{array}\right) \end{equation*}
or
\begin{equation*} \begin{pmatrix}-\amp \A_{1\ast}\amp -\\-\amp \A_{2\ast}\amp -\\\amp \vdots\amp \\-\amp \A_{m\ast}\amp - \end{pmatrix} \begin{pmatrix}x_1\\x_2\\\vdots\\x_n \end{pmatrix} =\begin{pmatrix}-\amp \A_{1\ast}\amp -\\-\amp \A_{2\ast}\amp -\\\amp \vdots\amp \\-\amp \A_{m\ast}\amp - \end{pmatrix} \,\,\x=\begin{pmatrix}\A_{1\ast}\cdot\x\\\A_{2\ast}\cdot\x\\\vdots\\\A_{m\ast}\cdot\x\\ \end{pmatrix}. \end{equation*}
For \(\y\A\) we have
\begin{align} \amp\,\,\left(\,\,-\,\,\,\y\,\,\,-\,\,\right)\,\begin{pmatrix}\,\,-\amp \A_{1\ast}\amp -\,\,\\\,\,-\amp \A_{2\ast}\amp -\,\,\\\amp \vdots\amp \\\,\,-\amp \A_{m\ast}\amp-\,\,\end{pmatrix}\notag\\ \notag\\ =\amp\,\,\left(\,y_1\,\,y_2\,\,\cdots\,\,y_n\,\right)\,\begin{pmatrix}\,\,-\amp \A_{1\ast}\amp -\,\,\\\,\,-\amp \A_{2\ast}\amp -\,\,\\\amp \vdots\amp \\\,\,-\amp \A_{m\ast}\amp-\,\,\end{pmatrix}\notag\\ \notag\\ =\amp\,\,y_1\A_{1\ast}+y_2\A_{2\ast}+\cdots y_n\A_{n\ast}\notag \end{align}
or
\begin{align} \amp\,\,\left(\,\,-\,\,\,\y\,\,\,-\,\,\right)\,\begin{pmatrix}|\amp |\amp \amp |\\\A_{\ast1}\amp \A_{\ast2}\amp \cdots\amp \A_{\ast n}\\|\amp |\amp \amp | \end{pmatrix}\notag\\ \notag\\ =\amp\,\,\left(\dpr{\y}{\A_{\ast1}}\,\,\,\quad\dpr{\y}{\A_{\ast2}}\,\,\,\quad\cdots\,\,\,\quad\dpr{\y}{\A_{\ast n}}\right).\notag \end{align}
We see that taking linear combinations of the columns or rows of \(\A\) can always be accomplished by matrix-vector multiplication.
Consistent with Remark 2.7.12, matrices, vectors, and scalars interact in arithmeically simple, linear ways. Specifically, matrix multiplication preserves the structure of linear combinations as seen in the next theorem. The proof is left as an exercise.

Proof.

The proof is left an as exercise.
Any operation, including matrix mutiplication, which preserves the structure of linear combinations (that is, preserves linearity) is called a linear operation. This property of preserving linearity is precisely the reason why we call the field linear algebra.

Remark 2.7.16. Matrices and linear systems.

Matrices give us an efficient way to represent a system of linear equations. By Definition 2.7.11 the linear system of equations
\begin{align*} x\,-\,\,y+2z+3w\amp =\,2\\ x+3y+2z+4w\amp =\,5\\ 4x+6y+8z+6w\amp =14 \end{align*}
can be expressed as
\begin{equation*} \left(\begin{array}{rrrr}1\amp -1\amp 2\amp 3\\1\amp 3\amp 2\amp 4\\4\amp 6\amp 8\amp 6 \end{array} \right)\begin{pmatrix} x\\y\\z\\w\end{pmatrix}=\begin{pmatrix} 2\\5\\14\end{pmatrix}\text{.} \end{equation*}
If we let \(\A = \left(\begin{array}{rrrr}1\amp -1\amp 2\amp 3\\1\amp 3\amp 2\amp 4\\4\amp 6\amp 8\amp 6 \end{array} \right),\) \(\,\x=\begin{pmatrix}x\\y\\z\\w \end{pmatrix}\) and \(\b=\begin{pmatrix}2\\5\\14\end{pmatrix},\) then we may write the linear system in the compact form \(\A\x=\b.\)

Definition 2.7.17. Mappings.

For a given \(\A\in\R^{m\times n}\) and variable \(\x\in\R^n\) we can interpret the matrix-vector multiplication \(\A\x\) as a function, customarily called a mapping \(\,\,T_\A:\R^n\rightarrow\R^m,\,\x\mapsto\A\x,\) meaning \(T_\A\left(\x\right)=\A\x\in\R^m.\) We say \(\A\,\,\) maps \(\,\,\x\) to \(\A\x.\)
When \(\A\) is the variable: Given an input vector \(\u\) and a target vector \(\v\) for the operation \(\A\u=\v\) we can find a matrix \(\A\) (often, many such matrices) for which \(\A\u=\v.\) We do this in the next two examples.

Example 2.7.18. Finding a matrix mapping a given \(\u\) to a given \(\v\).

For example, suppose we want to find a matrix \(\A\) that maps the vector \(\u=\left(\begin{array}{r}2\\-1\\4\end{array}\right)\in\R^3\) to \(\v=\lmatrix{r}1\\0\rmatrix.\)
Since \(\u\in\R^3\) and \(\v\in\R^2,\) in order for \(\A\u=\v\) we must have \(\A\in\R^{2\times3}.\) We can set up a system of equations and solve for the entries of \(\A\text{:}\)
\begin{equation*} \lmatrix{rrr} a \amp b \amp c \\ d \amp e \amp f \rmatrix \left(\begin{array}{r} 2 \\-1\\4 \end{array} \right)=\lmatrix{r} 1 \\ 0 \rmatrix \end{equation*}
\begin{align*} 2a-b+4c \amp =1\\ 2d - e+4f \amp =0 \end{align*}
Clearly this system is underdetermined and it is easy to find many solutions. One that works is \(a=c=e=0\) and \(b=-1, d=f=1\) giving \(\A=\lmatrix{rrr} 0 \amp -1 \amp 0 \\ -2 \amp 0 \amp 1\rmatrix.\)

Example 2.7.19. Finding a matrix which rotates a given \(\boldsymbol{\u\in\R^2}\) by a given angle \(\boldsymbol{\theta}\).

We can also use these ideas to find a matrix \(\A\) that rotates a vector. To illustrate, let’s find a matrix that rotates \(\lmatrix{r} x\\y \rmatrix\) counterclockwise about the origin by \(\pi/2\) radians.
Figure 2.7.20. A rotation of a vector counterclockwise about the origin by \(\pi/2\) radians
As we can see from the above figure, the matrix \(\A\in \R^{2 \times 2}\) must map \(\lmatrix{r} x\\y \rmatrix\) to \(\lmatrix{r} -y\\x\rmatrix.\) This means we need
\begin{equation*} \lmatrix{rr} a \amp b \\ c\amp d \rmatrix \left(\begin{array}{r} x\\y \end{array} \right)=\lmatrix{r} -y \\ x \rmatrix \end{equation*}
or
\begin{align*} ax+by \amp = -y\\ cx+dy \amp = x \end{align*}
By inspection we see that \(a=d=0, b=-1,\) and \(c=1\) gives the solution of \(\A=\lmatrix{rr} 0 \amp -1\\1 \amp 0\rmatrix.\)
Next, suppose we wish to find a matrix \(\A\) that rotates \(\lmatrix{r} x\\y\rmatrix\) counterclockwise about the origin by \(\pi/2\) radians.
Figure 2.7.21. A rotation of a vector counterclockwise about the origin by \(2\pi/3\) radians
It’s not as easy to determine what value a generic vector, \(\lmatrix{r}x\\y\rmatrix,\) will map to under this transformation as it was for a \(90^{\circ}\) rotation, but we have another way.
We know from homework problem Exercise 2.3.25 that any vector can be written as a linear combination of the canonical unit vectors of \(R^n.\) In particular, for \(\lmatrix{r}x\\y\rmatrix \in \R^2,\) we have \(\lmatrix{r}x\\y\rmatrix=x\lmatrix{r} 1\\0\rmatrix+y\lmatrix{r}0\\1\rmatrix.\)
If we can find the outcome of the rotation by \(2\pi/3\) radians on \(\lmatrix{r} 1\\0\rmatrix\) and \(\lmatrix{r}0\\1\rmatrix,\) then we know from Theorem 2.7.15 that
\begin{equation*} \A\lmatrix{r}x\\y\rmatrix=\A\left(x\lmatrix{r}1\\0\rmatrix+y\lmatrix{r}0\\1\rmatrix\right)=x\left(A\lmatrix{r} 1\\0\rmatrix\right)+y\left(\A\lmatrix{r}0\\1\rmatrix\right) \end{equation*}
and the matrix \(\A\) can be determined. We do that next.
Recalling the unit circle from trigonometry, we know that if we rotate \(\lmatrix{r}1\\0\rmatrix\) by \(2\pi/3\) radians counterclockwise about the origin we end up at \(\lmatrix{r} -1/2 \\ \sqrt{3}/2\rmatrix\) and \(\lmatrix{r}0\\1\rmatrix\) rotated by \(2\pi/3\) radians we land on \(\lmatrix{r} -\sqrt{3}/2 \\ -1/2 \rmatrix.\)
Figure 2.7.22. The rotation of \(\widehat{e_1}\) and \(\vec{e_2}\) by \(2\pi/3\) radians about the origin
Thus if we rotate \(\lmatrix{r} x\\y\rmatrix\) by \(2\pi/3\) we will get
\begin{gather*} \A\lmatrix{r}x\\y\rmatrix = x\left(A\lmatrix{r} 1\\0\rmatrix\right)+y\left(A\lmatrix{r}0\\1\rmatrix\right)=x\lmatrix{c} -1/2 \\ \sqrt{3}/2\rmatrix+y\lmatrix{r} -\sqrt{3}/2 \\ -1/2 \rmatrix\\ =\lmatrix{c} (-1/2)x-(\sqrt{3}/2)y \\ (\sqrt{3}/2)x - (1/2)y \rmatrix. \end{gather*}
Clearly we can take for our matrix
\begin{equation*} \A=\lmatrix{rr} -1/2 \amp -\sqrt{3}/2 \\ \sqrt{3}/2 \amp -1/2 \rmatrix \end{equation*}
But we may apply the above reasoning to counterclockwise rotation through an arbitrary angle \(\theta\) as well. Replacing \(2\pi/3\) by \(\theta\) in the above yields
\begin{equation} \A=\left(\begin{array}{rr}\cos\theta\amp-\sin\theta\\ \sin\theta\amp\cos\theta\end{array}\right).\tag{2.7.6} \end{equation}
Figure 2.7.23. Rotation of canoncial unit vectors counterclockwise by \(\theta\)
We’ll discuss this process more formally later in the text. The above examples above show how matrix multiplication by \(\A\) yields various mappings. We will revisit this particular notion in Chapter 9 when we discuss linear transformations.
Now that we understand how to perform matrix addition and matrix multiplication, and have an intuitive understanding of matrix multiplication, in the next section we explore matrix algebra further.