Linear Transformations

Matrices as functions that move vectors while preserving linear structure.

A linear transformation is a function that takes vectors as inputs and returns vectors as outputs while preserving addition and scalar multiplication. In symbols, a transformation \(T\) is linear when

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

and

\[ T(c\mathbf{v})=cT(\mathbf{v}). \]

Matrices are the most common way to represent linear transformations.

What you should be able to do

By the end of this lesson, you should be able to:

  • interpret a matrix as a function from vectors to vectors;
  • find the image of a vector under a matrix transformation;
  • explain why basis vectors determine the whole transformation;
  • identify common transformations: scaling, reflection, projection, and shear;
  • connect algebraic matrix products to geometric movement;
  • use edumath and SymPy to test transformations.

Matrices as functions

If

\[ A=\begin{bmatrix}2&0\\0&3\end{bmatrix}, \]

then the rule \(T(\mathbf{x})=A\mathbf{x}\) sends

\[ \begin{bmatrix}x\\y\end{bmatrix} \mapsto \begin{bmatrix}2x\\3y\end{bmatrix}. \]

So this transformation stretches horizontal coordinates by 2 and vertical coordinates by 3.

Basis vectors

The standard basis vectors in the plane are

\[ \mathbf{e}_1=\begin{bmatrix}1\\0\end{bmatrix}, \qquad \mathbf{e}_2=\begin{bmatrix}0\\1\end{bmatrix}. \]

Every vector \(\begin{bmatrix}x\\y\end{bmatrix}\) can be written as

\[ x\mathbf{e}_1+y\mathbf{e}_2. \]

Because a linear transformation preserves combinations, once you know where \(\mathbf{e}_1\) and \(\mathbf{e}_2\) go, you know the transformation of every vector.

NoteColumns tell the story

For a \(2\times2\) matrix, the first column is where \(\mathbf{e}_1\) goes and the second column is where \(\mathbf{e}_2\) goes.

Common transformations

Scaling

\[ \begin{bmatrix}2&0\\0&2\end{bmatrix} \]

doubles every vector.

Reflection over the x-axis

\[ \begin{bmatrix}1&0\\0&-1\end{bmatrix} \]

keeps \(x\) the same and flips the sign of \(y\).

Projection onto the x-axis

\[ \begin{bmatrix}1&0\\0&0\end{bmatrix} \]

sends \((x,y)\) to \((x,0)\).

Shear

\[ \begin{bmatrix}1&1\\0&1\end{bmatrix} \]

sends \((x,y)\) to \((x+y,y)\). It slants the plane without changing horizontal levels.

Worked example: identify a transformation

Let

\[ A=\begin{bmatrix}1&0\\0&-1\end{bmatrix}. \]

Apply \(A\) to a general vector:

\[ A\begin{bmatrix}x\\y\end{bmatrix} = \begin{bmatrix}x\\-y\end{bmatrix}. \]

The \(x\)-coordinate is unchanged, and the \(y\)-coordinate changes sign. Points above the x-axis move below it, and points below move above it. This is a reflection over the x-axis.

What linear transformations preserve

Linear transformations always preserve:

  • the zero vector: \(T(\mathbf{0})=\mathbf{0}\);
  • vector addition;
  • scalar multiplication;
  • lines through the origin.

They do not necessarily preserve length, angle, or area. Some do, but many do not.

WarningCommon pitfall

A transformation can be linear even if it changes lengths and angles. Linearity is about preserving addition and scalar multiplication, not about preserving geometry exactly.

Practice exercises

  1. What does \(\begin{bmatrix}3&0\\0&3\end{bmatrix}\) do to every vector?
  2. What does \(\begin{bmatrix}1&0\\0&0\end{bmatrix}\) do to \((4,5)\)?
  3. What are the images of \(\mathbf{e}_1\) and \(\mathbf{e}_2\) under \(A=\begin{bmatrix}2&1\\0&3\end{bmatrix}\)?
  4. Is \(T(x,y)=(x+1,y)\) linear?
  5. Compute \(\begin{bmatrix}1&1\\0&1\end{bmatrix}\begin{bmatrix}2\\3\end{bmatrix}\).
  1. It scales every vector by 3.
  2. It sends \((4,5)\) to \((4,0)\), a projection onto the x-axis.
  3. \(\mathbf{e}_1\) goes to \(\begin{bmatrix}2\\0\end{bmatrix}\) and \(\mathbf{e}_2\) goes to \(\begin{bmatrix}1\\3\end{bmatrix}\).
  4. No. It sends \((0,0)\) to \((1,0)\), but a linear transformation must send the zero vector to the zero vector.
  5. \(\begin{bmatrix}5\\3\end{bmatrix}\).

Subtopic guided practice and checkpoints

A matrix transformation is a rule: input vector in, output vector out. The columns show what happens to the standard basis vectors.

Lab 1: apply a transformation to one vector

Guess first. If \(T(x,y)=(2x,3y)\), what happens to the point \((1,1)\)?

Guided exercise.

Let

\[ A=\begin{bmatrix}2&0\\0&3\end{bmatrix}, \qquad \mathbf{v}=\begin{bmatrix}1\\4\end{bmatrix}. \]

Compute

\[ A\mathbf{v}=\begin{bmatrix}2(1)+0(4)\\0(1)+3(4)\end{bmatrix} =\begin{bmatrix}2\\12\end{bmatrix}. \]

So the vector moves from \((1,4)\) to \((2,12)\) under the transformation.

Checkpoint. Compute \(\begin{bmatrix}1&1\\0&1\end{bmatrix}\begin{bmatrix}3\\2\end{bmatrix}\) and interpret the movement.

Lab 2: read columns as images of basis vectors

Guess first. For \(A=\begin{bmatrix}2&5\\1&3\end{bmatrix}\), where does \(\mathbf{e}_1\) go?

Guided exercise.

The first column tells where \(\mathbf{e}_1\) goes, and the second column tells where \(\mathbf{e}_2\) goes:

\[ \mathbf{e}_1\mapsto\begin{bmatrix}2\\1\end{bmatrix}, \qquad \mathbf{e}_2\mapsto\begin{bmatrix}5\\3\end{bmatrix}. \]

Then any vector \(\begin{bmatrix}x\\y\end{bmatrix}\) maps to \(x\) times the first column plus \(y\) times the second column.

Checkpoint. For \(A=\begin{bmatrix}0&1\\-1&0\end{bmatrix}\), find the images of \(\mathbf{e}_1\) and \(\mathbf{e}_2\).

Lab 3: identify common transformations from their formulas

Guess first. What does \(T(x,y)=(x,0)\) do to the plane?

Guided exercise.

The transformation \(T(x,y)=(x,0)\) keeps the horizontal coordinate and removes the vertical coordinate. Every point lands on the x-axis, so this is projection onto the x-axis.

Compare common forms:

(x, y) -> (2x, 2y)     scaling by 2
(x, y) -> (x, -y)      reflection over the x-axis
(x, y) -> (x, 0)       projection onto the x-axis
(x, y) -> (x+y, y)     horizontal shear

Checkpoint. Identify \(T(x,y)=(-x,y)\) and \(T(x,y)=(x+2y,y)\).

Lab 4: test whether a rule can be linear

Guess first. Can a linear transformation send \((0,0)\) to \((1,0)\)?

Guided exercise.

Every linear transformation must satisfy \(T(\mathbf{0})=\mathbf{0}\). The rule

\[ T(x,y)=(x+1,y) \]

sends \((0,0)\) to \((1,0)\), so it cannot be linear. It is a translation, not a linear transformation.

Checkpoint. Decide whether \(T(x,y)=(3x,3y)\) can be linear, and whether \(S(x,y)=(x,y-2)\) can be linear. Use the zero-vector test.

Lab 5: connect geometry to repeated application

Guess first. If a matrix doubles every vector, what happens after applying it three times?

Guided exercise.

The scaling matrix

\[ A=\begin{bmatrix}2&0\\0&2\end{bmatrix} \]

doubles every vector. Applying it three times multiplies the vector by \(2\cdot2\cdot2=8\).

Checkpoint. If \(A=\begin{bmatrix}1&0\\0&-1\end{bmatrix}\) reflects over the x-axis, what happens when you apply \(A\) twice?

  1. \(\begin{bmatrix}1&1\\0&1\end{bmatrix}\begin{bmatrix}3\\2\end{bmatrix}= \begin{bmatrix}5\\2\end{bmatrix}\). The shear adds the vertical coordinate to the horizontal coordinate and keeps the vertical coordinate.
  2. \(\mathbf{e}_1\mapsto\begin{bmatrix}0\\-1\end{bmatrix}\) and \(\mathbf{e}_2\mapsto\begin{bmatrix}1\\0\end{bmatrix}\).
  3. \(T(x,y)=(-x,y)\) reflects over the y-axis. \(T(x,y)=(x+2y,y)\) is a horizontal shear.
  4. \(T(x,y)=(3x,3y)\) passes the zero-vector test and can be linear. \(S(x,y)=(x,y-2)\) fails because \(S(0,0)=(0,-2)\).
  5. Applying the reflection twice returns every vector to its original position.

Transformation guessing game

Guess the geometric action from a matrix or a property.

Using this lesson with edumath and SymPy

The edumath plotting helpers create Matplotlib scenes that can be rendered in Python environments. SymPy can verify the algebra exactly.

from edumath.linear_algebra import matrix_vector_product

A = [[1, 1], [0, 1]]
v = [2, 3]
print(matrix_vector_product(A, v))
[5. 3.]
import sympy as sp

x, y = sp.symbols("x y")
A = sp.Matrix([[1, 1], [0, 1]])
vector = sp.Matrix([x, y])
A * vector

\(\displaystyle \left[\begin{matrix}x + y\\y\end{matrix}\right]\)

from edumath.linear_algebra import basis_transformation_scene

scene = basis_transformation_scene([[1, 1], [0, 1]])
# In a Python display environment, use: scene.render()
scene.title
'Matrix transformation'