---
title: Linear Transformations and Their Matrices
module: Linear Equations in Linear Algebra
moduleNumber: 1
lessonNumber: 5
order: 105
summary: >
  Reading A as an action rather than an array, x maps to Ax is a transformation
  from R^n to R^m. The ones that preserve addition and scalar multiplication are
  the linear transformations, and every one is x maps to Ax for a unique standard
  matrix whose columns are the images of the standard basis vectors. Onto and
  one-to-one translate into the span and independence of those columns.
topics: [Linear Equations in Linear Algebra]
sources:
  - book: Lay
    ref: "Ch. 1 — Linear Equations; §1.8 Introduction to Linear Transformations"
  - book: Lay
    ref: "§1.9 The Matrix of a Linear Transformation"
---

A matrix $A$ has served as a bookkeeping device for a system. Read the other way,
$A$ _acts_ on a vector $\mathbf{x}$ by multiplication, sending it to a new vector
$A\mathbf{x}$; solving $A\mathbf{x} = \mathbf{b}$ becomes finding which inputs $A$
sends to $\mathbf{b}$. This viewpoint gathers the earlier results (existence,
uniqueness, span, independence) around a single map.

## Transformations

A **transformation** (equivalently **function** or **mapping**) $T$ from
$\mathbb{R}^n$ to $\mathbb{R}^m$ assigns to each $\mathbf{x} \in \mathbb{R}^n$ a
vector $T(\mathbf{x}) \in \mathbb{R}^m$, written $T : \mathbb{R}^n \to
\mathbb{R}^m$. This is the ordinary idea of a function, lifted from numbers to
vectors.

> **Definition (Domain, codomain, image, range).** For $T : \mathbb{R}^n \to
> \mathbb{R}^m$: the **domain** is $\mathbb{R}^n$ and the **codomain** is
> $\mathbb{R}^m$; for $\mathbf{x}$ in the domain, $T(\mathbf{x})$ is the **image**
> of $\mathbf{x}$; and the **range** is the set of all images, $\{T(\mathbf{x}) :
> \mathbf{x} \in \mathbb{R}^n\}$.

The range can be smaller than the codomain: the codomain is the space in which
images are permitted, the range the set of images actually attained.

### Matrix transformations

The first source of transformations is matrix multiplication. Fix an $m \times n$
matrix $A$ and define $T(\mathbf{x}) = A\mathbf{x}$, often written $\mathbf{x}
\mapsto A\mathbf{x}$. The domain is $\mathbb{R}^n$ (matching the columns of $A$),
the codomain is $\mathbb{R}^m$ (matching the rows), and the range is the span of
the columns of $A$, because every image $A\mathbf{x}$ is a linear combination of
those columns.

$$
% caption: A transformation T sends each x in the domain to its image T(x) in the
% codomain; the range is the set of all images actually reached.
\begin{tikzpicture}[scale=1.0, font=\footnotesize, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black] (0,0) ellipse (1.5 and 2);
\node[black, anchor=south] at (0,2.05) {domain $\mathbb{R}^n$};
\draw[black] (6,0) ellipse (1.7 and 2.2);
\node[black, anchor=south] at (6,2.25) {codomain $\mathbb{R}^m$};
\draw[acc!55, fill=acc!8] (6,-0.3) ellipse (0.95 and 1.2);
\node[acc, anchor=north, font=\scriptsize] at (6,-1.55) {range};
\fill[black] (-0.2,0.4) circle (1.8pt) node[left] {$\mathbf{x}$};
\fill[black] (6.1,-0.1) circle (1.8pt) node[right] {$T(\mathbf{x})$};
\draw[acc, thick, ->] (0.1,0.5) to[bend left=15] node[midway, above] {$T$} (5.8,0.0);
\end{tikzpicture}
$$

For example, $A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$
sends $(x_1, x_2, x_3)$ to $(x_1, x_2, 0)$: a **projection** of $\mathbb{R}^3$
onto the $x_1x_2$-plane. The map $A = \begin{bmatrix} 1 & 3 \\ 0 & 1 \end{bmatrix}$
is a **shear** that slides the top of a square rightward while fixing the base,
turning it into a parallelogram.

> **Worked example.** Let $A = \begin{bmatrix} 1 & -3 \\ 3 & 5 \\ -1 & 7 \end{bmatrix}$
> and $T(\mathbf{x}) = A\mathbf{x}$, a map $\mathbb{R}^2 \to \mathbb{R}^3$. Compute
> the image of $\mathbf{u} = (2, -1)$, and find an $\mathbf{x}$ whose image is
> $\mathbf{b} = (3, 2, -5)$.
>
> The image of $\mathbf{u}$ is a matrix-vector product,
>
> $$
> T(\mathbf{u}) = A\mathbf{u}
> = \begin{bmatrix} 1 & -3 \\ 3 & 5 \\ -1 & 7 \end{bmatrix}\begin{bmatrix} 2 \\ -1 \end{bmatrix}
> = \begin{bmatrix} 5 \\ 1 \\ -9 \end{bmatrix}.
> $$
>
> To reach $\mathbf{b}$, solve $A\mathbf{x} = \mathbf{b}$ by reducing
> $[\,A\ \mathbf{b}\,]$:
>
> $$
> \begin{bmatrix} 1 & -3 & 3 \\ 3 & 5 & 2 \\ -1 & 7 & -5 \end{bmatrix}
> \;\longrightarrow\;
> \begin{bmatrix} 1 & -3 & 3 \\ 0 & 14 & -7 \\ 0 & 4 & -2 \end{bmatrix}
> \;\longrightarrow\;
> \begin{bmatrix} 1 & 0 & \tfrac32 \\ 0 & 1 & -\tfrac12 \\ 0 & 0 & 0 \end{bmatrix}.
> $$
>
> The unique solution is $\mathbf{x} = (\tfrac32, -\tfrac12)$, so $\mathbf{b}$
> lies in the range of $T$.

## Linear transformations

Two properties, already proved for $\mathbf{x} \mapsto A\mathbf{x}$, single out the
central class of maps.

> **Definition (Linear transformation).** A transformation $T$ is **linear** if
> for all $\mathbf{u}, \mathbf{v}$ in its domain and all scalars $c$:
> - **(i)** $T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v})$;
> - **(ii)** $T(c\mathbf{u}) = c\,T(\mathbf{u})$.

Linearity means the map commutes with the two vector operations: adding then
transforming equals transforming then adding, and likewise for scaling. Every
matrix transformation is linear, by the [linearity of $\mathbf{x} \mapsto
A\mathbf{x}$](/linear-algebra/linear-systems/vector-and-matrix-equations). Two
consequences follow immediately for any linear $T$:

$$
T(\mathbf{0}) = \mathbf{0}, \qquad
T(c\mathbf{u} + d\mathbf{v}) = c\,T(\mathbf{u}) + d\,T(\mathbf{v}).
$$

The first comes from $T(\mathbf{0}) = T(0\cdot\mathbf{u}) = 0\cdot T(\mathbf{u}) =
\mathbf{0}$. The second, applied repeatedly, gives the general rule

$$
T(c_1 \mathbf{v}_1 + \cdots + c_p \mathbf{v}_p) = c_1 T(\mathbf{v}_1) + \cdots + c_p T(\mathbf{v}_p),
$$

known in physics and engineering as the **superposition principle**: the response
to a combination of inputs is the same combination of the responses. A map
satisfying the two-vector rule for all $\mathbf{u}, \mathbf{v}, c, d$ is
linear (set $c = d = 1$, then $d = 0$), so that rule can serve as the test.[^lay-18]

A contraction or dilation $T(\mathbf{x}) = r\mathbf{x}$ is linear for any scalar
$r$. By contrast, $T(x_1, x_2) = (4x_1 - 2x_2,\ 3|x_2|)$ is not: the absolute value
breaks scaling, since $T(-\mathbf{u}) \ne -T(\mathbf{u})$ in general. An **affine**
map $\mathbf{x} \mapsto A\mathbf{x} + \mathbf{b}$ with $\mathbf{b} \ne \mathbf{0}$
also fails, because $T(\mathbf{0}) = \mathbf{b} \ne \mathbf{0}$.

## The standard matrix

A linear transformation is determined by where it sends the coordinate axes. Let
$\mathbf{e}_1, \dots, \mathbf{e}_n$ be the columns of the $n
\times n$ identity — the **standard basis** vectors. Any $\mathbf{x} = (x_1, \dots,
x_n)$ is $\mathbf{x} = x_1\mathbf{e}_1 + \cdots + x_n\mathbf{e}_n$, so by linearity

$$
T(\mathbf{x}) = x_1 T(\mathbf{e}_1) + \cdots + x_n T(\mathbf{e}_n).
$$

The images of the basis vectors determine every image. Packing them as columns
recovers a matrix.

> **Theorem (Standard matrix).** Every linear transformation $T : \mathbb{R}^n \to
> \mathbb{R}^m$ is $T(\mathbf{x}) = A\mathbf{x}$ for a unique $m \times n$ matrix
> $$
> A = \begin{bmatrix} T(\mathbf{e}_1) & T(\mathbf{e}_2) & \cdots & T(\mathbf{e}_n) \end{bmatrix},
> $$
> the **standard matrix** of $T$, whose $j$-th column is the image of
> $\mathbf{e}_j$.

So "linear transformation" and "matrix transformation" describe the same objects;
the first names a property, the second names the implementation.[^lay-19] To build
$A$, transform the axes and read off columns.

$$
% caption: A linear map is fixed by the images of e_1 and e_2; those images become
% the columns of the standard matrix A.
\begin{tikzpicture}[scale=1.0, font=\footnotesize, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
% domain axes
\begin{scope}
  \draw[black, ->] (-0.3,0) -- (2.2,0); \draw[black, ->] (0,-0.3) -- (0,2.2);
  \draw[thick, ->] (0,0) -- (1.4,0) node[below] {$\mathbf{e}_1$};
  \draw[thick, ->] (0,0) -- (0,1.4) node[left] {$\mathbf{e}_2$};
\end{scope}
\draw[very thick, ->] (2.8,0.7) -- (4.2,0.7) node[midway, above] {$T$};
% images
\begin{scope}[xshift=5.2cm]
  \draw[black, ->] (-0.3,0) -- (2.4,0); \draw[black, ->] (0,-0.3) -- (0,2.2);
  \draw[acc, thick, ->] (0,0) -- (1.4,0.6) node[right] {$T(\mathbf{e}_1)$};
  \draw[acc, thick, ->] (0,0) -- (0.5,1.5) node[above] {$T(\mathbf{e}_2)$};
  \node[anchor=north] at (1.1,-0.5) {columns of $A$};
\end{scope}
\end{tikzpicture}
$$

### The geometric maps of the plane

The common $2 \times 2$ maps are catalogued by their action on the unit square, all
determined by the images of $\mathbf{e}_1$ and $\mathbf{e}_2$.

| Transformation | Standard matrix | Effect on the unit square |
| --- | --- | --- |
| Reflection through the $x_1$-axis | $\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}$ | flips vertically |
| Reflection through $x_2 = x_1$ | $\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$ | swaps coordinates |
| Horizontal contraction / expansion | $\begin{bmatrix} k & 0 \\ 0 & 1 \end{bmatrix}$ | scales width by $k$ |
| Horizontal shear | $\begin{bmatrix} 1 & k \\ 0 & 1 \end{bmatrix}$ | slants into a parallelogram |
| Projection onto the $x_1$-axis | $\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$ | collapses onto a line |
| Rotation by angle $\varphi$ | $\begin{bmatrix} \cos\varphi & -\sin\varphi \\ \sin\varphi & \cos\varphi \end{bmatrix}$ | turns about the origin |

> **Worked example.** Find the standard matrix of the rotation of $\mathbb{R}^2$
> through an angle $\varphi$ about the origin.
>
> The columns are the images of the basis vectors. Rotating $\mathbf{e}_1 = (1,0)$
> through $\varphi$ gives $(\cos\varphi, \sin\varphi)$, and rotating
> $\mathbf{e}_2 = (0,1)$ gives $(-\sin\varphi, \cos\varphi)$, so
>
> $$
> A = \begin{bmatrix} \cos\varphi & -\sin\varphi \\ \sin\varphi & \cos\varphi \end{bmatrix}.
> $$

$$
% caption: A rotation about the origin carries the unit square (dashed) to its
% image; e_1 and e_2 land on the columns of the rotation matrix.
\begin{tikzpicture}[scale=1.4, font=\footnotesize, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.5,0) -- (1.5,0);
\draw[black, ->] (0,-0.3) -- (0,1.6);
\draw[black, dashed] (0,0) rectangle (1,1);
\draw[acc, thick] (0,0) -- (0.82,0.57) -- (0.25,1.39) -- (-0.57,0.82) -- cycle;
\draw[acc, thick, ->] (0,0) -- (0.82,0.57) node[right] {$T(\mathbf{e}_1)$};
\draw[acc, thick, ->] (0,0) -- (-0.57,0.82) node[above left] {$T(\mathbf{e}_2)$};
\draw[black, ->] (0.62,0.0) arc (0:35:0.62);
\end{tikzpicture}
$$

$$
% caption: Three standard maps acting on the unit square (dashed): a horizontal
% shear, a reflection through the x_1-axis, and a projection onto the x_1-axis.
\begin{tikzpicture}[scale=0.85, font=\footnotesize, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
% shear
\begin{scope}
  \draw[black, dashed] (0,0) rectangle (1,1);
  \draw[acc, thick] (0,0) -- (1,0) -- (1.6,1) -- (0.6,1) -- cycle;
  \node[anchor=north] at (0.8,-0.3) {shear};
\end{scope}
% reflection
\begin{scope}[xshift=4.2cm]
  \draw[black, ->] (-0.3,0) -- (1.6,0);
  \draw[black, dashed] (0,0) rectangle (1,1);
  \draw[acc, thick] (0,0) -- (1,0) -- (1,-1) -- (0,-1) -- cycle;
  \node[anchor=north] at (0.5,-1.3) {ref\/lection};
\end{scope}
% projection
\begin{scope}[xshift=8.4cm]
  \draw[black, dashed] (0,0) rectangle (1,1);
  \draw[acc, line width=1.8pt] (0,0) -- (1,0);
  \node[anchor=north] at (0.5,-0.3) {projection};
\end{scope}
\end{tikzpicture}
$$

## Onto and one-to-one

The existence and uniqueness questions of the whole chapter become two properties
of the map $T$.

> **Definition (Onto).** $T : \mathbb{R}^n \to \mathbb{R}^m$ is **onto**
> $\mathbb{R}^m$ if every $\mathbf{b} \in \mathbb{R}^m$ is the image of at least
> one $\mathbf{x}$ — that is, the range is all of the codomain. This is an
> **existence** question: does $T(\mathbf{x}) = \mathbf{b}$ always have a solution?

> **Definition (One-to-one).** $T$ is **one-to-one** if every $\mathbf{b} \in
> \mathbb{R}^m$ is the image of at most one $\mathbf{x}$. This is a
> **uniqueness** question: does $T(\mathbf{x}) = \mathbf{b}$ never have two
> solutions?

$$
% caption: Onto asks whether every target is hit (existence); one-to-one asks
% whether no target is hit twice (uniqueness).
\begin{tikzpicture}[scale=1.0, font=\footnotesize, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
% one-to-one, not onto
\begin{scope}
  \draw[black] (0,0) ellipse (0.9 and 1.5);
  \draw[black] (3,0) ellipse (0.9 and 1.5);
  \foreach \y in {0.8,0,-0.8} \fill[black] (0,\y) circle (1.3pt);
  \foreach \y/\t in {1.0/a,0.2/b,-0.6/c} \fill[black] (3,\y) circle (1.3pt);
  \draw[->] (0.2,0.8) -- (2.8,1.0);
  \draw[->] (0.2,0) -- (2.8,0.2);
  \draw[->] (0.2,-0.8) -- (2.8,-0.6);
  \node[anchor=north] at (1.5,-1.7) {one-to-one, not onto};
\end{scope}
% onto, not one-to-one
\begin{scope}[xshift=6.5cm]
  \draw[black] (0,0) ellipse (0.9 and 1.5);
  \draw[black] (3,0) ellipse (0.9 and 1.5);
  \foreach \y in {1.0,0.4,-0.2,-0.9} \fill[black] (0,\y) circle (1.3pt);
  \foreach \y in {0.7,-0.5} \fill[black] (3,\y) circle (1.3pt);
  \draw[->] (0.2,1.0) -- (2.8,0.7);
  \draw[->] (0.2,0.4) -- (2.8,0.7);
  \draw[->] (0.2,-0.2) -- (2.8,-0.5);
  \draw[->] (0.2,-0.9) -- (2.8,-0.5);
  \node[anchor=north] at (1.5,-1.7) {onto, not one-to-one};
\end{scope}
\end{tikzpicture}
$$

Both reduce to pivot conditions on the standard matrix.

> **Theorem (Onto, one-to-one, and $A$).** Let $T(\mathbf{x}) = A\mathbf{x}$ with
> standard matrix $A$. Then:
> - $T$ is **onto** $\mathbb{R}^m$ if and only if the columns of $A$ span
>   $\mathbb{R}^m$ — a pivot in every row;
> - $T$ is **one-to-one** if and only if the columns of $A$ are linearly
>   independent — a pivot in every column;
> - $T$ is one-to-one if and only if $T(\mathbf{x}) = \mathbf{0}$ has only the
>   trivial solution.

The onto criterion is the [spanning
theorem](/linear-algebra/linear-systems/vector-and-matrix-equations) reworded. For
one-to-one, if $T(\mathbf{u}) = T(\mathbf{v})$ then $T(\mathbf{u} - \mathbf{v}) =
\mathbf{0}$; distinct inputs with the same image give a nonzero solution of
$T(\mathbf{x}) = \mathbf{0}$, and the [independence of the
columns](/linear-algebra/linear-systems/linear-independence) says no such
solution exists.[^lay-19b]

The pivot counts fix the possibilities by shape. A map $\mathbb{R}^n \to
\mathbb{R}^m$ can be:

| Shape | Onto possible? | One-to-one possible? |
| --- | --- | --- |
| $n < m$ (taller) | no — too few columns to span | yes |
| $n = m$ (square) | yes | yes — and one holds iff the other does |
| $n > m$ (wider) | yes | no — a free variable is forced |

A projection ($\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$) is neither onto nor
one-to-one, and a rotation is both.

> **Worked example.** Decide whether $T(x_1, x_2) = (3x_1 + x_2,\ 5x_1 + 7x_2,\
> x_1 + 3x_2)$ is one-to-one and whether it is onto.
>
> The standard matrix carries the coefficients of each output as a row,
>
> $$
> A = \begin{bmatrix} 3 & 1 \\ 5 & 7 \\ 1 & 3 \end{bmatrix},
> $$
>
> a $3 \times 2$ matrix. Reduce it to locate pivots:
>
> $$
> \begin{bmatrix} 3 & 1 \\ 5 & 7 \\ 1 & 3 \end{bmatrix}
> \;\longrightarrow\;
> \begin{bmatrix} 1 & 3 \\ 5 & 7 \\ 3 & 1 \end{bmatrix}
> \;\longrightarrow\;
> \begin{bmatrix} 1 & 3 \\ 0 & 1 \\ 0 & 0 \end{bmatrix}.
> $$
>
> Both columns are pivot columns, so the columns are independent and $T$ is
> one-to-one. The third row holds no pivot, so two columns cannot span
> $\mathbb{R}^3$ and $T$ is not onto.

[^lay-18]: **Lay**, _Linear Algebra and Its Applications_, §1.8 — Introduction to Linear Transformations: the domain/codomain/range vocabulary, matrix transformations, the definition of linearity, and the consequences $T(\mathbf{0}) = \mathbf{0}$ and the superposition principle.
[^lay-19]: **Lay**, §1.9 — The Matrix of a Linear Transformation: every linear $T : \mathbb{R}^n \to \mathbb{R}^m$ has a unique standard matrix whose columns are $T(\mathbf{e}_j)$, and the catalogue of geometric maps of the plane.
[^lay-19b]: **Lay**, §1.9, Theorems 11 and 12: $T$ is one-to-one iff $T(\mathbf{x}) = \mathbf{0}$ has only the trivial solution, iff the columns of $A$ are independent; $T$ is onto iff the columns of $A$ span the codomain.
