Linear algebra · foundations Section 1.1 · item 2 of 29

Vector addition &
scalar multiplication

You are allowed to add two vectors together, and you are allowed to stretch one by a number. That is the complete list. Every concept in linear algebra — span, independence, basis, dimension, subspace, rank — is vocabulary invented to describe what those two operations can and cannot reach.

Notice what is not permitted. You cannot multiply two vectors. You cannot ask how long one is or what angle sits between two. A bare vector space knows nothing about size or direction — only about combining.

Everything, in one expression

av + bw

A linear combination. Scale, then add. Both operations, used once each. The rest of the subject is asking which points this expression can produce.

Reach for a point

Drag the two vectors. Move the coefficients. The amber dot is a·v + b·w, built tip-to-tail. Turn on the span to see everywhere those coefficients can take you — then drag w until it lines up with v and watch the plane collapse into a line.

v w a·v + b·w
1.00
1.00
v
w
a·v + b·w
det [v w]

The determinant is the signed area of the parallelogram. When it hits zero the two vectors are parallel, the parallelogram has no area, and everything you can build lies on a single line.

01The two moves

Component-wise, and geometrically

Addition

(u1, u2) + (v1, v2) = (u1+v1, u2+v2)

Add matching coordinates. Nothing crosses between components — the first coordinate never sees the second.

Geometrically: place the tail of the second arrow at the tip of the first, and the sum runs from the original origin to the final tip. Do it in the other order and you land in the same place, which is exactly the parallelogram in the hero.

Scalar multiplication

c(v1, v2) = (cv1, cv2)

Multiply every coordinate by the same number. Again nothing mixes.

Geometrically: stretch the arrow. c > 1 lengthens, 0 < c < 1 shortens, c < 0 flips it through the origin, and c = 0 collapses it to the zero vector. The direction line never changes — only where you sit along it.

Tip-to-tail · the parallelogram · scaling along a fixed direction
Subtraction is not a third operation. u − v is shorthand for u + (−1)v — scalar multiplication by −1, then addition. Likewise averaging, interpolating, and taking a weighted sum are all just these two moves used together. The list really does stop at two.
02The axioms

The rules those operations must obey

A vector space is any set where you can define these two operations such that eight properties hold. The properties are unexciting individually — they mostly say "behaves the way arithmetic does" — but together they are exactly what every theorem in linear algebra is built from.

AxiomStatementWhat it rules out
closure (+)u + v is in VAdding two members can't escape the set
closure (·)cv is in VNor can scaling one
commutativeu + v = v + uOrder of addition can't matter
associative(u + v) + w = u + (v + w)Grouping can't matter, so sums need no brackets
zero vectorThere is a 0 with v + 0 = vEvery vector space has an origin. This is not optional
additive inverseEvery v has a −v with v + (−v) = 0You can always get back to the origin
distributive over vectorsc(u + v) = cu + cvScaling a sum equals summing the scalings
distributive over scalars(c + d)v = cv + dvThe two operations agree with each other
compatiblec(dv) = (cd)vScaling twice is scaling once by the product
scalar identity1v = vMultiplying by one does nothing
Why bother with axioms at all? Because every theorem proved from them applies instantly to anything satisfying them. Prove something about "vector spaces" once and it holds for arrows, for polynomials, for functions, for matrices, for random variables, and for the 768-dimensional embeddings in your model — none of which you had in mind when you proved it. That transfer is the entire return on the abstraction.
Textbooks count differently. Some list eight axioms and fold the two closure conditions into the definition of the operations; others list ten. Nothing mathematical hangs on it. What matters is the zero vector and the inverses — those are the two that get violated in practice, usually by someone proposing a "space" that doesn't contain the origin.
03What's missing

A vector space is remarkably bare

The most instructive thing about the definition is what it leaves out. None of the following are available in a plain vector space, and each has to be added deliberately as extra structure.

Not includedWhat it would needWhat that buys
length of a vectorA normMagnitude, distance, convergence. L1 and L2 are different choices
angle between vectorsAn inner productOrthogonality, projections, cosine similarity, least squares
vector × vectorAn algebraNot part of the definition at all. The dot product returns a scalar, not a vector
comparing two vectorsAn orderThere is no "greater than" for vectors in general
coordinatesA chosen basisVectors exist without coordinates; coordinates are a description you pick
This is why cosine similarity is a modelling decision, not a fact about vectors. An embedding lives in a vector space, so you may add and scale it freely — but "how similar are these two embeddings" is a question the vector space cannot answer. You answer it by choosing an inner product, and choosing a different one gives different similarities. The geometry you think you see in an embedding space is structure you brought with you.
04Combinations

The only thing you can build

c1v1 + c2v2 + ⋯ + ckvk

Scale each vector by some number, add the results. This is a linear combination, and it is the only expression the two operations permit. Everything reachable from a set of vectors has this form; nothing else does.

All coefficients zero

Gives the zero vector, always. Called the trivial combination — and whether it's the only way to reach zero is precisely the question of linear independence.

One coefficient nonzero

A scalar multiple of a single vector. The set of all of these is a line through the origin.

All coefficients free

The full reachable set, which is the span. Section 05.

You have written more linear combinations than you realize. A neuron computes w₁x₁ + w₂x₂ + … + b. A gradient step computes θ − α∇f. A momentum update computes βv − α∇f. An ensemble averages predictions. Attention takes a weighted sum of value vectors. Every one of those is scale-then-add, and nothing else.
05Span

Everywhere you can get to

The span of a set of vectors is the set of all their linear combinations — the complete reachable territory. Turn on "show span" in the hero and it's drawn for you.

What span looks like

span{}
Just the origin. The empty combination.
span{v}
A line through the origin, in the direction of v.
span{v, w}
A plane, if they point in genuinely different directions. A line if they don't.
span{e₁, e₂}
All of ℝ² — the standard basis reaches everything.

Notice that every span contains the origin, because setting all coefficients to zero is always allowed. There is no such thing as a span that misses the origin.

Adding a vector may add nothing

Throw a third vector into a set and one of two things happens. Either it lies outside the current span, in which case the span grows a dimension — or it was already reachable, in which case the span is completely unchanged.

In the hero, drag w onto the line through v. The span was a plane; now it's a line. The second vector stopped contributing anything the first didn't already give you.

This is what rank means. The rank of a matrix is the dimension of the span of its columns. A matrix with 300 columns whose span is 12-dimensional has 288 columns that add nothing — they're all reachable from the other twelve. That's not an abstraction; it's what "your features are redundant" means precisely, and it's why the corresponding regression problem has no unique solution.
06Independence

When a vector earns its place

A set is linearly independent if the only way to combine them into the zero vector is to set every coefficient to zero. If some non-trivial combination hits zero, one of them is redundant — you can solve for it in terms of the others.

c1v1 + ⋯ + ckvk = 0   only when   c1 = ⋯ = ck = 0

Equivalent phrasings

  • No vector in the set lies in the span of the others.
  • Removing any one of them shrinks the span.
  • Every vector in the span has exactly one representation as a combination.
  • For a square matrix of them: the determinant is non-zero.

That third one is doing quiet work. Independence is what makes coordinates well-defined — without it, the same point has infinitely many descriptions.

Any set containing the zero vector is automatically dependent, since you can give 0 a coefficient of 1 and everything else 0. Likewise, more than n vectors in n dimensions are always dependent — there simply isn't room.
Near-dependence is the practical problem, not exact dependence. Real data rarely gives you exactly parallel columns; it gives you columns at an angle of two degrees. The determinant is tiny but non-zero, the matrix is technically invertible, and the inverse is numerically garbage. That's multicollinearity, and it's why the condition number matters more than the determinant.
07Basis

Enough vectors, and not one more

A basis is a set that is both independent and spanning — just enough vectors to reach everything, with none to spare. Every vector space has one, and every basis for a given space has the same number of elements. That number is the dimension.

Spanning but dependent

Too many vectors. Reaches everything, but representations aren't unique — the same point can be built several ways.

Independent but not spanning

Too few. Every representation is unique, but there are points you can't reach at all.

Basis

Exactly right. Everything is reachable, and each point has precisely one set of coefficients.

Coordinates are the coefficients. Writing a vector as (3, −2) is shorthand for 3e₁ + (−2)e₂ — you are quoting the coefficients of a linear combination in the standard basis. Choose a different basis and the same vector has different coordinates while remaining the same vector. The arrow doesn't move; the description does.

Change of basis, in ML

  • PCA finds a new orthonormal basis ordered by variance, then keeps the first few directions. The data hasn't changed — you re-expressed it and discarded coordinates that were mostly noise.
  • Fourier and wavelet transforms are changes of basis for functions. Same signal, different coefficients, and compression is throwing small coefficients away.
  • Embeddings are coordinates in a learned basis. The dimensions individually mean nothing; the geometry between points is what carries information.

Dimension is intrinsic

That every basis has the same size is a genuine theorem, not a convention. It's what makes "dimension" a property of the space rather than of the description you happened to pick.

It also underwrites the rank-nullity theorem: for a linear map, the dimensions of the image and the kernel always sum to the dimension of the domain. Whatever a map collapses, it loses from its output exactly.

08Subspaces

A vector space inside a vector space

A subset that is itself a vector space under the same two operations. The test is short, because the messier axioms are inherited automatically.

The three-part test

  1. It contains the zero vector.
  2. It is closed under addition.
  3. It is closed under scalar multiplication.

The first condition eliminates most candidates immediately. A line that doesn't pass through the origin fails — scale any of its points by zero and you leave the set.

The unit circle is not a subspace even though it looks geometrically tidy: it misses the origin, and adding two points on it lands off it. Neither is the positive quadrant — scaling by −1 escapes. Subspaces are flat, unbounded, and anchored at the origin.

Column space

The span of a matrix's columns — everything Ax can produce. A system Ax = b is solvable exactly when b lies in it.

Null space

Every x with Ax = 0 — what the map destroys. If it contains more than the origin, solutions are never unique.

Row space

The span of the rows. Its dimension equals the column space's, which is the somewhat surprising fact that row rank equals column rank.

09Not arrows

Anything you can add and scale

The definition never mentions arrows, coordinates, or geometry. Any set with two operations obeying the axioms qualifies — and the payoff is that all the machinery transfers. Below, five functions are being combined the same way two arrows were.

0.00
0.40
−0.60
0.55
0.00

Five coefficients, five basis functions, one linear combination. The faint curves are the scaled components; the amber curve is their sum. Structurally identical to a·v + b·w — only the objects changed.

Function space · the same two operations, applied to curves
The "vectors" areAddition meansDimension
Arrows in ℝⁿCoordinate-wisen
Polynomials of degree ≤ nAdd coefficientsn + 1
Continuous functions on [0,1]Pointwise: (f+g)(x) = f(x)+g(x)Infinite
m × n matricesEntry-wisemn
Solutions to a linear ODEAdd solutionsOrder of the equation
Random variables with finite varianceAdd pointwiseInfinite — and covariance is its inner product
Grayscale imagesAdd pixel intensitiesNumber of pixels
Word embeddingsCoordinate-wiseModel width
The random-variable row is worth sitting with. Treat random variables as vectors, define the inner product as covariance, and orthogonality becomes uncorrelatedness. Least-squares regression is then literally a projection onto a subspace, and the residual is orthogonal to the fitted values because that is what projection means. The geometry of linear regression is not an analogy — it's the same theorem in a different vector space.
10Constrained

What happens when you restrict the coefficients

Linear combinations let coefficients be anything. Constrain them and you get smaller, more useful sets — and three of the most common operations in machine learning are exactly these constrained cases.

KindConstraintReachable set from two pointsWhere it shows up
linearnoneThe whole plane through the originSpan, rank, layer weights
affinecoefficients sum to 1The infinite line through both pointsA layer with a bias. Regression lines
convexsum to 1, all ≥ 0The segment between themAveraging, interpolation, attention, mixtures
conicall ≥ 0The wedge spanned by both directionsNon-negative matrix factorization
Attention is a convex combination, precisely. Softmax produces weights that are non-negative and sum to one, and the output is those weights applied to the value vectors. So every attention output is guaranteed to lie inside the convex hull of the values it attended to — it can interpolate among them but never extrapolate beyond them. That's a real structural constraint on what the mechanism can produce.
A neural network layer is affine, not linear. Wx + b fails the linearity test the moment b ≠ 0, since a linear map must send zero to zero. Everyone calls them linear layers anyway. It rarely matters, but it does explain why "linear" models have an intercept and why the bias is often absorbed by appending a constant 1 to the input — a genuine trick for turning an affine map back into a linear one.

Latent-space interpolation is the convex case made visual. Walking from one point to another in a generative model's latent space by t·z₁ + (1−t)·z₂ is a convex combination, and the smooth morph you see in the output is the decoder's image of that straight segment. Whether the path stays in a region the model handles well is a separate question — and the reason spherical interpolation is often preferred to the straight line.

11Practice

Drills

#Do thisYou'll know it when
1Add and scale vectors by hand, then draw the tip-to-tail and parallelogram constructionsYou can predict the sum before computing it
2Verify all eight axioms for ℝ², then for polynomials of degree ≤ 2The abstraction stops feeling arbitrary
3Find a set that fails exactly one axiomYou know which axiom does which job
4Decide by hand whether five given subsets of ℝ³ are subspacesYou check for the origin first, automatically
5Take three vectors in ℝ³ and determine independence via the determinantZero determinant and "flat" mean the same thing to you
6Express one vector in two different bases and confirm it's the same vectorCoordinates and vectors are separate ideas in your head
7Run PCA and reconstruct the data from the top componentsChange of basis and compression are one operation
8Write a gradient descent step and identify each of the two operations in itOptimization looks like linear algebra
9Interpolate between two embeddings and inspect the midpointConvex combination is something you've done, not read

The one-paragraph summary

A vector space is a set equipped with exactly two operations — adding two elements and scaling one by a number — subject to eight axioms that amount to "behaves like arithmetic". Everything reachable is a linear combination, scale-then-add, and the whole vocabulary of the subject describes what those combinations can produce: the span is the reachable set, independence means no element is already reachable from the others, a basis is a minimal spanning set whose size is the dimension, and a subspace is a subset closed under both operations and therefore containing the origin. Notably absent from the definition are length, angle, and any way to multiply two vectors together — those require a norm or an inner product, which is why cosine similarity is a choice you make rather than a property vectors have. Because the axioms mention nothing about arrows, they apply equally to polynomials, functions, matrices, images, random variables and embeddings, and every theorem transfers for free. Constraining the coefficients gives affine combinations when they sum to one and convex combinations when they are additionally non-negative, which is exactly what a layer's bias term and an attention head's softmax weights respectively produce.