
# 1.3: What is a Matrix?

Matrices are linear functions of a certain kind. One way to learn about them is by studying systems of linear equations

Example 4

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:

1. In terms of the number of apples and bananas.
2. 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 5: 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 6: 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 7

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} }.$$

$$\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} }$$
$$\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.