§ CALCULUS · 26 MIN READ · Updated 2026-05-13
Linear Algebra Basics: Vectors, Matrices, Transformations
The mathematics that runs computer graphics, machine learning, and quantum mechanics — explained from first principles.
"Linear algebra is the natural language of multivariable calculus."

Linear algebra is the mathematics of structured collections — vectors and matrices — and the transformations between them. Where calculus deals with continuously changing quantities, linear algebra deals with structured systems. The two are deeply connected, and modern applied mathematics relies on both.
The single most important thing to understand about linear algebra is that matrices represent linear transformations. A matrix is not just a grid of numbers — it is a function that takes vectors as input and produces vectors as output. Once this is internalized, the rest of the subject opens up.
This article covers what linear algebra is really about, vectors (more than arrows), linear transformations, matrices as representations of transformations, the operations on matrices, determinants and what they measure, linear independence and span, vector spaces, and the connections to machine learning, computer graphics, and physics.
What linear algebra is really about
The historical motivation for linear algebra was solving systems of linear equations. A system like
has a unique solution: . For two equations in two unknowns, you can solve by hand. For many equations in many unknowns — the case in real applications — you need systematic methods.
These methods are linear algebra. The system above can be written
or, more compactly, . Solving the system is finding the vector such that, when the matrix acts on , the result is .
This formulation generalizes. Instead of two equations in two unknowns, you can have 1,000 equations in 1,000 unknowns, or 1,000,000 in 1,000,000. The algebra is the same; only the size changes.
Modern linear algebra is far broader than the original motivation. It includes vector spaces, linear transformations, inner products, eigenvalues, decompositions, and many other concepts. But the original motivation — systematic methods for structured linear problems — runs through everything.
Vectors: more than arrows
In a first encounter, vectors are introduced as arrows in space — quantities with magnitude and direction. This is a useful first picture, but it is too narrow.
A vector is an element of a vector space. That phrase is circular until you know what a vector space is. Operationally: a vector is a structured collection of numbers (its components) that obeys particular rules about addition and scaling.
In two dimensions, a vector is a pair: . In three dimensions, a triple: . In dimensions, an -tuple. The number of components is the dimension of the vector.
You can add two vectors of the same dimension componentwise:
You can multiply a vector by a scalar (a number):
These two operations — vector addition and scalar multiplication — are the defining operations.
Why "more than arrows"? Because vectors can represent many things that are not spatial:
- A list of features describing a data point (height, weight, age) is a vector.
- The probability distribution over outcomes is a vector.
- A function evaluated at points is a vector.
- The polynomial can be encoded as the vector .
The geometric picture (arrows) is useful for two and three dimensions. For higher dimensions and abstract applications, the algebraic picture (tuples of numbers) is more general.
Vector operations
The basic operations on vectors:
Magnitude (length):
For : .
Unit vector:
A vector with magnitude 1 pointing in the same direction as .
Dot product (or inner product):
The dot product produces a scalar. Geometrically, , where is the angle between the vectors. The dot product measures how much two vectors "point in the same direction."
Special cases:
- means the vectors are orthogonal (perpendicular).
- .
Example 1: For and :
Cross product (only in 3D):
Produces a vector perpendicular to both and . Used heavily in physics (torque, magnetic forces) and computer graphics (normal vectors).
Linear transformations
A linear transformation is a function from one vector space to another that preserves vector addition and scalar multiplication:
In English: if you add two vectors and then apply , you get the same result as applying to each and adding the results. If you scale a vector and then apply , you get the same result as applying first and then scaling.
Linear transformations have a profound consequence: a linear transformation is completely determined by what it does to a basis. If you know how transforms each basis vector, you know how it transforms every vector — because every vector is a linear combination of basis vectors, and respects linear combinations.
This is why matrices work. A matrix is a compact way to record what a linear transformation does to each basis vector.
Examples of linear transformations:
- Rotation in 2D: .
- Reflection: reflects across the x-axis.
- Scaling: scales both components by .
- Projection: projects onto the x-axis.
Each can be represented as a matrix.
Matrices: representing transformations
A matrix is a rectangular grid of numbers. We write a matrix with rows and columns as
Each entry is the entry in row , column .
Matrix-vector multiplication. If is an matrix and is an -dimensional column vector, then is an -dimensional column vector defined by:
In words: the th entry of is the dot product of the th row of with .
Example 2: , .
A 3×2 matrix maps a 2-dimensional vector to a 3-dimensional vector. The dimensions are essential — the matrix must have as many columns as the vector has components.
The connection to linear transformations. The columns of are exactly the images of the basis vectors. The first column is where . The second column is where . The matrix encodes the transformation by recording where each basis vector goes.
Matrix operations
Matrix addition. Add entries componentwise (only for matrices of the same size):
Scalar multiplication. Multiply every entry by the scalar:
Matrix multiplication. If is and is , then is with entries:
In words: the entry of is the dot product of row of and column of .
Example 3:
Why this strange definition? Because matrix multiplication corresponds to composition of linear transformations. If represents transformation and represents , then represents (apply first, then ).
Matrix multiplication is not commutative. In general, . This is fundamental and follows from the fact that order matters in composition of transformations.
Identity matrix. The matrix with 1s on the diagonal and 0s elsewhere acts as the identity: .
Matrix inverse. For a square matrix , the inverse is the matrix satisfying . Not every matrix has an inverse. The matrix is invertible (or non-singular) if and only if its determinant is nonzero.
Transpose. The transpose swaps rows and columns: .
Determinants
The determinant of a square matrix is a scalar that captures essential information about the transformation it represents.
For a 2×2 matrix:
For a 3×3 matrix:
For larger matrices, expand by cofactors recursively. (In practice, computational software uses more efficient methods.)
What does the determinant measure?
For a 2×2 matrix: the signed area of the parallelogram spanned by the column vectors. For a 3×3 matrix: the signed volume of the parallelepiped. In dimensions: the signed -volume.
The sign indicates orientation: positive means the transformation preserves orientation; negative means it reverses orientation (like a reflection).
Key facts:
- if and only if is not invertible. (Geometrically: the transformation collapses the volume to zero.)
- — determinants multiply.
- — determinants are preserved by transpose.
Linear independence, span, basis
Linear combination. A linear combination of vectors is any vector of the form
for scalars .
Span. The span of a set of vectors is the set of all linear combinations of them. Geometrically: the line, plane, or higher-dimensional subspace they "fill out."
Linear independence. A set of vectors is linearly independent if no vector in the set can be written as a linear combination of the others. Equivalently: the only way to make a linear combination equal to zero is to use all-zero coefficients.
Basis. A basis for a vector space is a linearly independent set that spans . Every vector in can be written uniquely as a linear combination of basis vectors.
Dimension. The dimension of a vector space is the number of vectors in any basis. (It does not depend on which basis you choose.) The standard -dimensional Euclidean space has dimension .
Example 4: In , the vectors and are linearly independent and span . So they form a basis. Any vector can be written as .
Another basis for : and . These also span and are linearly independent. The vector can be written as .
Vector spaces (briefly)
A vector space is a set equipped with two operations (vector addition and scalar multiplication) satisfying eight axioms:
- Closure under addition: .
- Closure under scalar multiplication: .
- Commutativity of addition: .
- Associativity of addition: .
- Zero vector: such that .
- Additive inverses: for every , there exists such that .
- Distributivity: , .
- Identity: .
These axioms abstract the properties of arrows-in-space. Anything satisfying them is a vector space. Examples include , the space of polynomials of degree , the space of continuous functions, the space of matrices.
In a serious mathematics course, you would work with these abstractions. For applied purposes, is what you usually need.
Solving linear systems
The system has different cases:
- Unique solution: is square and invertible. Solution is .
- No solution: is not in the column space of . The system is inconsistent.
- Infinitely many solutions: has a non-trivial nullspace (vectors that map to zero). Any solution plus any null-space vector is also a solution.
Gaussian elimination is the standard algorithm: by row operations, transform to upper triangular form (called row echelon form), then solve by back-substitution.
Example 5: Solve
Row 2 minus 2 times Row 1:
From row 2: , so . Back-substitute into row 1: , so . Solution: .
Applications
Computer graphics. Every 3D transformation (rotation, scaling, translation) is implemented as a matrix multiplication. The graphics pipeline applies a sequence of matrices to vertices to produce the rendered image. GPUs are essentially matrix-multiplication accelerators.
Machine learning. Every layer of a neural network is a matrix multiplication followed by a nonlinear function. The trained "weights" of a network are entries of these matrices. Operations on data (PCA, embeddings, attention mechanisms) are matrix operations.
Physics. Quantum states are vectors in complex vector spaces (Hilbert spaces). Observables are matrices (operators). Quantum mechanics is essentially linear algebra applied to complex vector spaces.
Economics. Input-output analysis (Leontief models) uses matrices to track how production in one sector depends on inputs from others. Equilibria are computed by matrix inversion.
Statistics. The covariance matrix encodes the relationships between variables. Principal component analysis (PCA) finds eigenvectors of the covariance matrix.
Frequently asked
- Why is matrix multiplication not commutative?
- Because matrix multiplication represents composition of linear transformations, and composition is not commutative in general. Applying $A$ then $B$ is different from applying $B$ then $A$. (Example: rotate then reflect vs. reflect then rotate produce different results.)
- Do I need to memorize the matrix multiplication formula?
- For small matrices, yes — you should be able to multiply 2×2 and 3×3 matrices by hand. For larger matrices, use software (numpy, MATLAB, R). The formula is the same; the procedure scales.
- Why are determinants important?
- They tell you whether a matrix is invertible (det ≠ 0) and they measure volume scaling. In change-of-variables for integrals, the Jacobian determinant appears. In eigenvalue problems, the characteristic polynomial uses the determinant.
- What is the difference between a vector and a matrix?
- A vector is a one-dimensional collection (a row or column). A matrix is a two-dimensional collection (a grid). A vector is a special case of a matrix — a column vector is an $n \times 1$ matrix.
- What is a vector space and why do I need it?
- A vector space is the abstract structure in which vectors live. For applied work, you mostly work in $\mathbb{R}^n$, which is the standard $n$-dimensional vector space. The abstract definition matters when working with infinite-dimensional spaces (functional analysis) or non-numerical vectors (polynomials, functions).
- Should I learn linear algebra before or after calculus?
- Either order works. They are largely independent. Calculus first is the traditional sequence (most universities); linear algebra first is becoming more common for ML-oriented students because linear algebra is more immediately applicable to deep learning.
- What does it mean for matrices to "represent" transformations?
- A linear transformation is an abstract concept — a function that respects vector operations. A matrix is a concrete numerical object. Once you choose a basis, each linear transformation corresponds to exactly one matrix (and vice versa). The matrix is the *coordinate representation* of the transformation.
— ACT —
Cited works & further reading
- ·Strang, G. (2016). Introduction to Linear Algebra, 5th edition. Wellesley-Cambridge Press.
- ·Axler, S. (2024). Linear Algebra Done Right, 4th edition. Springer.
- ·Lay, D. (2015). Linear Algebra and Its Applications. Pearson.
- ·3Blue1Brown. Essence of Linear Algebra (YouTube series).
- ·MIT OpenCourseWare 18.06 — Strang's lectures.
More from this cluster
24 MIN
How to Solve Integrals: Step-by-Step Methods
20 MIN
Derivatives Explained: From Definition to Application
17 MIN
Limits and Continuity: The Foundation of Calculus
14 MIN
Eigenvalues and Eigenvectors, Intuitively
20 MIN
Probability Theory Basics for Engineers
14 MIN
Series and Sequences: Convergence Tests Explained
16 MIN
Differential Equations: First-Order Methods
About the author
Tim Sheludyakov writes the Stoa library.
By Tim Sheludyakov · Edited 2026-05-13
A letter from the portico
Once a week — a long-read, a quote, a practice. No promotions. Unsubscribe in one click.
By subscribing you agree to receive letters from Stoa.