Unit 1, lesson 4

Linear Transformations

What makes a map between coordinate spaces linear, how additivity, homogeneity and zero preservation test a rule, why every linear map has a standard matrix, and why nonzero translations fail.

  • Video 4
  • Matrices and Linear Transformations

Slide every point of a drawing sideways by its own height, so that the point (x,y)(x, y) moves to (x+y,y)(x + y, y) and a rectangle leans over into a parallelogram. If two arrows add up to a third before the move, do their images still add up to the image of the third? Rules that always respect sums and scalar multiples in this way are the linear transformations. This lesson defines them, shows how to test a rule for linearity, and proves that every linear map between coordinate spaces is multiplication by one matrix, whose columns record where the standard unit vectors go.

Key terms

Linear transformation

Definition Vectors in Rn\mathbb{R}^n are columns, and on this page a tuple such as (x,y)(x, y) written inline stands for the column with those entries. A transformation, or map, TT from Rn\mathbb{R}^n to Rm\mathbb{R}^m is a rule that assigns to each vector x\mathbf{x} in Rn\mathbb{R}^n exactly one vector T(x)T(\mathbf{x}) in Rm\mathbb{R}^m. The space Rn\mathbb{R}^n of allowed inputs is the domain of TT, and the space Rm\mathbb{R}^m where the outputs live is its codomain. The map TT is a linear transformation if it has two properties. The first, additivity, requires

T(u+v)=T(u)+T(v)T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v})

for all vectors u\mathbf{u} and v\mathbf{v} in Rn\mathbb{R}^n. The second, homogeneity, requires

T(cu)=c T(u)T(c\mathbf{u}) = c\,T(\mathbf{u})

for every vector u\mathbf{u} in Rn\mathbb{R}^n and every real number cc. Together the two properties are equivalent to the single condition T(au+bv)=aT(u)+bT(v)T(a\mathbf{u} + b\mathbf{v}) = aT(\mathbf{u}) + bT(\mathbf{v}) for all u,v\mathbf{u}, \mathbf{v} in Rn\mathbb{R}^n and all real a,ba, b. Additivity splits the left side into T(au)+T(bv)T(a\mathbf{u}) + T(b\mathbf{v}) and homogeneity pulls out aa and bb. Conversely, taking a=b=1a = b = 1 gives additivity, and taking b=0b = 0 gives homogeneity. Repeating the condition shows that a linear map sends every linear combination c1v1+⋯+ckvkc_1\mathbf{v}_1 + \cdots + c_k\mathbf{v}_k to c1T(v1)+⋯+ckT(vk)c_1T(\mathbf{v}_1) + \cdots + c_kT(\mathbf{v}_k), with the same coefficients.

In plain words Adding or scaling before applying the map gives the same result as applying the map first and adding or scaling afterward. A linear map may shear, stretch, reflect or even flatten space, as long as both rules hold for every choice of vectors and scalars.

Example The shear T(x,y)=(x+y,y)T(x, y) = (x + y, y) from R2\mathbb{R}^2 to R2\mathbb{R}^2 moves each point sideways by its height. For u=(2,1)\mathbf{u} = (2, 1) and v=(−1,2)\mathbf{v} = (-1, 2), the sum (1,3)(1, 3) goes to (4,3)(4, 3), and the separate images (3,1)(3, 1) and (1,2)(1, 2) also add to (4,3)(4, 3). One pair proves nothing on its own, so take arbitrary vectors u=(u1,u2)\mathbf{u} = (u_1, u_2) and v=(v1,v2)\mathbf{v} = (v_1, v_2). Regrouping the first entry gives

T(u+v)=[u1+v1+u2+v2u2+v2]=[u1+u2u2]+[v1+v2v2]=T(u)+T(v),\begin{aligned} T(\mathbf{u} + \mathbf{v}) &= \begin{bmatrix} u_1 + v_1 + u_2 + v_2 \\ u_2 + v_2 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} u_1 + u_2 \\ u_2 \end{bmatrix} + \begin{bmatrix} v_1 + v_2 \\ v_2 \end{bmatrix} \\[0.4em] &= T(\mathbf{u}) + T(\mathbf{v}), \end{aligned}

and factoring out a real number cc gives

T(cu)=[cu1+cu2cu2]=c[u1+u2u2]=c T(u).\begin{aligned} T(c\mathbf{u}) &= \begin{bmatrix} cu_1 + cu_2 \\ cu_2 \end{bmatrix} \\[0.4em] &= c\begin{bmatrix} u_1 + u_2 \\ u_2 \end{bmatrix} = c\,T(\mathbf{u}). \end{aligned}

No restriction was placed on the entries or on cc, so both properties hold for all inputs and the shear is linear.

Zero preservation

Definition A map TT from Rn\mathbb{R}^n to Rm\mathbb{R}^m preserves zero when it sends the zero vector of Rn\mathbb{R}^n to the zero vector of Rm\mathbb{R}^m,

T(0)=0.T(\mathbf{0}) = \mathbf{0}.

Every linear transformation preserves zero. Homogeneity with c=0c = 0 proves it, since T(0)=T(0u)=0 T(u)=0T(\mathbf{0}) = T(0\mathbf{u}) = 0\,T(\mathbf{u}) = \mathbf{0} for any u\mathbf{u} in Rn\mathbb{R}^n. Consequently a map with T(0)≠0T(\mathbf{0}) \ne \mathbf{0} is not linear. Zero preservation is necessary for linearity but not sufficient, because a map that preserves zero can still break additivity or homogeneity.

In plain words A linear map always sends the origin to the origin. Checking the origin is a quick way to reject a rule, but passing the check does not make a rule linear.

Example The map K(x,y)=(2x−y,x+3)K(x, y) = (2x - y, x + 3) sends 0\mathbf{0} to (0,3)(0, 3), so it is not linear, and nothing else needs checking. The map F(x,y)=(x2,y)F(x, y) = (x^2, y) does send 0\mathbf{0} to 0\mathbf{0}, yet it is not linear either, as the card on nonlinear maps below shows.

Standard unit vectors

Definition For j=1,…,nj = 1, \dots, n, the standard unit vector ej\mathbf{e}_j in Rn\mathbb{R}^n has entry 11 in position jj and 00 in every other position. In R3\mathbb{R}^3, for example, e1=(1,0,0)\mathbf{e}_1 = (1, 0, 0), e2=(0,1,0)\mathbf{e}_2 = (0, 1, 0) and e3=(0,0,1)\mathbf{e}_3 = (0, 0, 1). The ordered list (e1,…,en)(\mathbf{e}_1, \dots, \mathbf{e}_n) is called the standard basis of Rn\mathbb{R}^n. Every vector x=(x1,…,xn)\mathbf{x} = (x_1, \dots, x_n) is the combination

x=x1e1+x2e2+⋯+xnen,\mathbf{x} = x_1\mathbf{e}_1 + x_2\mathbf{e}_2 + \cdots + x_n\mathbf{e}_n,

whose coefficients are the entries of x\mathbf{x}. If TT from Rn\mathbb{R}^n to Rm\mathbb{R}^m is linear, applying additivity repeatedly and then homogeneity to each term gives

T(x)=x1T(e1)+x2T(e2)+⋯+xnT(en).\begin{aligned} T(\mathbf{x}) &= x_1T(\mathbf{e}_1) + x_2T(\mathbf{e}_2) \\[0.4em] &\quad + \cdots + x_nT(\mathbf{e}_n). \end{aligned}

So a linear map is completely determined by the nn images T(e1),…,T(en)T(\mathbf{e}_1), \dots, T(\mathbf{e}_n), and two linear maps that agree on every ej\mathbf{e}_j agree on every input.

In plain words The standard unit vectors take one step along each coordinate axis. Every vector is built from them with its own entries as weights, and a linear map keeps those weights, so knowing where each ej\mathbf{e}_j goes tells you where everything goes.

Example Suppose TT from R2\mathbb{R}^2 to R2\mathbb{R}^2 is linear with T(e1)=(3,1)T(\mathbf{e}_1) = (3, 1) and T(e2)=(−2,4)T(\mathbf{e}_2) = (-2, 4). Since (2,−1)=2e1−e2(2, -1) = 2\mathbf{e}_1 - \mathbf{e}_2,

T(2,−1)=2[31]−[−24]=[8−2].T(2, -1) = 2\begin{bmatrix} 3 \\ 1 \end{bmatrix} - \begin{bmatrix} -2 \\ 4 \end{bmatrix} = \begin{bmatrix} 8 \\ -2 \end{bmatrix}.

The word linear in the assumption does real work here. For a rule not known to be linear, the two images would say nothing about the output at (2,−1)(2, -1).

Standard matrix of a linear transformation

Definition Let TT be a linear transformation from Rn\mathbb{R}^n to Rm\mathbb{R}^m. Its standard matrix is the m×nm \times n matrix whose column jj is T(ej)T(\mathbf{e}_j),

A=[T(e1)T(e2)⋯T(en)].A = \begin{bmatrix} T(\mathbf{e}_1) & T(\mathbf{e}_2) & \cdots & T(\mathbf{e}_n) \end{bmatrix}.

Then T(x)=AxT(\mathbf{x}) = A\mathbf{x} for every x\mathbf{x} in Rn\mathbb{R}^n, because AxA\mathbf{x} is the weighted sum x1T(e1)+⋯+xnT(en)x_1T(\mathbf{e}_1) + \cdots + x_nT(\mathbf{e}_n) of the columns. No other m×nm \times n matrix has this property, since multiplying a matrix by ej\mathbf{e}_j returns its column jj, which must therefore equal T(ej)T(\mathbf{e}_j). Conversely, for every real m×nm \times n matrix AA with columns a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n, the map x↦Ax\mathbf{x} \mapsto A\mathbf{x} from Rn\mathbb{R}^n to Rm\mathbb{R}^m is linear. Indeed

A(u+v)=Au+Av,A(cu)=c Au\begin{gathered} A(\mathbf{u} + \mathbf{v}) = A\mathbf{u} + A\mathbf{v}, \\[0.4em] A(c\mathbf{u}) = c\,A\mathbf{u} \end{gathered}

for all u,v\mathbf{u}, \mathbf{v} in Rn\mathbb{R}^n and real cc, which follows from Ax=x1a1+⋯+xnanA\mathbf{x} = x_1\mathbf{a}_1 + \cdots + x_n\mathbf{a}_n by splitting each coefficient uj+vju_j + v_j into its two parts and by factoring cc out of every coefficient cujcu_j. So, with the standard coordinates fixed, the linear maps from Rn\mathbb{R}^n to Rm\mathbb{R}^m are exactly the maps x↦Ax\mathbf{x} \mapsto A\mathbf{x}, each given by exactly one matrix. The matrix need not be square.

In plain words To find the matrix of a linear map, record where each standard unit vector lands, one column for each. Multiplying by that matrix rebuilds every other output from those columns.

Example Take T(x,y)=(x+2y,3y,x−y)T(x, y) = (x + 2y, 3y, x - y) from R2\mathbb{R}^2 to R3\mathbb{R}^3. The images T(e1)=(1,0,1)T(\mathbf{e}_1) = (1, 0, 1) and T(e2)=(2,3,−1)T(\mathbf{e}_2) = (2, 3, -1) give the candidate

A=[12031−1],A = \begin{bmatrix} 1 & 2 \\ 0 & 3 \\ 1 & -1 \end{bmatrix},

of size 3×23 \times 2, with one column for each input coordinate and one row for each output coordinate. For all real xx and yy the product A(x,y)A(x, y) equals (x+2y,3y,x−y)(x + 2y, 3y, x - y), which is the formula for TT. So TT is the map x↦Ax\mathbf{x} \mapsto A\mathbf{x}, hence linear with standard matrix AA. The two images alone only suggested the candidate, and the check at an arbitrary input is what justifies it. For instance, T(2,−1)=2(1,0,1)−(2,3,−1)=(0,−3,3)T(2, -1) = 2(1, 0, 1) - (2, 3, -1) = (0, -3, 3).

Translation

Definition For a fixed vector b\mathbf{b} in Rn\mathbb{R}^n, translation by b\mathbf{b} is the map x↦x+b\mathbf{x} \mapsto \mathbf{x} + \mathbf{b} from Rn\mathbb{R}^n to Rn\mathbb{R}^n. If b≠0\mathbf{b} \ne \mathbf{0}, this map is not linear. It sends 0\mathbf{0} to b≠0\mathbf{b} \ne \mathbf{0}, and it also breaks additivity, since translating u+v\mathbf{u} + \mathbf{v} gives u+v+b\mathbf{u} + \mathbf{v} + \mathbf{b} while adding the translated vectors gives u+v+2b\mathbf{u} + \mathbf{v} + 2\mathbf{b}. Only translation by 0\mathbf{0}, which is the identity map, is linear.

In plain words Sliding every point by the same nonzero vector moves the origin, so it is never linear. Straight lines stay straight and parallel lines stay parallel under a translation, which shows that a tidy picture is not a test for linearity.

Example The map H(x,y)=(x+1,y)H(x, y) = (x + 1, y) shifts the plane one unit to the right. It sends 0\mathbf{0} to (1,0)(1, 0), which settles the question. Additivity fails as well, since H(0+0)=(1,0)H(\mathbf{0} + \mathbf{0}) = (1, 0) but H(0)+H(0)=(2,0)H(\mathbf{0}) + H(\mathbf{0}) = (2, 0). The same reasoning applies to the function f(x)=2x+1f(x) = 2x + 1 from R\mathbb{R} to R\mathbb{R}. Its graph is a straight line and school algebra calls it a linear function, but f(0)=1f(0) = 1, so it is not a linear transformation. Maps of the form x↦Ax+b\mathbf{x} \mapsto A\mathbf{x} + \mathbf{b} are called affine.

Nonlinear map

Definition A map TT from Rn\mathbb{R}^n to Rm\mathbb{R}^m is nonlinear if it is not linear, that is, if additivity fails for at least one pair of vectors u,v\mathbf{u}, \mathbf{v} or homogeneity fails for at least one vector u\mathbf{u} and one real number cc. A single explicit failure proves that a map is nonlinear. On their own, finitely many successful checks never prove linearity, which needs an argument that covers every input, such as an identity in arbitrary coordinates or a matching matrix formula. Likewise the images T(e1),…,T(en)T(\mathbf{e}_1), \dots, T(\mathbf{e}_n) alone do not determine a map that is not known to be linear.

In plain words One counterexample is enough to show that a rule is not linear. Showing that a rule is linear takes a proof for all inputs, not a list of examples that work.

Example The map F(x,y)=(x2,y)F(x, y) = (x^2, y) fixes the origin, so zero preservation does not rule it out. Doubling e1\mathbf{e}_1 first gives F(2,0)=(4,0)F(2, 0) = (4, 0), while doubling afterward gives 2F(e1)=(2,0)2F(\mathbf{e}_1) = (2, 0). Homogeneity fails, so FF is nonlinear. Notice also that F(e1)=e1F(\mathbf{e}_1) = \mathbf{e}_1 and F(e2)=e2F(\mathbf{e}_2) = \mathbf{e}_2, exactly as for the identity map, yet the two maps disagree at (2,0)(2, 0). Agreement on the standard unit vectors forces two maps to be equal when both maps are linear, but not in general.

Check yourself

  1. Show that T(x,y)=(4x−y,x+2y)T(x, y) = (4x - y, x + 2y) defines a linear transformation from R2\mathbb{R}^2 to R2\mathbb{R}^2, find its standard matrix, and compute T(1,−2)T(1, -2).
Show the answer

The images of the standard unit vectors are T(e1)=(4,1)T(\mathbf{e}_1) = (4, 1) and T(e2)=(−1,2)T(\mathbf{e}_2) = (-1, 2), so the candidate matrix is

A=[4−112].A = \begin{bmatrix} 4 & -1 \\ 1 & 2 \end{bmatrix}.

For all real xx and yy the product A(x,y)A(x, y) equals (4x−y,x+2y)(4x - y, x + 2y), so TT is the map x↦Ax\mathbf{x} \mapsto A\mathbf{x}. Every matrix map is linear, so TT is linear with standard matrix AA. Then T(1,−2)=(4+2,1−4)=(6,−3)T(1, -2) = (4 + 2, 1 - 4) = (6, -3), which agrees with the column combination 1(4,1)−2(−1,2)=(6,−3)1(4, 1) - 2(-1, 2) = (6, -3).

  1. Decide which of these maps from R2\mathbb{R}^2 to R2\mathbb{R}^2 are linear, the map G(x,y)=(x,y+1)G(x, y) = (x, y + 1), the reflection J(x,y)=(−x,y)J(x, y) = (-x, y) and the map N(x,y)=(xy,0)N(x, y) = (xy, 0).
Show the answer

The map GG sends 0\mathbf{0} to (0,1)(0, 1), so it is not linear. It is the translation by (0,1)(0, 1). The reflection JJ is linear, because for all real xx and yy

J(x,y)=[−1001][xy],J(x, y) = \begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix},

and every matrix map is linear. The map NN fixes the origin, but N(2,2)=(4,0)N(2, 2) = (4, 0) while 2N(1,1)=(2,0)2N(1, 1) = (2, 0). Homogeneity fails, so NN is not linear.

  1. A linear transformation LL from R2\mathbb{R}^2 to R3\mathbb{R}^3 satisfies L(1,1)=(2,0,1)L(1, 1) = (2, 0, 1) and L(1,−1)=(0,2,3)L(1, -1) = (0, 2, 3). Find the standard matrix of LL and compute L(3,1)L(3, 1).
Show the answer

The standard unit vectors are combinations of the given inputs, e1=12(1,1)+12(1,−1)\mathbf{e}_1 = \tfrac{1}{2}(1, 1) + \tfrac{1}{2}(1, -1) and e2=12(1,1)−12(1,−1)\mathbf{e}_2 = \tfrac{1}{2}(1, 1) - \tfrac{1}{2}(1, -1). Because LL is linear,

L(e1)=12([201]+[023])=[112],L(e2)=12([201]−[023])=[1−1−1].\begin{aligned} L(\mathbf{e}_1) &= \tfrac{1}{2}\left(\begin{bmatrix} 2 \\ 0 \\ 1 \end{bmatrix} + \begin{bmatrix} 0 \\ 2 \\ 3 \end{bmatrix}\right) = \begin{bmatrix} 1 \\ 1 \\ 2 \end{bmatrix}, \\[0.4em] L(\mathbf{e}_2) &= \tfrac{1}{2}\left(\begin{bmatrix} 2 \\ 0 \\ 1 \end{bmatrix} - \begin{bmatrix} 0 \\ 2 \\ 3 \end{bmatrix}\right) = \begin{bmatrix} 1 \\ -1 \\ -1 \end{bmatrix}. \end{aligned}

These images are the columns of the standard matrix

A=[111−12−1].A = \begin{bmatrix} 1 & 1 \\ 1 & -1 \\ 2 & -1 \end{bmatrix}.

Then L(3,1)=3(1,1,2)+(1,−1,−1)=(4,2,5)L(3, 1) = 3(1, 1, 2) + (1, -1, -1) = (4, 2, 5). As a check, (3,1)=2(1,1)+(1,−1)(3, 1) = 2(1, 1) + (1, -1), so L(3,1)=2(2,0,1)+(0,2,3)=(4,2,5)L(3, 1) = 2(2, 0, 1) + (0, 2, 3) = (4, 2, 5) as well.

How this lesson connects

It also uses function notation for an input-output rule.