Linear AlgebraLinear Transformations

The Matrix of a Linear Transformation

The columns are the images of the standard basis vectors.

Not started Jump to practice

Every matrix gives a linear transformation. The surprise is the converse: every linear transformation from $\mathbb{R}^n$ to $\mathbb{R}^m$ is multiplication by some matrix, and that matrix is easy to find.

Key idea

If $T: \mathbb{R}^n \to \mathbb{R}^m$ is linear, then $T(\mathbf{x}) = A\mathbf{x}$ for the $m \times n$ standard matrix $$A = \left[\,T(\mathbf{e}_1)\ \ T(\mathbf{e}_2)\ \ \cdots\ \ T(\mathbf{e}_n)\,\right],$$ whose columns are the images of the standard basis vectors.

Why it works

Any $\mathbf{x}$ in $\mathbb{R}^n$ is $x_1\mathbf{e}_1 + x_2\mathbf{e}_2 + \cdots + x_n\mathbf{e}_n$. By linearity, $T(\mathbf{x})$ $= x_1T(\mathbf{e}_1) + \cdots + x_nT(\mathbf{e}_n)$. That is exactly the combination of the vectors $T(\mathbf{e}_j)$ with weights $x_j$, which by definition is $A\mathbf{x}$ for the matrix with those columns. So knowing $T$ on $n$ vectors tells you $T$ everywhere.

Worked example: From a formula

Find the standard matrix of $T(x_1, x_2)$ $= (2x_1 - x_2,\ x_1 + 3x_2,\ -x_2)$.
  1. $T(\mathbf{e}_1) = T(1, 0) = (2, 1, 0)$ and $T(\mathbf{e}_2)$ $= T(0, 1)$ $= (-1, 3, -1)$.
  2. Use them as columns: $A = \begin{bmatrix} 2 & -1 \\ 1 & 3 \\ 0 & -1 \end{bmatrix}$, a $3 \times 2$ matrix (from $\mathbb{R}^2$ to $\mathbb{R}^3$).
  3. Check: $A\begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 2x_1 - x_2 \\ x_1 + 3x_2 \\ -x_2 \end{bmatrix}$. ✓

Answer: $\begin{bmatrix} 2 & -1 \\ 1 & 3 \\ 0 & -1 \end{bmatrix}$

Worked example: From the images of other vectors

$T$ is linear with $T\begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\ 1 \end{bmatrix}$ and $T\begin{bmatrix} 1 \\ 2 \end{bmatrix} = \begin{bmatrix} 4 \\ 3 \end{bmatrix}$. Find its standard matrix.
  1. Write $\mathbf{e}_1$ and $\mathbf{e}_2$ using $\mathbf{u} = (1, 1)$ and $\mathbf{v} = (1, 2)$: $\mathbf{e}_1 = 2\mathbf{u} - \mathbf{v}$ and $\mathbf{e}_2 = \mathbf{v} - \mathbf{u}$. (Check: $2(1,1) - (1,2) = (1, 0)$ and $(1,2) - (1,1) = (0, 1)$.)
  2. Linearity: $T(\mathbf{e}_1)$ $= 2\begin{bmatrix} 3 \\ 1 \end{bmatrix} - \begin{bmatrix} 4 \\ 3 \end{bmatrix}$ $= \begin{bmatrix} 2 \\ -1 \end{bmatrix}$ and $T(\mathbf{e}_2)$ $= \begin{bmatrix} 4 \\ 3 \end{bmatrix} - \begin{bmatrix} 3 \\ 1 \end{bmatrix}$ $= \begin{bmatrix} 1 \\ 2 \end{bmatrix}$.
  3. $A = \begin{bmatrix} 2 & 1 \\ -1 & 2 \end{bmatrix}$. Check: $A\begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\ 1 \end{bmatrix}$ ✓.

Answer: $\begin{bmatrix} 2 & 1 \\ -1 & 2 \end{bmatrix}$

Worked example: A map described in words

$T: \mathbb{R}^3 \to \mathbb{R}^3$ rotates every vector $90^\circ$ about the $z$-axis (counterclockwise when seen from above). Find its standard matrix.
  1. $\mathbf{e}_1 = (1, 0, 0)$ turns to $(0, 1, 0)$; $\mathbf{e}_2 = (0, 1, 0)$ turns to $(-1, 0, 0)$; $\mathbf{e}_3 = (0, 0, 1)$ lies on the axis and stays put.
  2. Columns: $A = \begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}$.
  3. Check: $A\begin{bmatrix} 2 \\ 3 \\ 5 \end{bmatrix} = \begin{bmatrix} -3 \\ 2 \\ 5 \end{bmatrix}$: the height $5$ is unchanged and $(2, 3)$ turned to $(-3, 2)$.

Answer: $\begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}$

The size of the standard matrix is set by the map: $T: \mathbb{R}^n \to \mathbb{R}^m$ has $n$ columns (one per input direction $\mathbf{e}_j$) and $m$ rows (one per output entry). A formula like $T(x_1, x_2) = (\ldots, \ldots, \ldots)$ with three outputs always gives a $3 \times 2$ matrix.

The columns of the standard matrix are exactly where $\hat{\imath} = \mathbf{e}_1$ and $\hat{\jmath} = \mathbf{e}_2$ land.

Common mistake

Writing the images as rows instead of columns. With $T(\mathbf{e}_1) = (2, 1, 0)$ and $T(\mathbf{e}_2) = (-1, 3, -1)$, the matrix $\begin{bmatrix} 2 & 1 & 0 \\ -1 & 3 & -1 \end{bmatrix}$ is $2 \times 3$ and maps $\mathbb{R}^3$ to $\mathbb{R}^2$: the wrong direction. Check: multiply your matrix by $\mathbf{e}_1$; you must get $T(\mathbf{e}_1)$ back.

Why "standard"? The matrix records $T$ using the standard basis $\mathbf{e}_1, \dots, \mathbf{e}_n$ to describe inputs and outputs. Later, in change of basis, we will describe the same map using other, better-suited directions and get a different (often much simpler) matrix for the same $T$.

This is why we think of matrices and linear maps as two descriptions of the same thing. Questions about $T$ (Is it one-to-one? What is its range?) become questions about $A$ (pivots, columns), and row reduction answers them.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Margalit and Rabinoff, Interactive Linear Algebra (Georgia Tech), §3.3 Linear Transformations
  • MIT OpenCourseWare 18.06 Linear Algebra (Gilbert Strang, Spring 2010), Lecture 30: Linear Transformations and Their Matrices
@teddyrookbook GitHub