Back to the on-screen lesson ·

Linear maps and their matrices

The two conditions that make a map linear, the construction that turns a linear map into a matrix, the standard maps of the plane, and composition as a product.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to test a map for linearity by the two conditions and by the origin, build the standard matrix of a linear map by applying it to each basis vector in turn and writing the answers as columns, write down the matrices of the reflections, rotations, projections, shears and scalings of the plane without memorising any of them, compose two maps by multiplying their matrices in the order that puts the first map on the right, and recognise a translation and a squared coordinate as maps that are not linear at all.

2. What a matrix has been so far

Up to now a matrix has been a bookkeeping device: a system's coefficients, or a thing that multiplies a vector. This lesson turns the account round. The primary object is the map — a rule sending vectors to vectors — and the matrix is what you get by writing that rule down in a chosen basis. Everything you already know about matrix multiplication is about to acquire a reason.

3. The words this lesson uses

A map $T : V \to W$ sends each vector of $V$ to one vector of $W$; $V$ is the domain and $W$ the codomain. $T$ is linear when $T(u + v) = T(u) + T(v)$ for all $u, v$ and $T(cv) = cT(v)$ for every scalar $c$. The image of $v$ is $T(v)$. The standard matrix of a linear map of $\mathbb{R}^n$ to $\mathbb{R}^m$ is the $m \times n$ matrix $[T]$ with $T(x) = [T]x$ for every $x$. The composition $S \circ T$ means do $T$, then $S$.

4. Two rules, and the one construction that follows from them

$T$ is linear when it respects the two operations a vector space has: $T(u + v) = T(u) + T(v)$, and $T(cv) = cT(v)$. Both can be stated at once as $T(cu + dv) = cT(u) + dT(v)$: a linear map lets constants slide out and sums come apart.

Setting $c = 0$ in the scaling rule gives $T(0) = 0$. So a linear map fixes the origin, and any map that moves it — a translation, most obviously — is not linear, whatever else it does. This is the cheapest test there is and it settles a surprising number of cases.

Now the construction that makes matrices worth having. Write $x = (x_1, \dots, x_n)$ as $x_1e_1 + \dots + x_ne_n$, a combination of the standard basis vectors. Linearity gives

$$T(x) = x_1T(e_1) + x_2T(e_2) + \dots + x_nT(e_n).$$

Every value of $T$ is a combination of the $n$ vectors $T(e_1), \dots, T(e_n)$, with the coordinates of $x$ as the coefficients. That is precisely what a matrix times a vector computes. So if the $T(e_j)$ are written as the columns of a matrix $[T]$, then $T(x) = [T]x$ for every $x$ at once.

The columns of the matrix are the images of the basis vectors. A linear map on an $n$-dimensional space is determined by $n$ answers, and the matrix is nothing but those $n$ answers filed side by side.

Another way: picture

Draw the unit square with corners $0$, $e_1$, $e_2$ and $e_1 + e_2$. A linear map sends it to a parallelogram: the two sides from the origin are $T(e_1)$ and $T(e_2)$, and the fourth corner has to be their sum because linearity says so. Every picture of a linear map of the plane is that one picture — you choose where the two edges go, and everything else follows. There is no freedom left over, which is why two columns describe the map completely.

Another way: steps

  1. Check linearity if it is in doubt: does the map fix the origin, and can it be written as fixed coefficients times the input variables?
  2. Apply $T$ to $e_1$. Write the answer as a column.
  3. Apply $T$ to $e_2$, then $e_3$, and so on. Each answer is the next column.
  4. The matrix is $m \times n$: one row per output coordinate, one column per input variable.
  5. To compose, multiply — with the map applied first standing on the right.

5. The maps of the plane worth knowing on sight

Every one of these is built by the same two questions: where does $(1, 0)$ go, and where does $(0, 1)$ go?

Map$T(1,0)$$T(0,1)$Matrix
Scale by $k$$(k, 0)$$(0, k)$$\begin{pmatrix} k & 0 \\ 0 & k\end{pmatrix}$
Reflect in the $x$-axis$(1, 0)$$(0, -1)$$\begin{pmatrix} 1 & 0 \\ 0 & -1\end{pmatrix}$
Reflect in $y = x$$(0, 1)$$(1, 0)$$\begin{pmatrix} 0 & 1 \\ 1 & 0\end{pmatrix}$
Quarter turn anticlockwise$(0, 1)$$(-1, 0)$$\begin{pmatrix} 0 & -1 \\ 1 & 0\end{pmatrix}$
Project onto the $x$-axis$(1, 0)$$(0, 0)$$\begin{pmatrix} 1 & 0 \\ 0 & 0\end{pmatrix}$
Shear by $k$$(1, 0)$$(k, 1)$$\begin{pmatrix} 1 & k \\ 0 & 1\end{pmatrix}$

None of these is worth memorising, because all six are two applications of the map away. What is worth noticing is the projection: its second column is zero, because the map has thrown a whole direction away. A column of zeros is a direction the map cannot see, and that is the first hint of the next lesson.

6. Composition, and why the order reverses

Apply $T$ and then $S$. Then $(S \circ T)(x) = S(T(x)) = S([T]x) = [S]([T]x) = ([S][T])x$. So the matrix of the composition is $[S][T]$ — with the matrix of the map applied first written on the right.

That is not a convention to be memorised either. It follows from writing the vector on the right of its matrix: the vector meets the nearest matrix first, so the nearest matrix is the first map. If vectors were written as rows on the left, the order would be the other way, and some books do exactly that.

The consequence is that $AB$ and $BA$ describe different maps, and usually different ones. Reflect in the $x$-axis and then turn a quarter turn anticlockwise, and $(1,0)$ ends at $(0,1)$; turn first and reflect afterwards, and $(1,0)$ ends at $(0,-1)$. Matrix multiplication is non-commutative because composing operations is non-commutative, and it would have been strange had it turned out otherwise.

This also explains the associativity that looked like an accident when multiplication was defined: $(ST)U$ and $S(TU)$ are the same because doing three things in a fixed order is the same regardless of how you bracket the description of it.

7. Where the construction goes wrong

Writing the images as rows. The image of $e_1$ is column one, not row one. Rows and columns carry different information — a row is one output coordinate's recipe, a column is one basis vector's destination — and swapping them transposes the matrix into a different map. The mistake is invisible on a symmetric matrix, which is why it survives so long.

Thinking a straight-line graph means a linear map. $f(x) = 3x + 2$ has a straight-line graph and is not linear: $f(0) = 2 \ne 0$. In this subject it is called affine — a linear map followed by a translation — and the distinction matters, because affine maps are exactly the ones for which none of this machinery works unmodified.

Composing in the written order. "Reflect then rotate" is $RF$, not $FR$. Reading the product left to right describes the maps in the order opposite to the order they act, every time.

Believing a map needs a formula. A linear map is determined by what it does to a basis, and that can be given as a list of answers with no formula anywhere. Two values and linearity determine $T$ on a whole plane.

8. Two answers make a matrix

  1. $T$ is linear with $T(1, 0) = (3, -1)$ and $T(0, 1) = (2, 4)$. No formula is given and none is needed.

    A basis and its images determine everything.

  2. The images go in as columns: $[T] = \begin{pmatrix} 3 & 2 \\ -1 & 4 \end{pmatrix}$.

    Column one is the image of $e_1$.

  3. Now $T(5, 2) = 5(3, -1) + 2(2, 4) = (19, 3)$, which is what $[T]\begin{pmatrix} 5 \\ 2\end{pmatrix}$ computes.

    Multiplying by the matrix is combining the columns.

9. The same two maps, composed both ways

  1. $F$ reflects in the $x$-axis, matrix $\begin{pmatrix} 1 & 0 \\ 0 & -1\end{pmatrix}$; $R$ turns a quarter turn anticlockwise, matrix $\begin{pmatrix} 0 & -1 \\ 1 & 0\end{pmatrix}$.

    Write both matrices first.

  2. Reflect then rotate is $RF = \begin{pmatrix} 0 & 1 \\ 1 & 0\end{pmatrix}$: reflection in the line $y = x$.

    First map on the right.

  3. Rotate then reflect is $FR = \begin{pmatrix} 0 & -1 \\ -1 & 0\end{pmatrix}$: reflection in $y = -x$. Two different maps from the same two ingredients.

    Order is part of the answer.

10. Your turn: the matrix of the map that projects onto the $x$-axis and then doubles

  1. The projection $P$ has matrix $\begin{pmatrix} 1 & 0 \\ 0 & 0\end{pmatrix}$; doubling $D$ has matrix $\begin{pmatrix} 2 & 0 \\ 0 & 2\end{pmatrix}$.

    Two answers each, as columns.

  2. Project first, so the projection is written on the right: the composition is $DP$.

    Nearest the vector acts first.

  3. Your turn: work this step out. Its working is at the end of the packet.

    $DP = \begin{pmatrix} 2 & 0 \\ 0 & 0\end{pmatrix}$, and $PD$ happens to give the same matrix here — a coincidence of these two maps, not a rule.

11. Guided practice

Write the standard matrix of $T(x, y) = (7x + 8y,\; 4x + 8y)$.

This task has no paper form; do it on a device.

12. Guided practice

Match each map of the plane to its standard matrix.

$\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$$\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}$$\begin{pmatrix} 1 & 4 \\ 0 & 1 \end{pmatrix}$
Reflection in the $x$-axis
A quarter turn anticlockwise about the origin
Projection onto the $x$-axis
The shear that fixes $(1, 0)$ and sends $(0, 1)$ to $(4, 1)$

13. Practice

$A = \begin{pmatrix} 1 & 4 \\ 0 & 1 \end{pmatrix}$ shears and $B = \begin{pmatrix} 5 & 0 \\ 0 & 4 \end{pmatrix}$ scales. Write the matrix of the map that shears first and then scales.

This task has no paper form; do it on a device.

14. Practice

$T$ turns the plane a quarter turn anticlockwise about the origin. Plot $T(4, 3)$.

Plot your answer on the grid:

-9-7-5-3-113579-9-7-5-3-113579xy

15. Practice

Which of these maps of the plane is linear?

16. Somewhere new

$D$ sends a polynomial to its derivative, and it is linear. Give the derivative of each polynomial below by filling in its two coefficients.

Constant termCoefficient of $x$
$p(x) = 3 + 2x + x^2$
$q(x) = 1 + 3x + 2x^2$

17. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

18. Test question

Write the standard matrix of $T(x, y) = (7x + 8y,\; 2x + 8y)$.

This task has no paper form; do it on a device.

19. What you can do now

You can decide whether a map is linear, build its matrix from the images of the basis vectors, and compose two maps in the right order. Say in your own words why the columns of the matrix are the images of the basis vectors. Next: what the map throws away, and what it reaches.

Working for the steps left to you

10. Your turn: the matrix of the map that projects onto the $x$-axis and then doubles, step 3

Check rather than assume.