Skip to content
AI-grafen
EUniversityMathematics· about 60 min· evolving, reviewed regularly· verified 2026-09-20· EN

Linear maps

Be able to interpret a matrix as a map that rotates, scales and shears the space.

Prerequisites

Intuition

A matrix is not just a grid of numbers — it is a function that moves the space. Multiply every point by the matrix and the space is rotated, scaled, reflected or sheared. Straight lines stay straight and the origin stands still.

MatrixDoes
[[2,0],[0,2]]scales everything 2×
[[2,0],[0,1]]stretches only in the x direction
[[0,-1],[1,0]]rotates 90°
[[1,1],[0,1]]shears
[[1,0],[0,-1]]reflects in the x-axis
[[1,2],[2,4]]flattens everything onto a line (singular)

The determinant is the area scale: det = 2 means that all areas double, det = 0 that the space collapses to a line (the information cannot be recovered — the matrix has no inverse), a negative det means that the orientation is reversed.

Formal

Eigenvectors are the directions the map does not turn — only scales: Av=λvA v = \lambda v where λ\lambda is the eigenvalue, the scale factor in that direction.

For A=(2003)A = \begin{pmatrix}2 & 0\\ 0 & 3\end{pmatrix}, e1e_1 and e2e_2 are eigenvectors with eigenvalues 2 and 3: the map stretches the x-axis twofold and the y-axis threefold.

Why it matters in deep learning:

  • Every layer in a network is a linear map (plus a non-linearity). Depth = many maps in sequence.
  • If every layer's matrix has eigenvalues > 1 the signal grows exponentially with the depth (exploding activations/gradients); if they are < 1 it shrinks (vanishing). Initialisation strategies are precisely about keeping them near 1.
  • SVD writes every matrix as rotation → scaling → rotation, and the singular values are the scale factors. That is the basis of low-rank approximation and LoRA.
  • A determinant of zero = rank deficiency = information loss — exactly what LoRA exploits when ΔW is deliberately given a low rank.

Code

import numpy as np

A = np.array([[2.0, 1.0], [0.0, 3.0]])
corners = np.array([[0,0], [1,0], [1,1], [0,1]], dtype=float)
print((A @ corners.T).T)          # the unit square's corners after the map
print(np.linalg.det(A))           # 6.0  → areas become 6× larger

values, vectors = np.linalg.eig(A)
print(values.round(3))            # [2. 3.]
print(vectors.round(3))           # the columns are the directions that are only scaled

B = np.array([[1.0, 2.0], [2.0, 4.0]])
print(np.linalg.det(B), np.linalg.matrix_rank(B))   # 0.0 1  ← collapses to a line

Mastery means

  • Interprets a matrix as a geometric map
  • Connects the determinant and the eigenvectors to what the map does

Sign in to do the exercises and build your mastery up.

Sources

All the sources and licences