1.3: What is a Matrix?
- Page ID
- 1722
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Matrices are linear functions of a certain kind. One way to learn about them is by studying systems of linear equations.
Example \(\PageIndex{1}\):
A room contains \(x\) bags and \(y\) boxes of fruit:
Each bag contains 2 apples and 4 bananas and each box contains 6 apples and 8 bananas. There are 20 apples and 28 bananas in the room. Find \(x\) and \(y\).
The values are the numbers \(x\) and \(y\) that simultaneously make both of the following equations true:
\begin{eqnarray*}
2\, x + 6\, y & = & 20 \\
4\, x + 8\, y & = & 28\, .
\end{eqnarray*}
Here we have an example of a \(\textit{System of Linear Equations}\). It's a collection of equations in which variables are multiplied by constants and summed, and no variables are multiplied together: There are no powers of variables greater than one (like \(x^2\) or \(b^5\)), non-integer or negative powers of variables (like \(y^{-1/2}\) or \(a^{\pi}\)), and no places where variables are multiplied together (like \(ab\) or \(xy\)).
Information about the fruity contents of the room can be stored two ways:
- In terms of the number of apples and bananas.
- In terms of the number of bags and boxes.
Intuitively, knowing the information in one form allows you to figure out the information in the other form.
Going from (ii) to (i) is easy:
If you knew there were 3 bags and 2 boxes it would be easy to calculate the number of apples and bananas, and doing so would have the feel of multiplication (containers times fruit per container). In the example above we are required to go the other direction, from (i) to (ii). This feels like the opposite of multiplication, \(\textit{i.e.}\), division. Matrix notation will make clear what we are "dividing'' by.
The goal of Chapter 2 is to efficiently solve systems of linear equations. Partly, this is just a matter of finding a better notation, but one that hints at a deeper underlying mathematical structure. For that, we need rules for adding and scalar multiplying 2-vectors:
\[
c\begin{pmatrix}x\\ y\end{pmatrix}:=\begin{pmatrix}cx\\ cy\end{pmatrix} \mbox{ and } \begin{pmatrix}x\\ y\end{pmatrix}+\begin{pmatrix}x'\\ y'\end{pmatrix}:=\begin{pmatrix}x+x'\\ y+y'\end{pmatrix}.
\]
Writing our fruity equations as an equality between 2-vectors and then using these rules we have:
\[\left.\begin{matrix}2x+6y=20\\ 4x+8y=28\end{matrix}\right\} \Leftrightarrow \begin{pmatrix}2x+6y\\ 4x+8y\end{pmatrix} = \begin{pmatrix}20\\ 28\end{pmatrix} \Leftrightarrow x\begin{pmatrix}2\\ 4\end{pmatrix} + y\begin{pmatrix}6\\ 8\end{pmatrix} = \begin{pmatrix}20\\ 28\end{pmatrix}.\]
Now we introduce an operator which takes in 2-vectors and gives out 2-vectors. We denote it by an array of numbers called a \(\textit {matrix}\).
The function \(\begin{pmatrix}2 & 6\\ 4 & 8\end{pmatrix}\) is defined by \(\begin{pmatrix}2 & 6\\ 4 & 8\end{pmatrix} \begin{pmatrix}x\\ y\end{pmatrix} := x\begin{pmatrix}2\\ 4\end{pmatrix} + y\begin{pmatrix}6\\ 8\end{pmatrix}\).
A similar definition applies to matrices with different numbers and sizes:
Example \(\PageIndex{2}\): A bigger matrix
\[
\begin{pmatrix}1&0&3&4\\
5&0&3&4\\
-1&6&2&5
\end{pmatrix}
\begin{pmatrix}x\\y\\z\\w\end{pmatrix}
:= x
\begin{pmatrix}1\\5\\-1
\end{pmatrix}
+y
\begin{pmatrix}0\\0\\6
\end{pmatrix}
+z
\begin{pmatrix}3\\3\\2
\end{pmatrix}
+w\begin{pmatrix}4\\4\\5
\end{pmatrix}\, .
\]
Viewed as a machine that inputs and outputs 2-vectors, our \(2\times2\) matrix does the following:
\(\begin{pmatrix}x\\y\end{pmatrix}\)\(\begin{pmatrix}2x+6y\\4x+8y\end{pmatrix}\).
Our fruity problem is now rather concise.
Example \(\PageIndex{3}\): This time in purely mathematical language
What vector \(\begin{pmatrix}x \\ y\end{pmatrix}\) satisfies
\(
\begin{pmatrix}
2 & 6 \\
4 & 8
\end{pmatrix}
\begin{pmatrix}x \\ y\end{pmatrix}
= \begin{pmatrix}20 \\ 28\end{pmatrix}
\)?
Solution
This is of the same \(Lv=w\) form as our opening examples. The matrix encodes fruit per container. The equation is roughly fruit per container times number of containers. To solve for fruit we want to "divide" by the matrix.
Another way to think about the above example is to remember the rule for multiplying a matrix times a vector. If you have forgotten this, you can actually guess a good rule by making sure the matrix equation is the same as the system of linear equations. This would require that
$$
\begin{pmatrix}
2 & 6 \\
4 & 8
\end{pmatrix}
\begin{pmatrix}x \\ y\end{pmatrix}
:= \begin{pmatrix}2x+6y \\ 4x+8y\end{pmatrix}
\]
Indeed this is an example of the general rule that you have probably seen before
\[
\begin{pmatrix}
p & q \\
r & s
\end{pmatrix}
\begin{pmatrix}x \\ y\end{pmatrix}
:=
\begin{pmatrix}px+qy \\ rx+sy\end{pmatrix}=x\begin{pmatrix}p\\r\end{pmatrix} + y\begin{pmatrix}q\\s\end{pmatrix} .
\]
Notice, that the second way of writing the output on the right hand side of this equation is very useful because it tells us what all possible outputs a matrix times a vector look like -- they are just sums of the columns of the matrix multiplied by scalars. The set of all possible outputs of a matrix times a vector is called the \(\textit{column space}\) (it is also the image of the linear function defined by the matrix).
A matrix is an example of a \(\textit{Linear Function}\), because it takes one vector and turns it into another in a "linear'' way. Of course, we can have much larger matrices if our system has more variables.
Matrices are linear functions. The statement of this for the matrix in our fruity example looks like
1. \(\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
c \begin{pmatrix}x \\ y\end{pmatrix}
=c \begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}a \\ b\end{pmatrix} and \)
2. \(\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\left[ \begin{pmatrix}x \\ y\end{pmatrix} +\begin{pmatrix}x' \\ y'\end{pmatrix} \right]
= \begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}x \\ y\end{pmatrix}
+
\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}x' \\ y'\end{pmatrix}
\)
These equalities can already be verified using only the rules we introduced so far.
Example \(\PageIndex{4}\):
Verify that \(\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}\) is a linear operator.
Homogeneity:
\[\begin{pmatrix}2&6\\4&8\end{pmatrix}\left[c\begin{pmatrix}a\\b\end{pmatrix}\right] = \begin{pmatrix}2&6\\4&8\end{pmatrix}\begin{pmatrix}ca\\cb\end{pmatrix} = ca\begin{pmatrix}2\\4\end{pmatrix} + cb\begin{pmatrix}6\\8\end{pmatrix} = \begin{pmatrix}2ac\\4ac\end{pmatrix} + \begin{pmatrix}6bc\\8bc\end{pmatrix} = \underline{\begin{pmatrix}2ac+6bc\\4ac+8bc\end{pmatrix}}.\]
which ought (and does) give the same result as
\[c\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}a \\ b\end{pmatrix}
=
c\left[ a \begin{pmatrix}2 \\ 4\end{pmatrix}
+
b \begin{pmatrix}6 \\ 8\end{pmatrix} \right]
= c\left[\begin{pmatrix}2a\\4a\end{pmatrix}+\begin{pmatrix}6b\\8b\end{pmatrix}\right] = c\begin{pmatrix}2a+6b\\4a+8b\end{pmatrix} = \underline{\begin{pmatrix}2ac+6bc\\4ac+8bc\end{pmatrix} }.\]
Additivity:
$$\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\left[ \begin{pmatrix}a \\ b\end{pmatrix} + \begin{pmatrix}c \\ d\end{pmatrix} \right]
=
\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}a +c\\ b+d\end{pmatrix}
=
(a+c) \begin{pmatrix}2 \\ 4\end{pmatrix}
+
(b+d) \begin{pmatrix}6 \\ 8\end{pmatrix}
=
\begin{pmatrix}2(a+c) \\ 4(a+c)\end{pmatrix}
+
\begin{pmatrix}6(b+d) \\ 8(b+d)\end{pmatrix}\]
\[ = \underline{ \begin{pmatrix}2a+2c +6b+6d\\ 4a+4c+8b+8d\end{pmatrix} }\]
which we need to compare to
\[\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}a \\ b\end{pmatrix}
+
\begin{pmatrix}
2 &6 \\
4 &8
\end{pmatrix}
\begin{pmatrix}c \\ d\end{pmatrix}
=
a\begin{pmatrix}2\\4\end{pmatrix} + b\begin{pmatrix}6\\ 8\end{pmatrix} + c\begin{pmatrix}2\\4\end{pmatrix} +d\begin{pmatrix}6\\8\end{pmatrix} = \begin{pmatrix}2a\\4a\end{pmatrix} + \begin{pmatrix}6b\\ 8b\end{pmatrix} + \begin{pmatrix}2c\\4c\end{pmatrix} +\begin{pmatrix}6d\\8d\end{pmatrix}$$
$$ = \underline{\begin{pmatrix}2a+2c +6b+6d\\ 4a+4c+8b+8d\end{pmatrix} }.\]
We have come full circle; matrices are just examples of the kinds of linear operators that appear in algebra problems like those in section 1.2. Any equation of the form \(Mv=w\) with \(M\) a matrix, and \(v,w\) \(n\)-vectors is called a \(\textit {matrix equation}\). Chapter 2 is about efficiently solving systems of linear equations, or equivalently matrix equations.
Contributor
David Cherney, Tom Denton, and Andrew Waldron (UC Davis)