Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 2: Linear Transformations and Matrices
Linear Algebra

Foundations

  1. 01Start Here: Python and the Math the Labs Use
  1. 02Week 1: Vectors and Linear Combinations
  2. 03Week 2: Linear Transformations and Matrices
  3. 04Week 3: Elimination and LU Factorization
  4. 05Week 4: Determinants
  5. 06Week 5: Vector Spaces, Independence, and Basis
  6. 07Week 6: The Four Fundamental Subspaces
  7. 08Week 7: Orthogonality and Projections
  8. 09Week 8: Least Squares and QR
  9. 10Week 9: Eigenvalues and Eigenvectors
  10. 11Week 10: Diagonalization and Markov Matrices
  11. 12Week 11: Differential Equations
  12. 13Week 12: Symmetric and Positive Definite Matrices
  13. 14Week 13: The SVD and Complex Matrices
  14. 15Week 14: PCA, the Fourier Matrix and the FFT
Week 02· Linear Algebra5 min read

Week 2: Linear Transformations and Matrices

A unit square sits on a grid. Move one entry and the grid moves with it.

Signed area ad − bc = 1.00. Columns (1.0, 0.0) and (0.0, 1.0).

The four sliders are the entries of a matrix

A=(abcd).A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}.A=(ac​bd​).

The amber arrow is the first column, where (1,0)(1, 0)(1,0) lands. The teal arrow is the second column, where (0,1)(0, 1)(0,1) lands. The tinted parallelogram is the image of the unit square. Its signed area is ad−bcad - bcad−bc. A positive area keeps the square's orientation. A negative area flips it. Zero flattens the square onto a line.

The grid is where the integer lines go. Because the map sends lines to lines, the whole grid is fixed once those two columns are known.

Learning Outcomes
  • Read a 2 by 2 matrix as the images of the two basis arrows
  • Watch the signed area change when one entry changes
  • Multiply two matrices as one map after the other
  • Name a rotation, a scale, and a projection from their matrices
Prerequisites

Background knowledge assumed:

  • Vectors, linear combinations, and the dot product

Recommended: Review Week 1: Vectors and Linear Combinations before starting.

What the sliders are doing#

A map TTT from the plane to the plane is linear when it respects both operations from Week 1.

T(u+v)=T(u)+T(v),T(cu)=c T(u).T(u + v) = T(u) + T(v), \qquad T(cu) = c\, T(u).T(u+v)=T(u)+T(v),T(cu)=cT(u).

Those two rules decide TTT everywhere once you know T(1,0)T(1, 0)T(1,0) and T(0,1)T(0, 1)T(0,1). The matrix stores exactly those two images as its columns, and

A(xy)=x(ac)+y(bd).A \begin{pmatrix} x \\ y \end{pmatrix} = x \begin{pmatrix} a \\ c \end{pmatrix} + y \begin{pmatrix} b \\ d \end{pmatrix}.A(xy​)=x(ac​)+y(bd​).

Set a=2a = 2a=2 and leave the other sliders at the identity. Horizontal distances double, and the signed area goes from 111 to 222. Set b=1b = 1b=1 instead. The square shears into a parallelogram and the area stays 111, because ad−bc=1ad - bc = 1ad−bc=1. Set d=−1d = -1d=−1. The teal arrow reverses and the area becomes negative.

Composition#

The product ABABAB is the matrix of "do BBB, then do AAA".

(AB)x=A(Bx).(AB)x = A(Bx).(AB)x=A(Bx).

The columns of ABABAB are AAA applied to the columns of BBB. Order matters. A shear followed by a rotation is not a rotation followed by that shear. The same rule builds the elementary matrices of Week 3.

Three maps worth naming#

Rotation by 90∘90^\circ90∘ counterclockwise.

R=(0−110).R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}.R=(01​−10​).

(1,0)(1, 0)(1,0) goes to (0,1)(0, 1)(0,1). The square keeps its area, since det⁡R=1\det R = 1detR=1. The lab plots this turn.

Scale. (2001)\begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}(20​01​) doubles horizontal distances and leaves vertical ones alone.

Projection onto the xxx-axis. (1000)\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}(10​00​) sends (x,y)(x, y)(x,y) to (x,0)(x, 0)(x,0). The square collapses to a segment, the signed area is 000, and applying the map twice changes nothing.

These three are the language of rigid motion in Robot Learning Week 1.

A = [[1,1],[0,1]] shears the unit square a1 = (1,0) a2 = (1,1) original

The unit square and its image under the shear with columns (1,0)(1, 0)(1,0) and (1,1)(1, 1)(1,1). The signed area stays 111.

Knowledge Check#

Question 1 of 4

If T(u+v) = T(u) + T(v) and T(cu) = cT(u) for all vectors u, v and scalars c, T is called a ___ transformation.

Browser lab: rotation matrix on a square#

The cell applies the 90∘90^\circ90∘ rotation. Run it, then set the sliders to a=0a = 0a=0, b=−1b = -1b=−1, c=1c = 1c=1, d=0d = 0d=0 and compare the picture with the plot.

python · runs in browser
import numpy as np
import matplotlib.pyplot as plt

theta = np.pi / 2
R = np.array([[np.cos(theta), -np.sin(theta)],
              [np.sin(theta),  np.cos(theta)]])

square = np.array([[0, 1, 1, 0, 0],
                    [0, 0, 1, 1, 0]])

rotated = R @ square

fig, ax = plt.subplots(figsize=(5, 5))
ax.plot(square[0], square[1], "o-", color="tab:blue", label="original")
ax.plot(rotated[0], rotated[1], "o-", color="tab:orange", label="rotated 90°")
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
ax.set_aspect("equal")
ax.axhline(0, color="gray", linewidth=0.5)
ax.axvline(0, color="gray", linewidth=0.5)
ax.legend()
ax.set_title("A square before and after applying R")
plt.show()

print("R =\n", R)

Key takeaways#

  • A linear map of the plane is the two columns of a matrix.
  • The grid is the image of the integer lines.
  • The signed area of the unit square is ad−bcad - bcad−bc.
  • The product ABABAB means do BBB, then do AAA.

Further reading#

  • Gilbert Strang, Introduction to Linear Algebra (5th ed., Wellesley-Cambridge Press, 2016). Chapter 2.
  • David C. Lay, Steven R. Lay, and Judi J. McDonald, Linear Algebra and Its Applications (6th ed., Pearson, 2021). Sections 1.8 and 1.9.
  • 3Blue1Brown, Essence of Linear Algebra. The videos on linear transformations and on matrix multiplication.
  • Stephen Boyd and Lieven Vandenberghe, Introduction to Applied Linear Algebra (Cambridge University Press, 2018). Chapter 6, free at vmls-book.stanford.edu.

Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.

← Previous
Week 1: Vectors and Linear Combinations
Next →
Week 3: Elimination and LU Factorization
On this page
  • What the sliders are doing
  • Composition
  • Three maps worth naming
  • Knowledge Check
  • Browser lab: rotation matrix on a square
  • Key takeaways
  • Further reading