MAT1041 · Week 10 · - Introduction to Linear Transformations

Introduction to linear transformations

You learn to test with two conditions whether a function is a linear transformation, matrix transformations, projection, reflection and rotation in the plane, abstract examples such as the derivative and trace, and how to compute a linear transformation from the images of a basis.

linear transformationmappingdomaincodomainimagepreimageadditivityhomogeneitymatrix transformationzero transformationidentity transformationprojectionreflectionrotationdifferential operator

So far we have studied vector spaces one at a time. This week we move to functions between spaces. Not every function is interesting: the functions linear algebra cares about are those that preserve addition and scalar multiplication. These are called linear transformations, and we will meet a surprising fact: every linear transformation from Rn\mathbb{R}^n to Rm\mathbb{R}^m is in fact multiplication by a matrix. All the remaining weeks (kernel, image, transformation matrix, eigenvalue) continue this idea.

Golden rules:

  1. First test: is T(0)=0T(\mathbf{0}) = \mathbf{0}? If not, it is not linear, done.
  2. If T(0)=0T(\mathbf{0}) = \mathbf{0} it is not enough: prove the two conditions in general or find a counterexample.
  3. If you can write it in the form T(x)=AxT(\mathbf{x}) = A\mathbf{x}, it is linear.
  4. If the images of a basis are given, first write the vector in that basis, then use linearity.

Definition

Let VV and WW be vector spaces. A function T:V→WT : V \to W is a linear transformation if for all u,v∈V\mathbf{u}, \mathbf{v} \in V and all c∈Rc \in \mathbb{R}

  1. T(u+v)=T(u)+T(v)T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v}) (preserves addition),
  2. T(cu)=cT(u)T(c\mathbf{u}) = cT(\mathbf{u}) (preserves scalar multiplication).

VV is the domain, WW the codomain. T(v)T(\mathbf{v}) is the image of v\mathbf{v}; all v\mathbf{v} with T(v)=wT(\mathbf{v}) = \mathbf{w} are the preimage of w\mathbf{w}.

The two conditions in one line: T(au+bv)=aT(u)+bT(v)T(a\mathbf{u} + b\mathbf{v}) = aT(\mathbf{u}) + bT(\mathbf{v}). A linear transformation sends linear combinations to linear combinations.

Immediate properties

  • T(0)=0T(\mathbf{0}) = \mathbf{0} (take c=0c = 0).
  • T(−v)=−T(v)T(-\mathbf{v}) = -T(\mathbf{v}), T(u−v)=T(u)−T(v)T(\mathbf{u} - \mathbf{v}) = T(\mathbf{u}) - T(\mathbf{v}).
  • T(c1v1+⋯+cnvn)=c1T(v1)+⋯+cnT(vn)T(c_1\mathbf{v}_1 + \dots + c_n\mathbf{v}_n) = c_1T(\mathbf{v}_1) + \dots + c_nT(\mathbf{v}_n).

The first is the most useful elimination test: if T(0)≠0T(\mathbf{0}) \neq \mathbf{0}, the transformation is not linear.

Linear or not?

Example 1 (yes). T(x,y)=(2x−y, x+3y)T(x, y) = (2x - y,\ x + 3y).

u = (x1,y1), v = (x2,y2)
T(u + v) = (2(x1+x2) - (y1+y2), (x1+x2) + 3(y1+y2))
         = (2x1 - y1, x1 + 3y1) + (2x2 - y2, x2 + 3y2) = T(u) + T(v)
T(cu)    = (2cx1 - cy1, cx1 + 3cy1) = c(2x1 - y1, x1 + 3y1) = cT(u)

Sample value: T(1,4)=(2−4,1+12)=(−2,13)T(1, 4) = (2 - 4, 1 + 12) = (-2, 13).

Example 2 (no). The translation T(x,y)=(x+2,y)T(x, y) = (x + 2, y): T(0,0)=(2,0)T(0, 0) = (2, 0). Although shifting everything in the plane to the right looks geometrically “smooth”, it is not linear.

TransformationLinear?Reason
(x,y)↦(3x,x−y)(x, y) \mapsto (3x, x - y)yescombinations with constant coefficients
(x,y)↦(x+1,y)(x, y) \mapsto (x + 1, y)noT(0)≠0T(\mathbf{0}) \neq \mathbf{0}
(x,y)↦(x2,y)(x, y) \mapsto (x^2, y)noT(2e1)=(4,0)≠2T(e1)T(2\mathbf{e}_1) = (4, 0) \neq 2T(\mathbf{e}_1)
(x,y)↦(xy,x)(x, y) \mapsto (xy, x)noproduct; Q4
(x,y)↦(∣x∣,y)(x, y) \mapsto (\lvert x \rvert, y)noT(−e1)=(1,0)≠−T(e1)T(-\mathbf{e}_1) = (1, 0) \neq -T(\mathbf{e}_1)
p↦p′p \mapsto p' (Pn→Pn−1P_n \to P_{n-1})yesrules of differentiation
A↦ATA \mapsto A^Tyes(A+B)T=AT+BT(A + B)^T = A^T + B^T
A↦tr⁡AA \mapsto \operatorname{tr}Ayesthe trace respects addition and scalars
A↦det⁡AA \mapsto \det Anodet⁡(2I)=4≠2\det(2I) = 4 \neq 2

PITFALL · “T(0) = 0, so it is linear”. This is only a necessary condition. (x,y)↦(xy,x)(x, y) \mapsto (xy, x) sends zero to zero but is not linear. Look for the counterexample in one of the two conditions.

Matrix transformations

If AA is an m×nm \times n matrix, then

T(x)=AxT(\mathbf{x}) = A\mathbf{x}

is a linear transformation from Rn\mathbb{R}^n to Rm\mathbb{R}^m, because 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}. Watch the sizes: the input space is determined by the number of columns of AA.

Example 3. A=[1−10213]A = \begin{bmatrix} 1 & -1 & 0 \\ 2 & 1 & 3 \end{bmatrix}, T:R3→R2T : \mathbb{R}^3 \to \mathbb{R}^2:

T(2,1,−1)=[1−10213][21−1]=[2−1+04+1−3]=[12].T(2, 1, -1) = \begin{bmatrix} 1 & -1 & 0 \\ 2 & 1 & 3 \end{bmatrix}\begin{bmatrix} 2 \\ 1 \\ -1 \end{bmatrix} = \begin{bmatrix} 2 - 1 + 0 \\ 4 + 1 - 3 \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}.

Finding a preimage is solving a system: Ax=wA\mathbf{x} = \mathbf{w}. If there is no solution, the preimage of w\mathbf{w} is empty; if there are infinitely many, the preimage is a line or a plane.

Geometric transformations in the plane

TransformationMatrixImage of (3,5)(3, 5)
Projection onto the xx-axis[1000]\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}(3,0)(3, 0)
Reflection about the line y=xy = x[0110]\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}(5,3)(5, 3)
Reflection about the xx-axis[100−1]\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}(3,−5)(3, -5)
Rotation by θ\theta[cos⁡θ−sin⁡θsin⁡θcos⁡θ]\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}
Dilation by a factor kkkIkI(3k,5k)(3k, 5k)

A basis is enough

The most powerful property of a linear transformation: knowing the images of a basis is knowing everything. If {v1,…,vn}\{\mathbf{v}_1, \dots, \mathbf{v}_n\} is a basis of VV, every v\mathbf{v} is written uniquely as c1v1+⋯+cnvnc_1\mathbf{v}_1 + \dots + c_n\mathbf{v}_n and

T(v)=c1T(v1)+⋯+cnT(vn).T(\mathbf{v}) = c_1T(\mathbf{v}_1) + \dots + c_nT(\mathbf{v}_n).

Example 4 (standard basis). T:R3→R2T : \mathbb{R}^3 \to \mathbb{R}^2, T(e1)=(1,2)T(\mathbf{e}_1) = (1, 2), T(e2)=(0,−1)T(\mathbf{e}_2) = (0, -1), T(e3)=(4,1)T(\mathbf{e}_3) = (4, 1).

T(2,−1,3)=2(1,2)−(0,−1)+3(4,1)=(2+0+12, 4+1+3)=(14,8).T(2, -1, 3) = 2(1, 2) - (0, -1) + 3(4, 1) = (2 + 0 + 12,\ 4 + 1 + 3) = (14, 8).

If you put these images side by side as columns you get the standard matrix of TT: [1042−11]\begin{bmatrix} 1 & 0 & 4 \\ 2 & -1 & 1 \end{bmatrix}. This is the topic of week 12.

If a nonstandard basis is given (Q8, Q12), first find the coefficients with a system. In Q12 we did this for a general (x,y)(x, y) and obtained the formula for TT.

Linear transformations in abstract spaces

  • Derivative D:P3→P2D : P_3 \to P_2, D(a+bx+cx2+dx3)=b+2cx+3dx2D(a + bx + cx^2 + dx^3) = b + 2cx + 3dx^2.
  • Integral I:P2→RI : P_2 \to \mathbb{R}, I(p)=∫01p(x) dxI(p) = \int_0^1 p(x)\,dx.
  • Transpose T:Mm,n→Mn,mT : M_{m,n} \to M_{n,m}, T(A)=ATT(A) = A^T.
  • Evaluation T:P2→RT : P_2 \to \mathbb{R}, T(p)=p(3)T(p) = p(3).
  • Zero transformation T(v)=0T(\mathbf{v}) = \mathbf{0} and identity transformation T(v)=vT(\mathbf{v}) = \mathbf{v}.

The rule from calculus “the derivative of a sum is the sum of the derivatives” is really saying that the derivative is a linear transformation.

Common mistakes

WrongRight
Thinking T(0)=0T(\mathbf{0}) = \mathbf{0} is sufficientNecessary but not sufficient
“Proving” linearity with a single numerical exampleShow it with general u,v,c\mathbf{u}, \mathbf{v}, c
Writing the transformation of a 2×32 \times 3 matrix as R2→R3\mathbb{R}^2 \to \mathbb{R}^3R3→R2\mathbb{R}^3 \to \mathbb{R}^2 (input = number of columns)
Thinking translations and affine functions (x+1x + 1) are linearA constant term breaks linearity
Using the images of a nonstandard basis as if they were the standard basisFirst write the vector in that basis
Thinking det⁡\det is lineardet⁡(cA)=cndet⁡A\det(cA) = c^n\det A
Assuming the preimage is always a single pointIt can be empty, a single point or infinite

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Let T(x,y)=(x+2y, 3x−y)T(x, y) = (x + 2y,\ 3x - y). Find T(2,−1)T(2, -1).

Show answer
(0,7)(0, 7)

x=2x = 2, y=−1y = -1: (2+2(−1), 3(2)−(−1))=(0,7)(2 + 2(-1),\ 3(2) - (-1)) = (0, 7).

Question 2easy

Is T:R2→R2T : \mathbb{R}^2 \to \mathbb{R}^2, T(x,y)=(x+1, y)T(x, y) = (x + 1,\ y) a linear transformation?

Show answer
No

A linear transformation must send zero to zero. T(0,0)=(1,0)≠(0,0)T(0, 0) = (1, 0) \neq (0, 0).
This is a translation; adding a constant term breaks linearity.

Question 3medium

Is T:R3→R2T : \mathbb{R}^3 \to \mathbb{R}^2, T(x,y,z)=(x−y, 2z)T(x, y, z) = (x - y,\ 2z) a linear transformation?

Show answer
Yes

u=(x1,y1,z1)\mathbf{u} = (x_1, y_1, z_1), v=(x2,y2,z2)\mathbf{v} = (x_2, y_2, z_2): T(u+v)=((x1+x2)−(y1+y2), 2(z1+z2))=T(u)+T(v)T(\mathbf{u} + \mathbf{v}) = ((x_1 + x_2) - (y_1 + y_2),\ 2(z_1 + z_2)) = T(\mathbf{u}) + T(\mathbf{v}).T(cu)=(cx−cy, 2cz)=cT(u)T(c\mathbf{u}) = (cx - cy,\ 2cz) = cT(\mathbf{u}).
Shortcut: T(x)=AxT(\mathbf{x}) = A\mathbf{x}, A=[1−10002]A = \begin{bmatrix} 1 & -1 & 0 \\ 0 & 0 & 2 \end{bmatrix}.

Question 4medium

Is T(x,y)=(xy, x)T(x, y) = (xy,\ x) a linear transformation from R2\mathbb{R}^2 to R2\mathbb{R}^2?

Show answer
No

T(0,0)=(0,0)T(0, 0) = (0, 0), this test is passed but it is not enough.T(2(1,1))=T(2,2)=(4,2)T(2(1, 1)) = T(2, 2) = (4, 2), but 2T(1,1)=2(1,1)=(2,2)2T(1, 1) = 2(1, 1) = (2, 2). Scalar multiplication is not preserved.
If the variables are multiplied, it is not linear.

Question 5medium

Let T(v)=AvT(\mathbf{v}) = A\mathbf{v} with A=[102−131]A = \begin{bmatrix} 1 & 0 & 2 \\ -1 & 3 & 1 \end{bmatrix}. Find T(1,2,−1)T(1, 2, -1). What are the domain and codomain of TT?

Show answer
(−1,4)(-1, 4); T:R3→R2T : \mathbb{R}^3 \to \mathbb{R}^2

AA is 2×32 \times 3: the input has 3 components, the output has 2. T:R3→R2T : \mathbb{R}^3 \to \mathbb{R}^2.A(1,2,−1)T=(1+0−2, −1+6−1)=(−1,4)A(1, 2, -1)^T = (1 + 0 - 2,\ -1 + 6 - 1) = (-1, 4).

Question 6medium

Let T(x,y)=(x+y, x−y)T(x, y) = (x + y,\ x - y). Find the preimage of w=(5,1)\mathbf{w} = (5, 1).

Show answer
(3,2)(3, 2)

Preimage: all v\mathbf{v} with T(v)=wT(\mathbf{v}) = \mathbf{w}. x+y=5x + y = 5, x−y=1x - y = 1.
Add: 2x=62x = 6, x=3x = 3, y=2y = 2. The preimage is a single point: {(3,2)}\{(3, 2)\}.

Question 7medium

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

Show answer
(8,1)(8, 1)

(3,−2)=3(1,0)−2(0,1)(3, -2) = 3(1, 0) - 2(0, 1). Linearity: T(3,−2)=3T(1,0)−2T(0,1)=(6,9)−(−2,8)=(8,1)T(3, -2) = 3T(1, 0) - 2T(0, 1) = (6, 9) - (-2, 8) = (8, 1).

Question 8hard

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

Show answer
(9,4,6)(9, 4, 6)

First write (5,1)(5, 1) in the given basis: a(1,1)+b(1,−1)=(5,1)a(1, 1) + b(1, -1) = (5, 1), a+b=5a + b = 5, a−b=1a - b = 1, so a=3a = 3, b=2b = 2.T(5,1)=3T(1,1)+2T(1,−1)=(3,0,6)+(6,4,0)=(9,4,6)T(5, 1) = 3T(1, 1) + 2T(1, -1) = (3, 0, 6) + (6, 4, 0) = (9, 4, 6).

Question 9medium

Let D:P2→P1D : P_2 \to P_1 be differentiation, D(p)=p′D(p) = p'. Find D(3−x+4x2)D(3 - x + 4x^2). Is DD linear?

Show answer
−1+8x-1 + 8x; yes

(3−x+4x2)′=−1+8x(3 - x + 4x^2)' = -1 + 8x.
The rules of differentiation are exactly the linearity conditions: (p+q)′=p′+q′(p + q)' = p' + q', (cp)′=cp′(cp)' = cp'.

Question 10medium

Is T:M2,2→RT : M_{2,2} \to \mathbb{R}, T(A)=det⁡AT(A) = \det A a linear transformation?

Show answer
No

T(2I)=det⁡(2I)=4T(2I) = \det(2I) = 4, but 2T(I)=22T(I) = 2. Also det⁡(A+B)≠det⁡A+det⁡B\det(A + B) \neq \det A + \det B.
In contrast, T(A)=tr⁡AT(A) = \operatorname{tr}A and T(A)=ATT(A) = A^T are linear.

Question 11hard

Let TT rotate vectors in R2\mathbb{R}^2 counterclockwise by 90∘90^\circ. Find T(3,1)T(3, 1).

Show answer
(−1,3)(-1, 3)

The rotation matrix is [cos⁡θ−sin⁡θsin⁡θcos⁡θ]\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}, for θ=90∘\theta = 90^\circ: [0−110]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}.T(x,y)=(−y,x)T(x, y) = (-y, x), T(3,1)=(−1,3)T(3, 1) = (-1, 3). Check: (3,1)⋅(−1,3)=0(3, 1) \cdot (-1, 3) = 0, perpendicular.

Question 12hard

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

Show answer
T(x,y)=(13x−5y, −7x+3y)T(x, y) = (13x - 5y,\ -7x + 3y)

(x,y)=a(1,2)+b(2,5)(x, y) = a(1, 2) + b(2, 5): a+2b=xa + 2b = x, 2a+5b=y2a + 5b = y. R2−2R1R_2 - 2R_1: b=y−2xb = y - 2x, then a=x−2b=5x−2ya = x - 2b = 5x - 2y.T(x,y)=(5x−2y)(3,−1)+(y−2x)(1,1)=(13x−5y, −7x+3y)T(x, y) = (5x - 2y)(3, -1) + (y - 2x)(1, 1) = (13x - 5y,\ -7x + 3y).
Check: T(1,2)=(13−10,−7+6)=(3,−1)T(1, 2) = (13 - 10, -7 + 6) = (3, -1).

Verification: The transformations that are linear were tested in node by checking the equalities T(u+v) = T(u)+T(v), T(cu) = cT(u) with 200 random integer vector pairs and scalars using BigInt fractions, and the nonlinear ones by computing a concrete counterexample; the images and preimages were found with exact matrix multiplication and exact solution (verify/MAT1041/10.mjs).

Review card

T: V → W is linear ⇔ (1) T(u+v) = T(u) + T(v) (2) T(cu) = cT(u) in one line: T(au + bv) = aT(u) + bT(v) Quick ELIMINATION: T(0) ≠ 0 → NOT linear. (T(0) = 0 alone is not enough!) "No" signs: constant term (x+1), product (xy), square, |x|, sin, det. "Yes" signs: every component is a sum of constant multiples of the variables → T(x) = Ax. T(x) = Ax, A m×n → T: Rⁿ → Rᵐ (input = number of COLUMNS). Image T(v); preimage: solve the system T(v) = w (none / one / infinitely many). T is COMPLETELY determined by the images of a basis: v = c1v1 + ... + cnvn → T(v) = c1T(v1) + ... + cnT(vn) Plane: rotation by θ [cos -sin; sin cos], projection onto the x-axis [1 0; 0 0], reflection about y=x [0 1; 1 0], reflection about the x-axis [1 0; 0 -1]. Abstract: derivative, integral, transpose, trace are LINEAR; det is NOT LINEAR. T(-v) = -T(v), T(u - v) = T(u) - T(v).