Linear Algebra I: Vector Spaces and Linear Maps
Part I of a six-part lecture series converging on the singular value decomposition and geometric algebra.
This lecture includes interactive SymPy cells that verify key results symbolically. SymPy is a Python library for symbolic mathematics. Loading it fetches a WebAssembly Python runtime (approx. 15 MB, cached after first load). You can also load it on demand from any code cell below.
0. Why this series exists
A chemistry student is asked to balance the combustion of methane. She writes down the skeleton
and then juggles the coefficients until the carbon, hydrogen and oxygen counts agree, arriving at . She is told this is bookkeeping. It is linear algebra. Element conservation is three linear equations in four unknowns; the balanced reaction is a vector in the null space of a matrix; the balance is unique up to overall scale because that null space is one-dimensional. Every fact she was asked to accept as a knack is a theorem, and the theorem is proved in this lecture.
The same student, two chapters later, draws an ICE table for the Haber process and solves for the extent of reaction. The table records the amounts
which is a straight line in the space of species amounts, and the equilibrium condition that cuts that line is a quartic. Both objects live in the same little table, in the same variable , and they could not be more different in kind. Nobody says so. The words that would say so have been worn smooth.
That is the thesis of this series. The subject is taught as matrix manipulation, and the manipulation hides the linear maps. Row-reduce, invert, multiply, take a determinant: a curriculum of procedures on arrays of numbers, in which the objects the arrays represent are never named. The cost is paid later, in every application area the reader will meet. A chemical engineer calls an ICE table linear. A deep-learning framework calls an array a tensor. A textbook calls a linear layer. A paper calls attention scores an inner product. Each of these is false, each has a true statement standing right behind it, and the true statement is more useful.
The arc. Part I builds vector spaces, bases, dimension, linear maps, rank-nullity, matrices as coordinate representations, the four fundamental subspaces, Gaussian elimination, and the solution set of , applied to stoichiometry. Part II builds eigenstructure, the Jordan form and the matrix exponential, applied to linear systems of ordinary differential equations. Part III builds inner products, orthogonality and the spectral theorem, applied to the attention mechanism. Part IV builds tensors and the calculus of matrix functions, applied to backpropagation. Part V proves the singular value decomposition and applies it to principal component analysis and low-rank adaptation. Part VI builds geometric algebra, and the six parts converge on one theorem. A linear map moves vectors, and it also moves the areas and volumes they span. Part VI extends so that it acts on all of these at once. If the singular values of are , that extension stretches a -dimensional piece by a product of of the , and it stretches -dimensional volume by , which is . Rotation, stretch, area, volume and determinant turn out to be one object. That is where the series ends, and every part is aimed at it.
What is assumed. Arithmetic, and the concept of a function as a rule assigning one output to each input. Nothing else. Matrices are constructed here rather than presumed, and no result is used before it is proved.
Relation to the manifolds series. Analysis on Manifolds is self-contained: it builds the linear algebra it needs, exactly as much of it as the derivative and exterior algebra require, and it builds it from scratch. This series is the fuller account of the linear side, running far past what an analysis course has room for, and the two are complementary. A reader may take either first.
0.1. Terminology
Before any mathematics, four words. The series uses them in one sense each, and never in any other.
- Function. A rule assigning one output to each input. Its domain and codomain are sets. No structure is assumed, and none is preserved.
- Map. Reserved for a structure-preserving function, and always qualified: linear map, affine map, multilinear map, smooth map. An unqualified "map" is never written.
- Linear. A function between vector spaces satisfying for all scalars and all vectors , and nothing else. In particular with is affine, and is named affine every single time it appears.
- Nonlinear. A statement about a function relative to a nominated vector-space structure: the function fails on that structure. The word is empty until the structure is named, and it never means "complicated".
- Matrix. The coordinate representation of a linear map with respect to a chosen pair of bases. A matrix is never identified with the map it represents, and an array of numbers is never called a tensor.
These definitions pay for themselves in every application the series touches. In each one, the loose word hides a fact.
| Area | What these definitions force you to say |
|---|---|
| Chemistry | Element conservation is linear. The equilibrium condition is nonlinear. An ICE table is the affine set cut by a nonlinear variety, and the two are different objects sharing one variable. |
| ODEs | "Linear ODE" means the operator is linear on a function space. Superposition is that linearity. The solution set of the inhomogeneous equation is affine. |
| Transformers | is affine. The attention score is a bilinear form that is neither symmetric nor positive definite, so it is not an inner product. Softmax is where the nonlinearity lives. |
| Backpropagation | The derivative is the linear map; the network is not. Reverse mode is the adjoint of the tangent map. A gradient is a covector until a metric intervenes. |
| Tensors | An array has no transformation law, so it is not a tensor. A PyTorch tensor is an array. |
Each row is a promissory note, settled in the part that owns it. The chemistry row is settled in §8 of this lecture.
0.2. Chemical vocabulary
The application running through this lecture is chemical, and it needs six words. They are used loosely in ordinary speech, including by chemists, and the looseness is removed here, because each of them turns out to name a specific part of a matrix. A reader who has never balanced an equation loses nothing by reading this section slowly; a reader who has balanced a hundred of them may find that the words were doing more work than they let on.
- Element. A kind of atom, fixed by the number of protons in its nucleus: carbon, hydrogen, oxygen, manganese. In this lecture an element is never a substance, only a kind of atom, and therefore only a thing to be counted. Chemists do also say "the element oxygen" when they mean the gas ; this lecture never does.
- Atom. One particle of an element.
- Molecule. A discrete group of atoms bonded together, such as , or . Not every substance is made of molecules: table salt is an extended ionic lattice and iron is a metallic one, so the word will not carry the weight we need.
- Compound. A substance built from more than one element, such as or . So is a molecule and is not a compound. Nothing in the mathematics ever asks whether something is a compound, and the word appears here only to be set aside.
- Ion. Anything carrying a net electric charge, such as , or . Charge is conserved by a reaction exactly as atoms are, so charge will simply be counted alongside the elements, and §8.1 shows it costs one extra row and no new idea.
- Species. Anything whose amount we choose to track separately. This is the operative word, and it is a bookkeeping decision. A species may be a molecule, an ion, a lone atom, a metal, a dissolved solid. Two substances with the same formula are different species whenever the model needs them apart, and -butane and isobutane in §8.2 are exactly that.
- Amount. How much of a species is present, in moles. The amounts of all the species in a flask, listed in a fixed order, are the tuple of [tuple].
Elements are counted; species are tracked. That single distinction is what the matrix of §8 is built on, and it is the reason the two words can never be swapped.
| Chemical word | What it is in the linear algebra |
|---|---|
| Element | A row of the element-species matrix : the covector "count the atoms of this element", in the sense of §4.1. |
| Species | A column of , and an axis of the space of mixtures. Choosing the species list is choosing the coordinate space. |
| Amount | An entry of the column vector . A mixture is a point. |
| Reaction | A vector in the null space : negative entries for species consumed, positive for species produced. |
| Conservation law | A vector in the left null space : a covector that every reaction annihilates. |
| Extent of reaction | A coordinate along an affine line in the space of mixtures. |
The matrix cannot see chemistry. It sees a column of atom counts, so any two species with the same atom counts give it the same column, and it is powerless to tell them apart.
That is not a defect, and §8.2 turns it into the point. Both -butane and isobutane have the formula , so they contribute identical columns to , and the isomerisation that turns one into the other changes not a single atom count. Element conservation therefore says nothing whatever about that reaction, which is the correct answer: no amount of atom counting can forbid it, and it happens. The reaction shows up in anyway, because the difference of two identical columns is zero. Two species, one column, and a reaction that conservation permits precisely because conservation cannot see it.
0.3. A note on the boldface
Vectors are set in boldface throughout this series, and and , and scalars are set in ordinary italic, and and . The choice is not neutral, it has a history, and the history is worth two minutes because the alternatives are still in daily use and each of them is making a different claim about what a vector is.
Hamilton gave the existing word vector its algebraic sense in 1844, for the non-scalar part of a quaternion, and Grassmann's Ausdehnungslehre of the same year built the linear theory independently [6][7]. The notation, however, was not settled by either of them, and for fifty years it was a free-for-all. Gibbs, in the lecture notes he printed privately at Yale between 1881 and 1884 and pointedly marked not published, wrote that "we shall use the small Greek letters to denote vectors, and the small English letters to denote scalars" [8]. Tait did the same. Maxwell set his vectors in German Gothic.
Heaviside rejected the lot. In Electromagnetic Theory he devotes a section to the question, complains that Greek requires "a considerable familiarity" before it can be manipulated with any facility, dismisses Maxwell's Gothic as an unfortunate choice, and records that he "found salvation in Clarendons", the printer's name for heavy type, having first used them in 1886. His grounds are entirely practical and entirely typographic: "It is always in stock; it is very neat; it is perfectly legible" [9].
He won. When Wilson wrote the 1901 textbook that put vector analysis into the curriculum, a book founded on Gibbs's lectures and written at Gibbs's suggestion, he kept Gibbs's system and threw out Gibbs's notation: "some typographical difference must be relied upon to distinguish vectors from scalars. Hence in this book Clarendon type is used for setting up vectors and ordinary type for scalars" [10]. The boldface on this page is that decision, made by Heaviside for the sake of a compositor's type case, and carried by Wilson into every course since.
It earns its place for the reason Wilson gives and one more. An expression like mixes scalars and vectors in a single sum, and this series will go further and mix scalars, vectors, covectors and arrays in a single line. The weight of the type says which is which before the reader has parsed anything. It is also the handsomest of the four options, which is not an argument and is not nothing.
What it costs is the hand. Boldface is a property of a type case, and no one has ever produced it with chalk. Cajori, cataloguing the state of things in 1929, puts it exactly: bold-faced type is "satisfactory for print, but inconvenient for writing" [11]. So handwriting went and got its own ornaments, and the two in common use are the arrow and the rightward harpoon .
Neither has a documented origin, and that absence is itself informative. Cajori lists the rival conventions of the nineteenth century and dates every one of them, footnoting Argand in 1806, Möbius in 1827 and Bellavitis in 1837. The arrow he mentions without a date, without a name and without a footnote. The most diligent cataloguer the subject has had could not say where it came from, which suggests that by his time it had been anonymous for a long while.
The choice between the two is a matter of taste, and this series takes a side. The harpoon is the better mark on a board: it is quick, it is unmistakable, and its asymmetry survives being drawn badly at speed, which the arrow's two barbs do not. In print it turns fastidious. The arrow is not used here at all, being ungainly on the page and sitting above the letter rather than in it, decorating the symbol instead of being the symbol. A reader who prefers otherwise loses nothing, since every theorem below is indifferent to the ink.
One more story deserves a caveat rather than a citation. The underline that appears beneath vectors in handwritten notes is also the printer's mark instructing a compositor to set a letter in bold, and it is tempting to conclude that mathematicians underline vectors because they are silently marking up their own manuscripts. It is a tidy story. It appears to be documented nowhere, and the tidiness is precisely the reason to distrust it.
Two other conventions are worth considering. Each is a position someone took deliberately.
The first is to use no ornament at all. Halmos writes his vectors as plain italic and Axler does the same [2][1], and the practice is entirely defensible: in a careful text the sentence has already said what kind of object is, and a reader who needs the type to tell him has not been reading. This series declines it for the reason given above, that its whole subject is the difference between objects that the arrays make look alike.
The second is index notation, which abandons the object and names its slots: for a vector, for a covector, for a linear map. It came out of the absolute differential calculus that Ricci and Levi-Civita systematised in 1900 [12], and it acquired its summation convention from Einstein in 1916, who suppressed the summation sign and called the omission a great discovery in mathematics [13].
It is the most informative of the four, and boldface is hiding something it would show. A boldface tells you that an object is a vector. An index tells you how that object transforms, which is the thing that actually distinguishes a vector from a list of numbers. The transpose is where this bites first, and §4.1 shows exactly what the superscript is concealing. Part IV switches notation for good, and the reason it has to is the sentence from §0.1: an array has no transformation law, so it is not a tensor.
1. Vector spaces
This section fixes the arena. Everything the series proves is a statement about vector spaces and the linear maps between them, so the axioms come first and the examples come immediately after, to show how little the axioms demand.
1.1. Fields
Vectors are scaled by numbers, and the numbers must themselves be well behaved. A field is exactly the amount of good behaviour required.
A field is a set with two operations, addition and multiplication, and two distinguished elements , such that for all :
- Addition is associative and commutative, , and every has an additive inverse .
- Multiplication is associative and commutative, , and every has a multiplicative inverse .
- Multiplication distributes over addition: .
The rationals , the reals and the complex numbers are fields. The integers are not: has no multiplicative inverse in . This failure is the whole reason §8 has to work to get integer coefficients out of a chemical balance: the linear algebra hands us a line of solutions over , and picking the integer point on it is an extra step.
Throughout, denotes a field, and the reader who prefers may read everywhere without losing anything until Part II, where the complex numbers become unavoidable.
1.2. The vector space axioms
A vector space over is a set with an addition and a scalar multiplication such that, for all and all :
- and .
- There is a zero vector with .
- Every has an additive inverse with .
- and .
- and .
Elements of are called vectors; elements of are called scalars.
Nothing here mentions arrows, lengths, angles or coordinates. A vector space has no notion of the length of a vector and no notion of the angle between two of them; those arrive in Part III with an inner product, which is extra structure and is not free. Everything in this lecture is proved without them, which is why every theorem here holds for polynomial spaces and function spaces as readily as for .
In any vector space, and .
Proof
By axiom 5, . Adding to both sides gives . Then , so is the additive inverse of .
- Coordinate space. , the set of -tuples with componentwise operations. This is the example everyone meets first, and it is the least interesting of the four.
- Polynomials. , the real polynomials of degree at most , with pointwise addition and scaling. The sum of two such polynomials is one, and a scalar multiple of one is one, so the axioms hold.
- Functions. , all functions from a set to , with and . The zero vector is the function that is identically zero.
- Solutions of a homogeneous linear ODE. The set of twice-differentiable with . If and solve it, so does , by inspection of the equation. That closure property is exactly axioms 1 to 5 restricted to this subset of .
Example 4 is the one to keep. The principle of superposition, which physics courses present as a physical fact about waves, is the statement that a certain solution set is a vector space. It is a theorem about the operator , namely that is linear and that its solution set is , which §3 proves is a subspace of the function space. Part II takes this apart in full and identifies the dimension of that solution space as the order of the equation.
1.3. Subspaces
A subset is a subspace of if is itself a vector space under the operations inherited from .
A subset is a subspace if and only if and for all and all scalars .
Proof
If is a subspace, both conditions hold by definition. Conversely, suppose both hold. Associativity, commutativity and distributivity are inherited from , since they are identities satisfied by all elements of and therefore by all elements of . The closure condition with gives closure under scaling and with gives closure under addition, so the operations restrict to . Additive inverses lie in because by [zero-times-v], and by hypothesis.
In , the plane is a subspace. The plane is not, because it misses the origin. The second set is the affine set that §7 is about, and the distinction between the two is the distinction between linear and affine.
The intersection of any collection of subspaces of is a subspace of .
Proof
Let be subspaces and . Each contains , so . If then both lie in every , hence for every , hence . Apply [subspace-test].
1.4. Tuples, coordinate space and Euclidean space
The axioms have said what a vector is: an element of a set with the structure of [vector-space]. The most familiar such set was listed as the first example and never built. It is built now, from an object that is not a vector.
An -tuple over is an ordered list of entries , where ordered means that the slot an entry occupies is part of the data: two tuples are equal exactly when they agree slot by slot, so . The set of all of them is the Cartesian product .
Coordinate space is that set equipped with the componentwise operations
The axioms of [vector-space] hold slot by slot because they hold in , with zero vector . When this is real coordinate space .
The tuple is the list; the vector space is the list together with operations on it. Writing numbers in a row commits you to nothing, and the operations have to be earned. Two chemical lists show what earning them means.
The amounts of the four species in a flask form a tuple , and here the operations mean something: pour two flasks together and the amounts add, double the batch and they scale. Componentwise addition answers to an experiment.
The state of that same flask can be recorded as the tuple , and now componentwise addition answers to nothing. A flask at combined with one at does not give , and no laboratory operation doubles a temperature and a pH together. The vector-space structure on still exists, and nothing chemical answers to it.
Both lists sit in a Cartesian product. Only the first is a vector in any sense a chemist should accept. This is the same discipline [terminology] imposed on the word nonlinear: the structure has to be named before the word means anything.
The converse failure is the one this series will lean on. A polynomial in is a vector and is not a list of numbers. A solution of is a vector and is not a list of numbers. Such a vector acquires a list only when a basis is chosen, by [coordinates-unique] below, and a different basis hands the same vector a different list. The tuple is a label; the vector is the thing labelled. §4 is the long consequence.
Euclidean -space is together with the dot product
from which the length and the angle are defined. Two vectors are orthogonal if .
and Euclidean -space are the same set with different amounts of structure, and the difference is exactly the dot product. Everything proved in this lecture is a statement about the vector space , and the dot product is never used. Part III adds it, under the name inner product, and pays for it.
The reason to keep them apart is that the extra structure is not always meaningful. In the species-amount space of §8, the formula can certainly be typed. What it asserts is that is orthogonal to , that a mixture has a length, and that two mixtures subtend an angle. No experiment answers to any of that. The standard basis is orthonormal by decree, and the decree is ours. That is why §5 declines to draw the four subspaces at right angles, and why the conservation laws of §8.2 are derived without one word about perpendicularity.
2. Span, independence, basis
This section fixes what it means to give coordinates to a space, and proves the one fact that makes coordinates trustworthy: every basis of a given space has the same number of elements. That fact is the Steinitz exchange lemma, and it is the first real theorem of the subject.
2.1. Span
Let . A linear combination of them is a vector with . Their span is the set of all such:
By convention . If , the list spans , and is finite-dimensional.
is a subspace of , and it is the smallest subspace containing every .
Proof
It contains (take every ) and is closed under linear combinations, since , so [subspace-test] applies. Any subspace containing every is closed under linear combinations of them, so it contains the span.
2.2. Linear independence
A list is linearly independent if the only scalars with
are . Otherwise the list is linearly dependent, and any relation [eq:eq-independence] with some is a dependence relation.
A list with is linearly dependent if and only if some lies in the span of the others.
Proof
If with , then , which lies in the span of the others. Conversely, if , then is a dependence relation with coefficient on .
2.3. Basis and the Steinitz exchange
A basis of is a list of vectors that is linearly independent and spans .
The list is a basis of if and only if every has exactly one expression . The scalars are the coordinates of with respect to , written .
Proof
Suppose is a basis. Spanning gives at least one expression. If , then , so independence forces for every , giving exactly one. Conversely, existence of an expression for every is spanning, and uniqueness applied to (whose obvious expression has every coefficient zero) is independence.
[coordinates-unique] is the entire content of the phrase "choose coordinates". A basis is a labelling scheme, chosen by us, and is the label. The vector is indifferent to it. Hold on to this: §4 is one long consequence.
The next theorem is the one everything rests on. It says that an independent list can never be longer than a spanning list, and everything about dimension follows.
Let be a vector space. Suppose is linearly independent and spans . Then , and after reordering the 's, the list
also spans .
Proof
We prove by induction on the statement : for , we have and, after a reordering of the 's, the list
spans . The theorem is .
Base case. is the hypothesis that spans , with no 's exchanged in.
Induction step. Assume with . The spanning list of contains in its span, so there are scalars with
Some is nonzero. Suppose otherwise: then is a linear combination of , contradicting the independence of by [dependence-redundancy]. In particular the index range is nonempty, so .
Reorder the 's so that . Solving [eq:eq-steinitz-step] for ,
so lies in the span of . Every vector of is a combination of by , and each of those vectors is in turn a combination of the new list, so the new list spans . This is .
The induction runs to , and at each step it produced , so .
If is finite-dimensional, any two bases of have the same length. That common length is the dimension .
Proof
Let and be bases of lengths and . Since is independent and spans, [steinitz] gives . Exchanging the roles gives .
, with the standard basis , where has a in slot and zeros elsewhere. And , with the basis . The function space is not finite-dimensional: the monomials are independent for every , so no finite list can span it, by [steinitz].
Let . Every linearly independent list in has length at most and extends to a basis. Every spanning list has length at least and contains a basis. Any independent list of length is already a basis, and so is any spanning list of length .
Proof
The length bounds are [steinitz] against a basis. For extension: given an independent , if it spans we are done; otherwise pick , which keeps the list independent by [dependence-redundancy], and repeat. The process halts by the length bound. For reduction: given a spanning list, delete any vector lying in the span of the others ([dependence-redundancy]), which preserves spanning, and repeat until the list is independent. If an independent list has length and failed to span, extending it would give an independent list of length greater than , which is impossible; the dual argument handles a spanning list of length .
3. Linear maps
The objects are in place. This section introduces the linear maps between them, and proves the theorem that governs every one of them.
3.1. Definition, kernel, image
Let be vector spaces over . A function is a linear map if
The set of linear maps is written , and it is itself a vector space under pointwise operations.
Every linear map satisfies .
Proof
Take in [eq:eq-linearity].
Fix and with , and let . Then , so is not linear by [linear-fixes-zero]. It is affine: a linear map followed by a translation. The failure is quantitative as well as qualitative, since
which vanishes exactly on the coefficient pairs with . An affine map preserves those combinations, the ones whose coefficients sum to one, and no others. That surviving structure is what an affine space is, and it is the structure an ICE table has in §8.
The layer in every neural network is this . It is affine, it is named affine here, and it will be named affine in Parts III and IV.
For , the kernel and image are
The rank of is , and the nullity is .
is a subspace of and is a subspace of .
Proof
puts in both. If then . If then . Apply [subspace-test] twice.
A linear map is injective if and only if .
Proof
If is injective and , then . Conversely, if and , then , so , so .
This is what the kernel is for. For a general function, injectivity is a statement about every pair of points. For a linear map, it collapses to a statement about a single subspace, because linearity converts the difference of two collisions into one collision with zero.
3.2. Rank-nullity
Let be finite-dimensional and . Then
Proof
Let and let be a basis of , so . Being independent in , it extends by [extend-to-basis] to a basis
We claim is a basis of , which gives and hence [eq:eq-rank-nullity].
They span the image. Let . Write in the basis above. Applying and using ,
so lies in their span.
They are independent. Suppose . By linearity , so , so it is a combination of the kernel basis:
That is a dependence relation among , which is a basis of and therefore independent. Hence every (and every ).
Let and . Then is injective if and only if it is surjective, and either condition makes it bijective.
Proof
By [injective-iff-kernel-zero], injectivity says , which by [eq:eq-rank-nullity] says , which says is a subspace of of full dimension, hence by [extend-to-basis]. Each step reverses.
[square-injective-surjective] fails without finite dimension. On the space of real sequences, the right shift is injective and not surjective. [eq:eq-rank-nullity] depends on dimension, and dimension is available to us only because [dimension-well-defined] made it well defined.
4. Matrices as coordinates
Now the central point of the lecture. A matrix has not appeared yet, and it appears now for one reason: a linear map, once bases are chosen at both ends, is determined by finitely many scalars. Those scalars are the matrix. They belong to the pair of bases as much as to the map, and changing the bases changes every one of them while changing nothing about the map. Horn and Johnson [3] is the standing reference for everything below that is a fact about matrices rather than about maps.
4.1. Rows, columns and the transpose
The array has to be named before it can be filled.
An matrix over is a rectangular array of scalars with rows and columns, the entry sitting in row and column . Written out, it is
The first index runs down and the second runs across, so is read "row , column ", and this order is fixed for the whole series. The shape is quoted rows first, so an matrix is tall when .
Three objects share the letter and are told apart by their type. The scalar entry is italic ; the -th column is the boldface , one subscript, and this is what a bare always means below; the -th row is , parenthesised superscript, and it is written this way because a row is a different kind of object from a column, which is the subject of the next two remarks.
The set of them is , and it is a vector space under entrywise addition and scaling, for the reason is one: the axioms hold entry by entry. Its dimension is , with basis the matrices with a single .
A column vector is an matrix and a row vector is a matrix. Coordinate vectors are columns throughout this series: is identified with , so that is a column and is a matrix product.
The transpose of is the matrix with
Rows become columns and columns become rows. A matrix with is symmetric, which forces it to be square.
For matrices of compatible shapes and any scalar ,
Proof
The first three are entrywise and immediate from [transpose]. For the last, let be and be , so that both sides are , and compare entries:
The order reverses, and it has to: the shapes compose in no other way.
A row of numbers and a column of numbers hold the same data, and nothing in the two lists tells them apart. What tells them apart is what they do.
A column is a vector. A row is a function on vectors, namely
and that function is linear, so it is an element of . The space of linear functions from a space to its scalars is the dual space, its elements are covectors, and Part IV builds it properly. Columns are vectors, rows are covectors, and the transpose is the passage between them.
That passage looks free and is not. Turning the column into the row is a choice of which covector to attach to a given vector, and the choice made by the notation is the one licensed by the dot product of [euclidean-space]: the covector is the function . Withdraw the dot product and no vector has a preferred row attached to it at all. This is the sentence "a gradient is a covector until a metric intervenes" from §0.1, and it is why Part III has to work for something Part I gets by writing a superscript.
The chemistry is already built this way and nobody says so. The element-species matrix of §8.1 has one row per element, and row is the covector "count the atoms of element in this mixture": it eats an amounts column and returns a number. The rows of are not amounts of anything. They are functions on amounts, they live in a different space from the mixtures they measure, and §8.2 is the statement that the conserved quantities of a network are exactly the covectors annihilating every reaction. A conservation law is a row. That is the whole reason it is found in the null space of a transpose.
Boldface names an object and says nothing about its slots. Index notation names the slots and says nothing about the object, and on the subject of the transpose it is the more accurate of the two.
Give a vector an upper index and a covector a lower one, following [transpose] and the remark above:
The product is a scalar because an upper slot has been contracted with a lower one, and the two are of opposite kinds. In this notation a linear map is , one slot of each kind, since it eats a vector and returns a vector. A bilinear form is , two lower slots, since it eats two vectors and returns a scalar. Boldface writes both as a square array and hides the difference. Index notation cannot hide it, because the slots are written down.
The symbol is doing two different things.
For a map , the transpose is the dual map , which takes the covector on to the covector on . In indices it is the same array with its slots read in the other order, and not one entry has moved. This transpose is free. It asks for no inner product, no basis and no structure beyond linearity, and it is the transpose that §5 uses when it forms and calls its elements conservation laws.
For a map , written , the transpose asks for the array , which requires interchanging an upper slot with a lower one. No vector space provides that operation. It becomes legal only when a metric is present to lower the upper index and raise the lower one, and in the metric quietly supplied is the dot product of [euclidean-space]. So the innocent superscript conceals a choice, and the same choice, made in the same silence, is the one identified in the remark above: the passage from a column to a row.
Two consequences follow. A symmetric matrix and a self-adjoint operator are not the same statement: is a property of a bilinear form and needs nothing, while for an operator is a property relative to a metric, and Part III separates them. And the reason Part IV switches to index notation is now visible in miniature: what transforms, and how, is recorded by the position of a slot, and boldface has no place to write it. This is the same sentence as "an array has no transformation law, so it is not a tensor" from §0.1, and it is why the array is not the object.
4.2. The matrix of a linear map
Let be a basis of . For any vectors there is exactly one linear map with for every .
Proof
Existence: define , which is well defined because the coordinates are unique ([coordinates-unique]), and is linear by inspection. Uniqueness: two linear maps agreeing on a basis agree on every linear combination of it, hence on .
Let , let be a basis of and a basis of . Expand each image in :
The array is the matrix of with respect to and . Its -th column is .
With the notation of [matrix-of-map], for every
where the right-hand side is the usual matrix-times-column product. Moreover, for with a basis of ,
Proof
Write . Then by linearity and [eq:eq-matrix-def], , and the bracket is the -th entry of . Uniqueness of coordinates gives the first claim. Applying it twice, for every , and a matrix is determined by its action on the coordinate vectors .
Matrix multiplication is forced: it is the unique rule that makes the array of a composition equal the product of the arrays. The associativity of matrix multiplication, verified by index gymnastics in most courses, is the associativity of composition of functions, which is free.
4.3. Change of basis and similarity
Let and be bases of . The change-of-basis matrix has -th column , so that for every .
is invertible, with .
Proof
By [matrix-acts-on-coordinates], , and symmetrically in the other order.
Let and let be bases of with change-of-basis matrix . Write and . Then
Two square matrices related in this way are called similar, and similarity is precisely the relation "these are the same linear map, written in two coordinate systems".
Proof
Write and apply [matrix-acts-on-coordinates] to the composition, reading the bases right to left:
Read [eq:eq-similarity] in those terms. The left side and the right side are two arrays of numbers with, in general, not a single entry in common. They represent one linear map. Nothing about changed when the basis was turned; only our description of it changed. Any number computed from that deserves to be a statement about must therefore be invariant under [eq:eq-similarity]. The trace and the determinant are two such numbers, and the eigenvalues are another, which is what Part II is about. The entries of are not.
Three panels, three separate things. Panel one draws the linear map with no frame present at all: the image of the unit sphere under , with the directions leaves invariant. Panel two is a basis you may rotate. Panel three is the array of components. Turn the frame and watch: the nine numbers churn under [eq:eq-similarity], and the object in panel one does not stir, because the map never heard of your basis. The trace and the determinant sit still while the entries move.
One control is offered here, and a second is held back until Part IV. Rotations are gentle: an orthogonal change of basis is the special case in which several inequivalent transformation laws happen to agree, which is why an array can be mistaken for a tensor indefinitely. Part IV unlocks the shear, the agreement collapses, and the array is caught.
5. The four fundamental subspaces
Given a matrix, four subspaces come for free, two in the source and two in the target. This section defines them and proves the one theorem tying them together, which is that a matrix has the same rank read by rows as read by columns. Organising the subject around these four is Strang's [4], and it is the best pedagogical idea in the elementary literature.
Let , regarded as the linear map from to in the standard bases.
- The column space , which is .
- The null space , which is .
- The row space .
- The left null space , which is , since and are the same equation transposed.
The column space is the image, so is solvable exactly when : that is §7. The left null space is the set of linear relations satisfied by the rows of : a vector in it says that the combination vanishes. Read that sentence again in §8, where the rows will be reactions and the relations will be conservation laws.
Courses often draw these four subspaces with right angles between them, since and are orthogonal complements. That picture needs an inner product, which we do not have and do not need here. Orthogonality is deferred to Part III, and every statement below is proved without it.
Two names have just been given to one set. For a fixed , the null space is the kernel of the map in the sense of [kernel-image], so element for element, and every theorem in this section would survive the replacement of one symbol by the other. Anyone who tells you the two words mean different things about a given matrix is wrong. The distinction is in what each symbol takes as its argument.
takes a map. It is defined for any before a basis has been chosen, and is a subspace of itself. The word also belongs to algebra at large, where the kernel of a group homomorphism is a normal subgroup and the kernel of a ring homomorphism is an ideal, in each case the preimage of zero. takes an array. An array has no kernel at all until bases have been fixed at both ends, and is a space of coordinate columns sitting in , which is a different vector space from .
That is not a matter of taste, and the following makes it precise.
Let with , let be bases of with , and write and as in [eq:eq-similarity]. Then the kernel is read in coordinates by
and the null space transforms under a change of basis by
In particular .
Proof
By [matrix-acts-on-coordinates], , and coordinates are unique ([coordinates-unique]), so holds if and only if , which is [eq:eq-kernel-in-coordinates] for ; the same argument in gives the other half. For [eq:eq-null-space-transforms], and using that is invertible ([p-invertible]),
The dimension claim follows because is an isomorphism, as is the coordinate map .
Read [eq:eq-null-space-transforms] against §4.3. One map , two bases, and the null spaces and are in general two different subspaces of , with not a vector in common beyond . The kernel did not move while that happened: [eq:eq-kernel-in-coordinates] says the two of them are one subspace of , namely , written down in two coordinate systems. The kernel is the object and the null space is its shadow, exactly as the map is the object and the matrix is its shadow. What is invariant is the dimension, and its name is the nullity. That is why the theorem of §3.2 is called rank-nullity and not rank-kernel: the quantity it counts is the one that both notations agree on.
Hence the convention followed from here on. is written when the object is a map, as in §3, and when the object is an array of numbers, as in the rest of this lecture, where , and arrive with their entries given and the standard bases understood. Where the bases are standard and no other basis is in play, the shadow is faithful and the choice of symbol costs nothing.
The word acquires a second and unrelated job the moment a bilinear form is present, which is Part III. Given a symmetric bilinear form with quadratic form , a null vector is one with , and those form a cone rather than a subspace: on with , both and are null while their sum is not. The subspace attached to a form is its radical, , and that one is a null space in the sense of [four-subspaces], being for the Gram matrix of . An inner product is the case in which the radical is and the null cone is as well, which is why the two senses of the word never collide in a first course, and why they collide immediately in relativity, where the null cone is the light cone and has nothing to do with any kernel.
For any , . The common value is the rank of .
Proof
Let and let be a basis of the column space. Assemble them as the columns of a matrix .
Every column of lies in the column space, so it has an expansion for unique scalars . Collecting the coefficients into , this reads
Now read [eq:eq-rank-factorisation] by rows. The -th row of is , so every row of lies in the span of the rows of . Hence
The bound holds for every matrix, so apply it to , whose row space is the column space of and whose column space is the row space of :
The two inequalities force equality.
The factorisation [eq:eq-rank-factorisation] is worth more than the theorem it just proved. It says every rank- matrix is a product of a tall matrix and a wide one, with the inner dimension equal to the rank. That is the shape of a low-rank approximation, of a bottleneck layer, and of the update in low-rank adaptation. Part V returns to it with the singular value decomposition, which picks the best such factorisation of each rank.
, and by [eq:eq-rank-nullity] applied to and to ,
Proof
Immediate from [row-rank-col-rank] and [rank-nullity], the latter applied to the linear map on and to on .
6. Gaussian elimination
Five sections have defined a great deal and computed almost nothing. The four subspaces of [four-subspaces] exist, and nothing so far says how to find a basis of any of them. This section supplies the algorithm and proves what it does, which is less than the folklore claims: it leaves two of the four subspaces exactly where they were, and it moves a third.
Nothing above depends on any of it. Elimination is a computation, and a computation is not a foundation.
6.1. The augmented matrix
A system of linear equations in unknowns , written out in full, is
which is for the array [eq:eq-general-matrix] of [matrix-array], the column and the column . The names , the plus signs and the equals signs are identical in every system ever written and have no information about this one. Delete them. What survives is the coefficients and the right-hand side, and the array that holds both is the object the algorithm works on.
Let and have the same number of rows. Their juxtaposition is the matrix whose first columns are the columns of and whose last columns are the columns of .
The augmented matrix of the system [eq:eq-general-system] is the case , :
The bar is punctuation. [eq:eq-augmented] is an ordinary matrix, it has a rank and four subspaces like any other, and every theorem below applies to it with the bar erased. What the bar records is the reader's intention: columns through are coefficients of unknowns, column is data, and no unknown is ever solved for column . That intention has exactly one mathematical consequence, and it is [consistency]: the system is solvable precisely when the augmented column fails to be a pivot column, which is to say when adjoining adds no new direction to the column space.
Row of [eq:eq-augmented] is one equation. Write for it, and for the coefficients alone, which is row of ; the bold subscripted is reserved for the -th column of throughout. Then is the equation . The whole array is the list of equations, and the two facts to keep are that a row is an equation and a column is an unknown.
The reason the augmented form is the right object, and the only thing that has to be checked before the algorithm may be turned loose on it, is that elimination cannot tell the blocks apart.
For any , and any and ,
Proof
Column of a product is applied to column of , and a column of is a column of or a column of . So the first columns of are the columns of and the last are the columns of .
Row operations are left multiplications ([elementary-invertible]), so by [eq:eq-block-product] a sweep that carries to carries any block riding beside it to , whatever is. Choose the passenger and the same algorithm answers three different questions.
- , with . The reduced system has the solutions of the original one, since is invertible, and §7 reads them off.
- , since . The identity block is a recorder: it starts as , it undergoes every operation the left block does, and it therefore ends holding the product of all of them. This is where §6.5 gets the left null space, and, when is square and invertible, where and .
- . Several right-hand sides, one sweep, since the left block does not know how many passengers it has.
An augmented matrix is not a new kind of object, and there is no separate theory of it. It is a matrix carrying a passenger, and [eq:eq-block-product] is why the passenger arrives at the right place.
6.2. Row operations are invertible matrices
An elementary row operation on a matrix is one of:
- Swap. Exchange rows and .
- Scale. Multiply row by a scalar .
- Replace. Add times row to row , with .
The elementary matrix of an operation is the result of applying it to the identity .
Performed on the augmented array [eq:eq-augmented], whose -th row is , the three are
and every other row is left alone. Each operation acts on the whole row, all entries of it. The augmented entry is a passenger and never a spectator: scaling to , with the right-hand side left behind, states a different equation with a different solution set, and the elimination would be computing the answer to a question nobody asked. The arithmetic runs straight through the bar.
The unknowns get no such licence. Rows may be swapped, scaled and combined; columns may not. A column operation is a right multiplication , it mixes the unknowns rather than the equations, and it sends to , so the vectors read out at the end would be answers to a system in different variables. Gaussian elimination moves rows, and the columns stay where they are put. The single exception is a permutation of columns, which is a relabelling of the unknowns and is used only for tidiness in [eq:eq-reduced-block] below.
Performing an elementary row operation on is the same as forming , where is the elementary matrix of that operation. Every elementary matrix is invertible, and its inverse is elementary of the same type.
Proof
Row of a product is , so left multiplication forms combinations of the rows of with coefficients read from the rows of . Take to be the identity with the operation applied to it, and read this formula off row by row: for the swap, rows and of are and , which select rows and of ; for the scale, row is , which returns times row ; for the replace, row is , which returns row plus times row . Every other row of is and passes row through unchanged.
Each operation is undone by one of the same type: a swap by itself, a scale by by a scale by , a replace by by a replace by . The corresponding elementary matrices therefore multiply to in both orders.
Let be invertible and . Then
while in general.
Proof
Null space. if and only if , because is injective. The two solution sets are the same set.
Row space. Every row of is a combination of rows of by the formula in [elementary-invertible], so . Applying the same fact to gives the reverse inclusion.
Column space. , since the columns of are applied to the columns of . An invertible is an isomorphism, so it preserves dimension. It does not preserve the subspace: with and the swap of two rows, while , and the two share only .
Those are the two facts to carry out of this section. Elimination leaves the null space and the row space exactly where they were, which is why it can be trusted to compute them, and it moves the column space, which is why a basis of the column space must be read off the columns of the original and never off the columns of the reduced matrix. Courses state that rule. [row-ops-preserve] is the reason for it.
6.3. The geometry: planes that pivot about the answer
[row-ops-preserve] is a statement about subspaces, and it has a picture. The picture is worth considering: it makes the theorem obvious, and it makes the algorithm's one counterintuitive rule inevitable.
Read a single equation geometrically. The row of an augmented matrix is the condition , whose solutions are a plane in (a hyperplane in , and an affine subset of dimension in the sense of [affine-set], whenever ). A system of equations is planes, and its solution set is what they have in common. Now take the three operations of [row-operations] one at a time and ask what each does to that arrangement.
A swap moves nothing. It reorders the equations on the page. The planes are a set, and a set has no order.
A scale moves nothing either. The equations and have exactly the same solutions for any , so the plane is not merely carried somewhere and brought back: it never moves. A plane has no preferred equation, only a proportionality class of them, and scaling walks around inside that class. This is the operation that makes pivots equal to , and it is geometrically inert.
Only the replacement turns anything, and it turns it about the answer. Send row to . Any satisfying both original equations satisfies the combination, so the new plane still contains everything the old arrangement had in common. The plane has pivoted about the solution set, which is held fixed like an axle. It cannot do otherwise, because the solution set is exactly what it was told to keep.
The picture is [row-ops-preserve]. The intersection of the planes is the solution set, no operation can move it, and elimination rewrites the question until the answer is legible. The row space is the space of all linear equations that follow from the system, elimination cannot leave it, and what the algorithm chooses is a better basis of consequences.
A zero row is the equation , whose solution set is all of space. It constrains nothing, so it has no plane, and the plane that was there simply goes out. Nothing was lost when it went: in the figure's first system, as in the worked example of [elimination-worked], row two is row one doubled, which is to say the second plane was lying exactly on top of the first, and a duplicate plane was never a second constraint. Elimination did not destroy information. It exposed that there was none.
An inconsistent system reduces to a row , the equation , whose solution set is empty, and this is [consistency] arriving in the picture: three planes can perfectly well have no common point, as any two of them meet in a line and the three lines miss each other. The algorithm ends by writing the empty set down.
Last, what reduced means. Each pivot row of an RREF has a in its pivot column and zeros in every other pivot column, so its equation solves for one pivot variable in terms of the free ones. When the solution is a single point, there are no free variables at all, and the reduced planes are exactly the planes perpendicular to the coordinate axes: , , . The elimination has turned each plane until its equation states one coordinate of the answer. That is what the algorithm is for, and it is visible in the figure.
The figure is the row picture, where the planes move and their intersection does not. The column picture behaves in the opposite way, and the comparison is worth considering.
In the column picture, asks for as a combination of the columns of , and elimination hits every column with the same invertible . The columns therefore all move, and so does their span, which is [row-ops-preserve] again. What does not move is the set of coefficient relations among them: says precisely that a combination of the columns vanishing before the elimination is the same combination vanishing after it. carries the columns off to new positions and carries every dependence among them along unchanged.
So the row picture preserves a set and the column picture preserves the relations, and between them they explain the rule that looks arbitrary in every course that states it. A basis of is read from the pivot columns of because the columns of are in the wrong place, and the pivot positions are trustworthy because the relations that determine them were never disturbed. The coefficients come from , the columns come from , and [rref-bases] now reads like a description of what happened rather than a list of instructions.
6.4. Row echelon form, pivots and free columns
A matrix is in row echelon form if every zero row lies below every nonzero row, and the leading entry of each nonzero row, called its pivot, lies strictly to the right of the pivot of the row above. It is in reduced row echelon form if in addition every pivot equals and is the only nonzero entry in its column.
A column containing a pivot is a pivot column; every other column is a free column.
Every can be brought to a reduced row echelon form by finitely many elementary row operations. Equivalently, there is an invertible with .
Proof
The proof is the algorithm. Keep a count of pivots placed so far, initially , and sweep the columns left to right. At column , inspect the entries in rows .
If they are all zero, column is free; leave it and move to column .
Otherwise choose a nonzero one, swap its row into position (operation 1), scale that row to make the entry (operation 2), and add suitable multiples of row to every other row to clear the rest of column (operation 3, applied at most times). Increase by one and move to column .
The sweep visits each of the columns once and performs at most operations there, so it halts. At the end: pivots were placed in rows in strictly increasing column order, each is , each is alone in its column, and rows are zero, since every column was either cleared below row or was already zero there. That is the reduced form. Composing the elementary matrices of the operations performed gives an invertible with , invertible as a product of invertibles by [elementary-invertible].
Let be the columns of , and let be any reduced row echelon form of . Then column is a pivot column of if and only if
In particular the pivot positions do not depend on which sequence of row operations was used to reach .
Proof
For any matrix with columns , the statement says exactly that there is an whose last nonzero entry sits in slot : given such a combination , the vector with , and zeros beyond is such a null vector, and conversely such a null vector may be solved for . This is a statement about alone, and by [row-ops-preserve]. So the property holds for if and only if it holds for the -th column of .
It remains to check the property against the pivot structure of . A free column of has its nonzero entries confined to the rows of pivots standing to its left, so it is a combination of those pivot columns, which precede it. A pivot column of , with its in row , cannot be such a combination: every column of to its left has a zero in row , since the pivots to the left sit in rows above and free columns to the left are supported on those same rows. Any combination of them therefore has a zero in row , and the pivot column has a there.
6.5. Bases for all four subspaces
Let with invertible and in reduced row echelon form, with pivots, in columns . Then:
- .
- The nonzero rows of are a basis of .
- The columns of are a basis of .
- For each free column , define the special solution by
The special solutions form a basis of . 5. The rows of in the positions of the zero rows of form a basis of .
Proof
(2). by [row-ops-preserve], so the nonzero rows of span it. They are independent: in a vanishing combination , look at entry , where row has a and every other row has a , giving .
(1). By (2), , and by [row-rank-col-rank].
(4). Each lies in : row of has a in column , zeros in the other pivot columns, and entry in a free column , so
and by [row-ops-preserve]. They are independent, since is the only one of them with a nonzero entry in free slot . They span: given , put , which lies in and has every free entry zero. Row of then reads , so every pivot entry vanishes too, giving . Hence , and there are of them.
(3). Independence: a vanishing combination of the pivot columns of is a vector of with every free entry zero, and the previous paragraph showed the only such vector is . Spanning: rearranging [eq:eq-special-solution] as a statement about columns, says
so every free column of lies in the span of the pivot columns of , and the pivot columns span . The coefficients are read from while the columns being combined are those of , which is the content of the warning after [row-ops-preserve].
(5). Row of says . If row of is zero, then that row of , transposed, lies in by [four-subspaces]. There are such rows, they are independent because is invertible, and by [rank-transpose], so they are a basis.
Part 5 is the second use of [blocks-in-parallel]. Reduce and the recorder block ends holding , whose rows facing the zero rows of are the conservation laws of §8.2, extracted by bookkeeping. Reducing alone would compute the same and throw away.
6.6. Counting rank-nullity
For every ,
Proof
Every column of is a pivot column or a free column and not both. Count them: , and the two counts are and by parts 1 and 4 of [rref-bases].
[rank-nullity-counted] is [rank-nullity] again, and the proofs have nothing in common. The first extends a basis of the kernel to a basis of the domain and never mentions a number; the second sorts columns into two bins and counts them. The first is the stronger statement, because it holds for a linear map on any finite-dimensional space: the operator of [examples-vs] has a rank and a nullity, and there is no array to reduce. The second holds only where there is an array. This is the difference between a theorem about maps and an algorithm on matrices, and the series will keep them apart to the end.
Take the matrix that §7 will solve, and reduce so that the left null space falls out with the rest:
Clear column one with and , then swap and to bring a nonzero entry into the pivot position, and scale by :
Finally clears above the second pivot:
Read [rref-bases] off it. Pivots stand in columns and , so and column is free, so .
- Row space. , the nonzero rows of .
- Column space. , the first two columns of . The first two columns of are , which span a different plane, exactly as [row-ops-preserve] warns.
- Null space. One free column, so one special solution: , , , giving , the line §7 found by hand.
- Left null space. has one zero row, the third, and the third row of is , so . It says , which is the redundancy visible in from the start: row two is twice row one.
Four subspaces, one sweep.
Every operation above was performed in a field, exactly. On a computer in floating point the same algorithm can be badly behaved: dividing by a pivot that is nonzero and tiny amplifies rounding error, and the fix, choosing the largest available entry as the pivot, is partial pivoting. That is numerical linear algebra, it is a different subject with different theorems, and nothing in this series depends on it. The chemistry of §8 is done over , where the question does not arise.
7. Solving
Everything proved so far collapses into one clean statement about the oldest question in the subject. This section answers when a linear system has a solution, when it has only one, and what the set of all of them looks like.
Let and , and let .
- Existence. if and only if .
- Uniqueness. If , then has exactly one element if and only if .
- Structure. If , then
Proof
(1) is the definition of the image, which is the column space. (3): if and , then , so with ; conversely . (2) follows from (3), since is a single point exactly when is.
Reduce the augmented matrix of [augmented]. The system is solvable if and only if the last column is a free column, and this is equivalent to
Proof
By [pivots-intrinsic], the last column is a pivot column exactly when , which by part 1 of [solution-set] is exactly when the system has no solution. The rank statement is the same fact counted: adjoining either adds a pivot or does not.
A pivot in the last column is the row , which reads . The contradiction a student is taught to look for at the bottom of an elimination is the statement , and nothing more.
Reduce to , with in reduced row echelon form, pivots in columns , and . Then:
- Consistency. The system is solvable if and only if , the entries of facing the zero rows of .
- Solution. When it is solvable, the pivot rows read
and assigning the free variables arbitrary values produces every solution exactly once.
Proof
Row of has a in column and zeros in the other pivot columns, so it reads , which is [eq:eq-back-substitution]. Row is zero, so it reads . If some there, the reduced system, and hence the original one by [row-ops-preserve], has no solution. If all of them vanish, choose the free entries freely and let [eq:eq-back-substitution] supply the pivot entries: the resulting satisfies every row, and distinct choices give distinct vectors, since the free entries are visible in the answer.
Permute the columns so that the pivot columns come first, which relabels the unknowns as and changes nothing else. Then [eq:eq-back-substitution] is one matrix equation, and the reduced array has the block shape
Every elimination in this series ends here. Solvability is , and then
which is [eq:eq-solution-set] with the particular solution and the null space spanned by the columns of , whose columns are the special solutions of [rref-bases]. Existence is the block , uniqueness is the width of , and the answer itself is . One array holds all three.
An affine subset of a vector space is a set of the form for some and some subspace . Its dimension is . It is a subspace if and only if .
The word affine is the shortest true description of [eq:eq-solution-set], and it matters in three places.
The solution set of an inhomogeneous system is closed under no linear combination at all, except the ones whose coefficients sum to one: if then , which equals exactly when , which is the structure identified in [affine-not-linear]. It has a well-defined dimension, , and a well-defined direction space, , and no distinguished point: is any solution you happen to find, and a different one names the same set. That last property is what makes an extent of reaction a coordinate in §8 rather than a physical quantity, and it is what makes a particular solution of an inhomogeneous ODE a choice in Part II.
Take
This is the matrix reduced in [elimination-worked], so and are already known. Only is new, so reduce the augmented matrix, which repeats that elimination with one more column carried along:
The last column is free, so the system is solvable by [consistency], and the reduced rows read and . Setting the free variable gives the particular solution , and by [eq:eq-solution-set]
where the direction is the special solution with its sign flipped, which names the same line. This is a line in that misses the origin: an affine subset of dimension one, and not a subspace.
Recovering the known result. Check the null-space vector directly: , so , and . Then for every , which is the whole content of [eq:eq-solution-set]: linearity does the substitution for us, and no case-by-case verification is left to do.
The figure runs [eq:eq-rank-nullity] as a conservation law. Slide the rank of a linear map and the two dimensions trade against each other: as the image collapses from a solid to a plane to a line, the kernel grows from a point to a line to a plane, and the sum stays at three. A system whose image has collapsed is one whose may now fail to be reachable, and whose solution set, where it exists, has become a large affine set rather than a point. Existence and uniqueness are the two ends of the same slider.
8. Stoichiometry: an affine set cut by a nonlinear variety
The sharpest statement in this lecture is also the reason chemistry was chosen as the application. The stoichiometric matrix and the extent of reaction used below are standard in reactor analysis, where Aris [5] sets them out in the linear-algebraic form this section assumes. Take the Haber process, , and write down its ICE table. The amounts are
which is degree one in : an affine set, a straight line in the space of species amounts, direction , base point . The equilibrium condition that picks a point on that line is
which, cleared of denominators, is degree four in . The quotient on the left is written in mole amounts rather than activities, and the that appears in the worked problem of §8.3 is a number chosen to make that problem come out, not a measured constant; the remark in §8.3 says exactly what is being assumed, and nothing in the degree count depends on it. Same variable, same table, two utterly different kinds of object: a line and a quartic hypersurface. The line is linear algebra and this lecture solves it completely; the quartic is not and never will be. A course that calls the whole table "linear" has thrown away the only distinction that explains why one half is easy.
8.1. Balancing is a null-space search
Fix an ordered list of species and an ordered list of the chemical elements they contain. The element-species matrix has one row per element and one column per species, with the number of atoms of element in one molecule of species . Every entry is a non-negative integer; no reaction has been mentioned yet, and none is needed to write down.
The reaction is carried entirely by the sign of the coefficients. A stoichiometric coefficient vector is a vector whose entry is negative for a species consumed, positive for one produced, and zero for one not taking part. It balances if and only if
which says exactly that the atom count of each element is unchanged by the reaction.
For methane combustion, with species ordered and elements ordered , the atom counts are read straight off the formulae:
Three elements, four species, so has rank at most three and by [rank-transpose]: there is always at least one balancing vector, before any arithmetic is done. That is the theorem. The vector itself is an elimination, and §6 has just supplied one. Clearing column one with , exchanging the last two rows to bring a nonzero entry into the second pivot position, and scaling the rows to unit pivots:
the last step clearing above the third pivot. Three pivots, so and by [rank-nullity-counted]: the balance is unique up to scale after all.
The single free column is the fourth, which is water. Its special solution, from [eq:eq-special-solution], is
and the doubling is the only arithmetic in the whole balance: it clears the denominators, which is possible because is a field and is not, exactly as flagged after [field]. Fixing the sign so that methane is consumed gives : methane and oxygen negative, carbon dioxide and water positive, magnitudes . That is the balanced equation
the answer the student got by juggling. Two facts she was never told are now theorems. Her answer is unique up to scale because . And whenever a reaction network has , no amount of juggling gives a unique answer, because there is no unique answer to be had: the number of independent reactions among a set of species is , which is the statement of [rank-nullity] in a laboratory.
from sympy import Matrix, Rational, ilcm, igcd
# Species: CH4, O2, CO2, H2O. Elements: C, H, O.
# E holds ATOM COUNTS only: every entry non-negative, no reaction in sight.
E = Matrix([[1, 0, 1, 0],
[4, 0, 0, 2],
[0, 2, 2, 1]])
print("E =", E.tolist())
print("rank E =", E.rank())
ns = E.nullspace()
print("dim N(E) =", len(ns), "(unique up to scale iff this is 1)")
# Clear the rational null-space vector to a primitive integer vector.
v = ns[0]
den = 1
for e in v:
den = ilcm(den, Rational(e).q)
ints = [int(Rational(e) * den) for e in v]
g = 0
for k in ints:
g = igcd(g, k)
ints = [k // g for k in ints]
# Fix the sign so that methane (species 0) is CONSUMED: nu_0 < 0.
if ints[0] > 0:
ints = [-k for k in ints]
print("signed coefficients (CH4, O2, CO2, H2O) =", ints)
print("E . nu =", (E * Matrix(ints)).T.tolist(), "-> every element conserved")
print("magnitudes match the textbook answer [1, 2, 1, 2]:",
[abs(k) for k in ints] == [1, 2, 1, 2])Verification: methane combustion balances to (-1, -2, 1, 2), and the null space is one-dimensional
The reaction chemistry students are taught to fear is the one where electrons move:
The method drilled for it is the half-reaction ritual: split the equation in two, balance atoms, balance oxygen with water, balance hydrogen with protons, balance charge with electrons, scale the halves until the electrons cancel, add them back together. It is a procedure with six steps, an order to them, and no visible reason.
There is no new mathematics here at all. Charge is conserved by a reaction exactly as manganese is, so charge is simply one more thing to count, which is to say one more row. With species ordered and rows ordered ,
The charge row is the only one with a negative entry, since is an anion, and it is a row like any other: the covector "count the net charge", in the sense of §4.1. Reducing gives
with five pivots and one free column, the water. So and by [rank-nullity-counted], and the balance is unique up to scale before a single coefficient has been chosen. The special solution has water as its free entry, and taking that entry to be clears every denominator at once:
which is the balanced equation
Check the charge row by hand, since it is the one the ritual makes a drama of: the left side gives and the right side gives . It balances because and the charge row is a row of , and for no other reason.
The electrons never appeared. They did not need to: an electron is not a species here, because none of the six species is an electron, and the charge row already records every consequence of the electrons having moved. The six-step ritual is one null-space computation on a matrix with five rows instead of four.
§8.1 claimed that a species list with admits no unique balance. Here is one, and it is not exotic: burn carbon in oxygen and let it burn incompletely. Species , elements ,
Two pivots, in the columns of and , and two free columns, and . So and . The set of balanced reactions among these four species is a plane, and the question "what is the balanced equation" has no answer.
The two special solutions of [eq:eq-special-solution], cleared of denominators, are a basis of that plane:
which are the two reactions a chemist would have named:
Every balanced reaction on this species list is a combination of those two, and that includes the one a chemist would name third, the burning of carbon monoxide:
The third reaction is real, it happens in the flame, and it is not independent. It is a linear combination of the other two, and no chemical fact will ever make it otherwise, because and three vectors in a plane are dependent by [steinitz]. The rank of has told us how many reactions the flame can have without repeating itself, and the answer is two, whatever the mechanism turns out to be.
This is what the sentence "the number of independent reactions is " means in a laboratory. A juggler asked to balance this system would find an answer and never learn that there were infinitely many, all of them correct.
8.2. Conservation laws are a left null space
A network of several reactions gets a second matrix, and the two must be told apart.
For a network of reactions among species, the stoichiometric matrix has one column per reaction, whose entries are the change in each species amount per unit extent of that reaction: negative for a species consumed, positive for one produced. Each column is therefore a stoichiometric coefficient vector in the sense of [element-species], and each is balanced.
Let be the element-species matrix of [element-species] for the same species list. Then
so every row of lies in , the left null space of . More generally, a vector lies in if and only if the quantity is conserved along every trajectory of the network.
Proof
The -th column of is applied to the -th column of , and that column is a balanced coefficient vector, so [eq:eq-balance] kills it. Balancing one reaction and annihilating the whole network are the same statement, read one column at a time: the entry of is the net change in the number of atoms of element per unit extent of reaction , and a chemical reaction conserves atoms of every element. For the general statement, the amounts under the network are , so , which is independent of for all precisely when .
Hydrogenate 1-butene and then isomerise the product:
With species ordered and elements ordered ,
Multiply: , as [conservation-left-null] promised without any multiplication being needed. Carbon: in the first column, in the second. Hydrogen likewise.
Now count. is of rank , so by [rank-transpose]. There are exactly two independent conserved quantities, and the two rows of (which are independent) already exhaust them: total carbon and total hydrogen. Nothing else is conserved, and the left null space is the proof that nothing else can be.
The network is complete. Each column of balances, so by [eq:eq-balance]: the reactions of a network always live in the null space of the element-species matrix. Here they fill it. has rank , so , which is the rank of , and a subspace of the right dimension inside a subspace is all of it by [extend-to-basis]. So , and the two columns of are a basis of it. Every reaction these four species can undergo, known or unknown, discovered or not yet discovered, is a combination of these two. That is a strong claim about chemistry, and its entire content is a dimension count.
Look at the last two columns of . They are identical, both , because -butane and isobutane are the same atoms in a different arrangement, and [element-species] counts atoms. The element-species matrix is blind to isomerism, as promised in [chem-terminology].
The blindness is the right answer, and the second column of is why. The isomerisation is annihilated by because it is the difference of two identical columns, so element conservation permits it and says nothing else about it. Atom counting cannot forbid a rearrangement of atoms. It also cannot predict one: whether that isomerisation actually proceeds is a question for thermodynamics and kinetics, and no amount of linear algebra will answer it. What the linear algebra does deliver is the exact boundary of its own competence, which is more than the juggling ever offered.
8.3. The ICE table: degree one meets degree four
Return to the Haber process with the feed in the species order . By [eq:eq-ice-affine],
each of them degree one in . The whole ICE table is one point moving along one line, and the extent of reaction is a coordinate on that line, in the sense of [coordinates-unique] applied to the one-dimensional direction space . The feed is in stoichiometric ratio, so both reactants are exhausted together at , and the physically admissible segment is .
The condition [eq:eq-equilibrium] is written as a power product of mole amounts. The true equilibrium condition is a power product of activities, and the two coincide only at the volume that makes the activities numerically equal to the amounts, effectively unit volume. Everything below is therefore a statement about that reference volume, and the numerical value of used here is an artefact of where the worked problem places equilibrium: it is not the measured equilibrium constant of ammonia synthesis at any real temperature. None of this touches the mathematics, because the degree contrast, one against four, is unchanged by any volume factor: a volume term multiplies [eq:eq-equilibrium] by a constant and leaves the polynomial degree in exactly where it was. The caveat is stated, and we move on.
Substituting the affine amounts into [eq:eq-equilibrium] and clearing denominators,
Take . Then [eq:eq-haber-quartic] reads . Taking positive square roots on the admissible segment, where both sides are non-negative,
whose roots are and . The second lies outside and is discarded on physical grounds: it would drive both reactant amounts negative. So , and the equilibrium amounts are
Recovering the known result. Feed the amounts back into the quotient:
Every atom is accounted for too, as [conservation-left-null] requires: nitrogen , which is the feed value ; hydrogen , which is the feed value . The conservation rows were never imposed. They hold because the state never left the affine set [eq:eq-ice-affine], whose direction is annihilated by them.
Two objects sat in that table. [eq:eq-ice-affine] is degree one and is completely solved by §7: a line, a direction space, a coordinate, conservation laws read off a left null space. [eq:eq-haber-quartic] is degree four and is a different subject; we solved this instance only because a perfect square happened to be extractable, and the general case falls to a numerical root-finder. What linear algebra buys is the ability to see that the quartic is the only hard thing in the problem, and to hand it the simplest possible geometry to cut.
Three species amounts on three axes, one point in the space of states. The straight line is the affine set [eq:eq-ice-affine], along which the extent of reaction is the coordinate. The flat sheet is a conservation plane, one row of , and the line lies inside it exactly because that row is in the left null space of ([conservation-left-null]). The curved sheet is the equilibrium variety [eq:eq-equilibrium], which is where the linearity stops. Drag and watch the reaction quotient climb to at the one point where the line pierces the curve. The straight object and the curved object are drawn in the same picture, because the point of the picture is that they are two objects.
9. The determinant we have not defined
A debt, stated plainly. The determinant has been leaned on twice in this lecture without ever being defined: [p-invertible] asserts a change-of-basis matrix is invertible, and every reader knows the test for invertibility is a nonvanishing determinant, and the remark after [similarity] claimed the determinant survives a change of basis. Neither claim was proved, because the determinant cannot be properly defined at this stage. The formula with the sum over permutations computes something not yet named.
The debt is settled three times, each settlement stronger than the last.
- Part II axiomatises it: is the unique function of the columns of a matrix that is multilinear, alternating, and equal to one on the identity. Uniqueness makes the permutation formula a theorem rather than a definition, invariance under [eq:eq-similarity] falls out of multiplicativity, and the meaning of is signed volume. Part II needs it because the characteristic polynomial needs it.
- Part IV explains it: a linear map on an -dimensional space induces a linear map on the one-dimensional space , and a linear map on a one-dimensional space is multiplication by a scalar. That scalar is . The alternating multilinear axioms of Part II are then simply the definition of , and the reason the determinant is basis-independent is that was constructed without a basis.
- Part VI reveals it: is the factor by which stretches -dimensional volume, and it equals , the product of the singular values. This is the top-dimensional case of the theorem stated in §0, in which rotation, stretch, area, volume and determinant become one object.
Part II begins with eigenvalues, and to have eigenvalues we need a determinant. That is where the series goes next.
References
- S. Axler, Linear Algebra Done Right, 4th ed., Springer, 2024. DOI
- P.R. Halmos, Finite-Dimensional Vector Spaces, 2nd ed., Springer, 1974. DOI
- R.A. Horn and C.R. Johnson, Matrix Analysis, Cambridge University Press, 1985. DOI
- G. Strang, Linear Algebra and Its Applications, 4th ed., Cengage, 2006.
- R. Aris, Elementary Chemical Reactor Analysis, Prentice-Hall, 1969.
- W.R. Hamilton, "On Quaternions", read to the Royal Irish Academy, 11 November 1844; Proceedings of the Royal Irish Academy 3 (1847), 1–16.
- H. Grassmann, Die lineale Ausdehnungslehre, ein neuer Zweig der Mathematik, Wigand, Leipzig, 1844.
- J.W. Gibbs, Elements of Vector Analysis, Arranged for the Use of Students in Physics, privately printed, New Haven, 1881–4, Art. 1. Archive
- O. Heaviside, Electromagnetic Theory, vol. I, The Electrician, London, 1893, §103, 139–142. Archive
- E.B. Wilson, Vector Analysis: A Text-Book for the Use of Students of Mathematics and Physics, Founded upon the Lectures of J. Willard Gibbs, Scribner, New York, 1901, Art. 4. Archive
- F. Cajori, A History of Mathematical Notations, vol. II, Open Court, Chicago, 1929, §502.
- G. Ricci and T. Levi-Civita, "Méthodes de calcul différentiel absolu et leurs applications", Mathematische Annalen 54 (1900), 125–201. DOI
- A. Einstein, "Die Grundlage der allgemeinen Relativitätstheorie", Annalen der Physik 49 (1916), 769–822, §5. DOI