Math Core

Lesson 2.4 · Matrix Algebra

Linear transformations

So far you have read Ax=bA\mathbf{x} = \mathbf{b} as a question: which x\mathbf{x} produce b\mathbf{b}? There is a second, more dynamic reading. The matrix AA is a machine that takes in a vector x\mathbf{x} and outputs a new vector AxA\mathbf{x}. Thinking of matrices as functions on vectors is what lets linear algebra describe rotations, projections, computer graphics and much more.

Transformations

Definition

Transformation

A transformation (or function, or mapping) TT from Rn\mathbb{R}^n to Rm\mathbb{R}^m, written T:Rn→RmT: \mathbb{R}^n \to \mathbb{R}^m, is a rule that assigns to each vector x\mathbf{x} in Rn\mathbb{R}^n a vector T(x)T(\mathbf{x}) in Rm\mathbb{R}^m.

  • Rn\mathbb{R}^n is the domain and Rm\mathbb{R}^m is the codomain.
  • T(x)T(\mathbf{x}) is the image of x\mathbf{x}.
  • The set of all images T(x)T(\mathbf{x}) is the range of TT.

The range is a subset of the codomain, and it may be much smaller. The codomain just says where outputs live; the range says which outputs actually occur.

Matrix transformations

Every m×nm \times n matrix AA defines a transformation T(x)=AxT(\mathbf{x}) = A\mathbf{x}, often written x↦Ax\mathbf{x} \mapsto A\mathbf{x}. Since x\mathbf{x} must have nn entries for AxA\mathbf{x} to be defined and the result has mm entries, the domain is Rn\mathbb{R}^n and the codomain is Rm\mathbb{R}^m. Notice the order: an m×nm \times n matrix maps Rn\mathbb{R}^n to Rm\mathbb{R}^m.

Because AxA\mathbf{x} is a linear combination of the columns of AA, the range of x↦Ax\mathbf{x} \mapsto A\mathbf{x} is exactly the span of the columns of AA. Asking "is b\mathbf{b} in the range of TT?" is the same as asking "is Ax=bA\mathbf{x} = \mathbf{b} consistent?"

Worked example: Images and preimages

Let A=[1−335−17]A = \begin{bmatrix} 1 & -3 \\ 3 & 5 \\ -1 & 7 \end{bmatrix} and T(x)=AxT(\mathbf{x}) = A\mathbf{x}, so T:R2→R3T: \mathbb{R}^2 \to \mathbb{R}^3.

(a) Find T(u)T(\mathbf{u}) for u=(2,−1)\mathbf{u} = (2, -1).

T(u)=2[13−1]−[−357]=[51−9].T(\mathbf{u}) = 2\begin{bmatrix} 1 \\ 3 \\ -1 \end{bmatrix} - \begin{bmatrix} -3 \\ 5 \\ 7 \end{bmatrix} = \begin{bmatrix} 5 \\ 1 \\ -9 \end{bmatrix}.

(b) Find an x\mathbf{x} whose image is b=(3,2,−5)\mathbf{b} = (3, 2, -5), and decide whether it is unique.

Row reduce the augmented matrix:

[1−33352−17−5]∼[1−33014−704−2]∼[1−3301−12000].\begin{bmatrix} 1 & -3 & 3 \\ 3 & 5 & 2 \\ -1 & 7 & -5 \end{bmatrix} \sim \begin{bmatrix} 1 & -3 & 3 \\ 0 & 14 & -7 \\ 0 & 4 & -2 \end{bmatrix} \sim \begin{bmatrix} 1 & -3 & 3 \\ 0 & 1 & -\tfrac{1}{2} \\ 0 & 0 & 0 \end{bmatrix}.

So x2=−12x_2 = -\tfrac{1}{2} and x1=3+3x2=32x_1 = 3 + 3x_2 = \tfrac{3}{2}. There are no free variables, so x=(32,−12)\mathbf{x} = \left(\tfrac{3}{2}, -\tfrac{1}{2}\right) is the only vector mapped to b\mathbf{b}.

Seeing a transformation

For a map R2→R2\mathbb{R}^2 \to \mathbb{R}^2, a good way to see what it does is to watch the unit square with corners (0,0)(0,0), (1,0)(1,0), (1,1)(1,1) and (0,1)(0,1). Take A=[1101]A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}. Then

A[x1x2]=[x1+x2x2].A\begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} x_1 + x_2 \\ x_2 \end{bmatrix}.

Each point slides to the right by an amount equal to its height. The corners go to (0,0)(0,0), (1,0)(1,0), (2,1)(2,1) and (1,1)(1,1), and the square becomes a parallelogram. This is a shear.

The unit square and its image under the shear, a slanted parallelogram with corners (0,0), (1,0), (2,1), (1,1).Open in grapher →

Other simple matrices give other familiar motions. [1000]\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} projects every point straight down onto the x1x_1-axis. [3003]\begin{bmatrix} 3 & 0 \\ 0 & 3 \end{bmatrix} stretches everything away from the origin by a factor of 33. [100−1]\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} reflects across the x1x_1-axis.

Linearity

Matrix transformations have two properties that come straight from the algebra of AxA\mathbf{x}: A(u+v)=Au+AvA(\mathbf{u} + \mathbf{v}) = A\mathbf{u} + A\mathbf{v} and A(cu)=cAuA(c\mathbf{u}) = cA\mathbf{u}. Those two properties turn out to be the essential ones.

Definition

Linear transformation

A transformation TT is linear if, for all vectors u,v\mathbf{u}, \mathbf{v} in its domain and all scalars cc,

  1. T(u+v)=T(u)+T(v)T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v}), and
  2. T(cu)=cT(u)T(c\mathbf{u}) = cT(\mathbf{u}).

Every matrix transformation is linear. Two consequences follow immediately from the definition:

T(0)=0andT(cu+dv)=cT(u)+dT(v).T(\mathbf{0}) = \mathbf{0} \qquad \text{and} \qquad T(c\mathbf{u} + d\mathbf{v}) = cT(\mathbf{u}) + dT(\mathbf{v}).

For the first, T(0)=T(0⋅0)=0⋅T(0)=0T(\mathbf{0}) = T(0 \cdot \mathbf{0}) = 0 \cdot T(\mathbf{0}) = \mathbf{0}. Applying the second property repeatedly gives the superposition principle: TT carries any linear combination of inputs to the same linear combination of outputs.

T(c1v1+⋯+cpvp)=c1T(v1)+⋯+cpT(vp).T(c_1\mathbf{v}_1 + \cdots + c_p\mathbf{v}_p) = c_1T(\mathbf{v}_1) + \cdots + c_pT(\mathbf{v}_p).

Linear maps respect linear combinations

If you know what a linear transformation does to a few vectors, you know what it does to every linear combination of them. You don't need a formula for TT at all.

Worked example: Using only linearity

T:R2→R2T: \mathbb{R}^2 \to \mathbb{R}^2 is linear, T(u)=(2,1)T(\mathbf{u}) = (2, 1) and T(v)=(−1,3)T(\mathbf{v}) = (-1, 3). Find T(3u−2v)T(3\mathbf{u} - 2\mathbf{v}).

T(3u−2v)=3T(u)−2T(v)=[63]−[−26]=[8−3].T(3\mathbf{u} - 2\mathbf{v}) = 3T(\mathbf{u}) - 2T(\mathbf{v}) = \begin{bmatrix} 6 \\ 3 \end{bmatrix} - \begin{bmatrix} -2 \\ 6 \end{bmatrix} = \begin{bmatrix} 8 \\ -3 \end{bmatrix}.

Worked example: Testing for linearity

Which of these maps R2→R2\mathbb{R}^2 \to \mathbb{R}^2 are linear?

S(x1,x2)=(x1+1,  x2),R(x1,x2)=(x1x2,  x2),U(x1,x2)=(4x1−x2,  2x2).S(x_1, x_2) = (x_1 + 1, \; x_2), \qquad R(x_1, x_2) = (x_1x_2, \; x_2), \qquad U(x_1, x_2) = (4x_1 - x_2, \; 2x_2).
  • S(0,0)=(1,0)≠0S(0, 0) = (1, 0) \ne \mathbf{0}, so SS is not linear. (Translations are not linear.)
  • R(0,0)=(0,0)R(0,0) = (0,0), so that quick test doesn't help. Try scaling: R(2,2)=(4,2)R(2, 2) = (4, 2), but 2R(1,1)=2(1,1)=(2,2)2R(1,1) = 2(1, 1) = (2, 2). Not linear.
  • U(x)=[4−102]xU(\mathbf{x}) = \begin{bmatrix} 4 & -1 \\ 0 & 2 \end{bmatrix}\mathbf{x} is a matrix transformation, so it is linear.

Common mistake

T(0)=0T(\mathbf{0}) = \mathbf{0} is necessary for linearity but not sufficient. The map RR above passes that test and still fails. To show a map is linear, either verify both defining properties for arbitrary vectors or write it as x↦Ax\mathbf{x} \mapsto A\mathbf{x}. To show it is not linear, one specific counterexample is enough.

Tip

A formula for T(x)T(\mathbf{x}) is linear exactly when each output entry is a sum of constant multiples of the input entries: no constant terms, no products of variables, no powers, absolute values or functions like sin⁡\sin.

Practice

Practice 1

Let A=[20−1134]A = \begin{bmatrix} 2 & 0 & -1 \\ 1 & 3 & 4 \end{bmatrix} and T(x)=AxT(\mathbf{x}) = A\mathbf{x}. Find T(u)T(\mathbf{u}) for u=(1,−2,3)\mathbf{u} = (1, -2, 3).

Enter a point like (2, -3)

Practice 2

AA is a 4×74 \times 7 matrix and T(x)=AxT(\mathbf{x}) = A\mathbf{x}. Which describes TT?

Practice 3

Which transformation R2→R2\mathbb{R}^2 \to \mathbb{R}^2 is linear?

Practice 4

TT is linear with T(u)=(1,4)T(\mathbf{u}) = (1, 4) and T(v)=(−2,1)T(\mathbf{v}) = (-2, 1). Find T(2u+5v)T(2\mathbf{u} + 5\mathbf{v}).

Enter a point like (2, -3)

Practice 5

Let A=[1−22−3]A = \begin{bmatrix} 1 & -2 \\ 2 & -3 \end{bmatrix} and T(x)=AxT(\mathbf{x}) = A\mathbf{x}. Find the vector x\mathbf{x} with T(x)=(4,5)T(\mathbf{x}) = (4, 5).

Enter a point like (2, -3)

Practice 6

Let A=[130126]A = \begin{bmatrix} 1 & 3 \\ 0 & 1 \\ 2 & 6 \end{bmatrix} and T(x)=AxT(\mathbf{x}) = A\mathbf{x}. Is b=(1,1,3)\mathbf{b} = (1, 1, 3) in the range of TT?

Practice 7

Find the image of the point (2,3)(2, 3) under the shear x↦[1−201]x\mathbf{x} \mapsto \begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix}\mathbf{x}.

Enter a point like (2, -3)

Practice 8

T:R2→R2T: \mathbb{R}^2 \to \mathbb{R}^2 is linear with T(1,1)=(3,1)T(1, 1) = (3, 1) and T(1,−1)=(1,5)T(1, -1) = (1, 5). Find T(4,0)T(4, 0).

Enter a point like (2, -3)