BLOGS

Linear Algebra Essentials

Published Oct 30, 2026 - Author: zgxsin

Share

Linear Transformations

Visually, a transformation is linear if it has two properties:

  1. The origin stays fixed.
  2. Grid lines remain parallel and evenly spaced.

Matrices

Think of matrices as linear transformations. The columns of a matrix are where the basis vectors land.

The determinant is the factor by which the transformation scales areas (volumes in 3D). A negative determinant means the orientation is flipped (in 3D, a right-handed coordinate system becomes left-handed). A determinant of zero means space is squished into a lower dimension.

Inverse matrices, column space and null space

Nonsquare matrices as transformations between dimensions

Take the following $3 \times 2$ matrix for example:

\[\underbrace{\begin{bmatrix} \color{#3a9a5b}2 & \color{#d9534f}0 \\ \color{#3a9a5b}-1 & \color{#d9534f}1 \\ \color{#3a9a5b}-2 & \color{#d9534f}1 \end{bmatrix}}_{3 \text{ rows} \,\times\, 2 \text{ columns}}\]

Its two columns are where the two 2D basis vectors land, and each is a 3D vector. So it transforms a vector in 2D space to a vector in 3D space. The outputs lie on a plane through the origin of the 3D space (the column space). The number of dimensions in the column space (2) is the same as the number of dimensions in the input space, so the matrix is still full rank.

Dot products and duality

A dot product with a fixed vector can be thought of as a linear transformation from 2D space to the 1D number line. Its matrix is the $1 \times 2$ matrix obtained by tipping that vector on its side.

From

\[\begin{bmatrix} x_1 \\ y_1 \end{bmatrix} \cdot \begin{bmatrix} x_2 \\ y_2 \end{bmatrix}\]

to

\[\underbrace{\begin{bmatrix} x_1 & y_1 \end{bmatrix}}_{\text{transform}} \begin{bmatrix} x_2 \\ y_2 \end{bmatrix} = x_1 x_2 + y_1 y_2\]

Cramer’s rule

Cramer’s rule solves $A\vec{x} = \vec{v}$ for $\vec{x}$. Start with a special case.

An orthonormal transformation (a rotation, possibly with a reflection) preserves dot products:

\[T(\vec{v}) \cdot T(\vec{w}) = \vec{v} \cdot \vec{w} \quad \text{for all } \vec{v}, \vec{w}\]

In other words, $T$ preserves lengths and angles.

Think about the following example.

\[\begin{bmatrix} \cos(30^\circ) & -\sin(30^\circ) \\ \sin(30^\circ) & \cos(30^\circ) \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}\]

where

\[A = \begin{bmatrix} \cos(30^\circ) & -\sin(30^\circ) \\ \sin(30^\circ) & \cos(30^\circ) \end{bmatrix}\]

The transformation $A$ takes $[x, y]^T$ to $[1, 2]^T$. Since $A$ is orthonormal, the dot product of $[x, y]^T$ with the first basis vector is unchanged by the transformation:

\[x = \begin{bmatrix} x \\ y \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \left(A\begin{bmatrix} x \\ y \end{bmatrix}\right) \cdot \left(A\begin{bmatrix} 1 \\ 0 \end{bmatrix}\right) = \begin{bmatrix} 1 \\ 2 \end{bmatrix} \cdot \begin{bmatrix} \cos(30^\circ) \\ \sin(30^\circ) \end{bmatrix}\]

Similarly, with the second basis vector:

\[y = \begin{bmatrix} 1 \\ 2 \end{bmatrix} \cdot \begin{bmatrix} -\sin(30^\circ) \\ \cos(30^\circ) \end{bmatrix}\]

But an orthonormal matrix is a special case. A general matrix does not preserve dot products, so this trick fails. Take the following for example:

\[\begin{bmatrix} 2 & -1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 4 \\ 2 \end{bmatrix}, \quad A = \begin{bmatrix} 2 & -1 \\ 0 & 1 \end{bmatrix}\]

Use areas instead of dot products. The parallelogram spanned by $\hat{i}$ and $[x, y]^T$ has signed area $y$. After the transformation, every area is scaled by $\det(A)$, and that parallelogram is spanned by $A\hat{i}$ (the first column of $A$) and the output $\vec{v}$. So

\[y = \frac{\det\begin{bmatrix} 2 & 4 \\ 0 & 2 \end{bmatrix}}{\det(A)} = \frac{4}{2} = 2\]

The same argument with $\hat{j}$ gives $x$: the parallelogram spanned by $[x, y]^T$ and $\hat{j}$ has signed area $x$, so replace the first column of $A$ with $\vec{v}$:

\[x = \frac{\det\begin{bmatrix} 4 & -1 \\ 2 & 1 \end{bmatrix}}{\det(A)} = \frac{6}{2} = 3\]

Check: $2 \cdot 3 - 2 = 4$ and $2 = 2$. In general, Cramer’s rule says each coordinate is $\det(A_i) / \det(A)$, where $A_i$ is $A$ with its $i$-th column replaced by $\vec{v}$.

Change of Basis

Suppose Jennifer uses a different basis. Write her basis vectors in our coordinates and put them in the columns of $A$:

\[A = \begin{bmatrix} \color{#3a9a5b}2 & \color{#d9534f}-1 \\ \color{#3a9a5b}1 & \color{#d9534f}1 \end{bmatrix}\]

$A$ translates a vector from her coordinates into ours:

\[A \underbrace{\begin{bmatrix} x_j \\ y_j \end{bmatrix}}_{\text{her coordinates}} = \underbrace{\begin{bmatrix} x_o \\ y_o \end{bmatrix}}_{\text{our coordinates}}\]

and $A^{-1}$ translates from our coordinates into hers.

Eigenvectors and Eigenvalues

Most vectors get knocked off their span during a linear transformation. Eigenvectors are the special vectors that remain on their own span, they only get stretched or squished. The eigenvalue is the factor by which an eigenvector is stretched or squished (it can be negative or fractional).

For example, the matrix below stretches all vectors on the x-axis by a factor of 3, and all vectors on the line spanned by $[-1, 1]^T$ by a factor of 2.

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

For a 3D rotation, the eigenvector is the axis of rotation, and its eigenvalue is 1 since rotations do not change lengths.

References

  1. 3Blue1Brown, Essence of Linear Algebra

Todo