Home/Learn/Math for AI/Linear Transformations & Geometric Intuition

Linear Transformations & Geometric Intuition

Intermediate
Linear Algebra

A matrix is not just a grid of numbers — it is a function that rotates, scales, and shears space, and seeing it that way makes every neural-net layer intuitive.

Overview

The deepest way to understand linear algebra is geometric: multiplying a vector by a matrix transforms space. The matrix's columns tell you where the basis vectors (the arrows along each axis) land, and every point moves accordingly — rotations, stretches, flips, and shears are all matrix multiplications. This reframes a neural network layer: XW does not just "mix numbers", it moves your data to a new coordinate system where the next layer can separate it more easily. Concepts like eigenvectors (directions the transformation leaves pointing the same way) and SVD (any transformation = rotate, scale, rotate) only make sense once you hold this picture. When you hear "the model learns a good representation", it means it learned transformations that reshape messy data into a space where classes pull apart.

A matrix moves space; its columns are where axes land

Apply a matrix to the unit vectors and you see exactly what it does. A rotation matrix spins them; a diagonal matrix stretches them. Every data point follows the same transformation.

A matrix = where the basis vectors go
import numpy as np

# 90-degree rotation matrix
theta = np.pi / 2
R = np.array([[np.cos(theta), -np.sin(theta)],
              [np.sin(theta),  np.cos(theta)]])

e1 = np.array([1.0, 0.0])     # x-axis unit vector
e2 = np.array([0.0, 1.0])     # y-axis unit vector
print(np.round(R @ e1, 3))    # [0. 1.]  -> x-axis lands on y-axis
print(np.round(R @ e2, 3))    # [-1. 0.] -> y-axis lands on -x-axis

A layer transforms data into a friendlier space

Think of XW as relocating every example. A good learned W moves the data so that later layers (or a simple boundary) can separate the classes. "Representation learning" is just learning useful transformations.

Layers reshape data so classes become separable
import numpy as np

# Scale x by 3, y by 0.5 -> stretches a cloud of points
S = np.array([[3.0, 0.0],
              [0.0, 0.5]])
points = np.array([[1.0, 2.0],
                   [2.0, 1.0]])
print(points @ S.T)   # each point re-scaled into the new space

Key Points to Remember

  • 1A matrix is a function that transforms space (rotate, scale, shear, flip)
  • 2The columns of a matrix show where the basis (axis) vectors land
  • 3A neural layer XW relocates data into a new coordinate system
  • 4"Representation learning" = learning transformations that make data separable

Interview Questions

Sign in to ask Aria
1

Explain what it means geometrically to multiply a vector by a matrix.

MediumProduct
2

How does viewing a layer as a linear transformation help explain representation learning?

HardGoogle
3

What do the columns of a transformation matrix represent?

MediumAmazon

Ask Aria about Linear Transformations & Geometric Intuition

Your personal AI tutor — ask anything about this concept

Revision Status

Personal Notes

Sign in to save personal notes for this topic.

Discussion

Sign in to join the discussion.

Loading discussion…