Linear Independence
The book calls linear independence “one of the most important concepts in linear algebra”, and the intuition it offers is the one to hold on to: a linearly independent set has no redundancy — remove any vector from it and you lose something.
That framing turns an abstract condition into a practical question. Given a pile of vectors, which of them are actually pulling their weight?
What you’ll learn
Section titled “What you’ll learn”- What a linear combination is, and why the zero vector is always a trivial one.
- The definition of independence via “only the trivial solution”, and why the word only is the whole definition.
- Five quick shortcuts for spotting dependence without any computation.
- The reliable test: write the vectors as columns and look at the pivot columns.
- Why independence is a property of a set, never of a single vector — and why the answer depends on the order you offer them in.
Intuition: giving directions in East Africa
Section titled “Intuition: giving directions in East Africa”This is the book’s own Example 2.13, and it is the best one in the chapter.
You are in Nairobi and want to describe where Kigali is. You could say:
“Go 506 km northwest to Kampala, then 374 km southwest.”
That is enough. Two directions, and Kigali is pinned down — the geographic coordinate system is a two-dimensional vector space if we ignore altitude and the Earth’s curvature.
Now someone adds: “It is about 751 km west of here.” Perfectly true, and completely unnecessary. The 751-km-west vector is a linear combination of the other two, so the set of three is linearly dependent.
flowchart LR N["Nairobi"] -->|"506 km northwest"| K["Kampala"] K -->|"374 km southwest"| G["Kigali"] N -->|"751 km west"| G G --> R["three vectors, and any one
is a combination of the other two"] R --> D["LINEARLY DEPENDENT"] D --> Q["so which two are 'the real ones'?
any two of the three will do"]
And note the symmetry the book points out: the redundancy is not attached to any particular vector. Given “751 km west” and “374 km southwest”, you can combine them to get “506 km northwest”. Any two of the three suffice; no one of them is the odd one out. That is why independence is a property of the set.
The math
Section titled “The math”Linear combinations
Section titled “Linear combinations”Given a vector space and vectors , every vector of the form
with is a linear combination of them.
The zero vector can always be written as one, because is always true. That combination — every coefficient zero — is the trivial one, and it is available for free no matter what the vectors are. So it tells you nothing.
The interesting question is whether there is a non-trivial way to reach zero.
The definition
Section titled “The definition”Read the second one carefully. It does not say “the trivial solution exists” — that is always true. It says the trivial solution is the only one. The entire content of the definition is in that word.
Five shortcuts
Section titled “Five shortcuts”Straight from the book’s remarks, and worth internalising because they save real work:
- There is no third option. vectors are either linearly dependent or linearly independent.
- If any , the set is dependent. Take and everything else zero — a non-trivial route to zero, immediately.
- If two vectors are identical, the set is dependent. Take and on the pair.
- A set of nonzero vectors with is dependent if and only if at least one of them is a linear combination of the others.
- In particular, if for any , the set is dependent. One vector being a multiple of another is the commonest case.
Shortcut 2 is the cheapest test in linear algebra, and the one most often forgotten. A single zero column makes an entire set dependent regardless of how well behaved the rest are.
The reliable test: pivot columns
Section titled “The reliable test: pivot columns”Write the vectors as the columns of a matrix and run Gaussian elimination to row-echelon form — reduced form is unnecessary here. Then:
- Pivot columns indicate vectors that are linearly independent of the vectors to their left.
- Non-pivot columns can be expressed as linear combinations of the pivot columns to their left.
- All the vectors are linearly independent if and only if every column is a pivot column. One non-pivot column anywhere and the set is dependent.
The book’s small illustration: the row-echelon form
says columns 1 and 3 are pivot columns and column 2 is not — because it is three times the first.
And a shortcut for combinations of combinations
Section titled “And a shortcut for combinations of combinations”Two more remarks the book makes, both useful:
If are linearly independent and each where , then
So you can test the coefficient vectors instead of the vectors themselves — which is usually much smaller work, and is exactly what the book’s Example 2.15 does.
And a counting bound: linear combinations of vectors are linearly dependent whenever . You cannot have more independent vectors than the dimension you are working in. Five vectors in are dependent, without looking at them.
Worked example by hand
Section titled “Worked example by hand”The book’s Example 2.14. Are these independent in ?
Write them as columns and eliminate:
Every column is a pivot column, so the only solution to is . Independent.
The book’s Example 2.15, which shows the coefficient shortcut. With linearly independent and
we never touch the at all. We test the coefficient vectors:
The fourth column is not a pivot column, and the reduced form reads off the relation directly:
so are linearly dependent. Note we proved something about four vectors in an unknown space by doing arithmetic on four vectors in .
A tiny case, entirely by hand. Are , independent? Look for with
The first row gives ; the second gives , the same condition. So works — non-trivial. Dependent, as shortcut 5 predicted, since .
And the count check: three vectors in must be dependent, because . No arithmetic required.
See it move
Section titled “See it move”The parallelogram two vectors span has area equal to the determinant. When the second vector lines up with the first, that area collapses to zero — and zero area is dependence.
The determinant readout passes through zero twice per revolution — once when the vectors point the same way and once when they point opposite. Both are dependence: with negative is just as dependent as with positive. Shortcut 5 says “for any ”, and the sketch shows why the sign is irrelevant.
Offering vectors one at a time
Section titled “Offering vectors one at a time”The lab below runs the book’s own procedure: each candidate is tested against the span of what has already been accepted, and the residual — the part of it sticking out of that span — is what decides. Zero residual means dependent.
Watch the red residual segment vanish on the last candidate — it was already in the plane the first two spanned.
The third vector is , so its residual is exactly zero and it is rejected. Rank 2 in : the three vectors span a plane, not space.
And the order-dependence the book warns about, made concrete — the same three vectors, offered backwards:
Now the first two are accepted and the third is rejected. A different pair survives, and the rank is still two.
A different pair survives. The rank does not move.
From scratch
Section titled “From scratch”import numpy as np
def pivot_columns(A, tol=1e-10):
"""Row-echelon form, returning the pivot column indices.
This is the book's test: write the vectors as columns, eliminate, and the
pivot columns name the vectors that are independent of those to their LEFT.
"""
M = A.astype(float).copy()
rows, cols = M.shape
piv, r = [], 0
for c in range(cols):
if r >= rows:
break
p = next((i for i in range(r, rows) if abs(M[i, c]) > tol), None)
if p is None:
continue
M[[r, p]] = M[[p, r]]
for i in range(r + 1, rows):
M[i] -= (M[i, c] / M[r, c]) * M[r]
piv.append(c)
r += 1
return piv, M
def independent(vectors):
A = np.array(vectors, dtype=float).T # vectors as COLUMNS
piv, _ = pivot_columns(A)
return len(piv) == A.shape[1], piv
# ---- the book's Example 2.14 -------------------------------------------
x1 = [1.0, 2.0, -3.0, 4.0]
x2 = [1.0, 1.0, 0.0, 2.0]
x3 = [-1.0, -2.0, 1.0, 1.0]
ok, piv = independent([x1, x2, x3])
print("Example 2.14 independent:", ok, " pivot columns:", piv)
# ---- the book's Example 2.15: test the COEFFICIENTS -------------------
A = np.array([[ 1.0, -4.0, 2.0, 17.0],
[-2.0, -2.0, 3.0, -10.0],
[ 1.0, 0.0, -1.0, 11.0],
[-1.0, 4.0, -3.0, 1.0]])
piv, _ = pivot_columns(A)
print("\nExample 2.15 pivot columns:", piv, " -> independent:", len(piv) == 4)
print("rank:", np.linalg.matrix_rank(A))
# The relation the reduced form claims: x4 = -7 x1 - 15 x2 - 18 x3.
claim = -7 * A[:, 0] - 15 * A[:, 1] - 18 * A[:, 2]
print("x4 == -7x1 - 15x2 - 18x3 :", np.allclose(claim, A[:, 3]), " ", claim)
# ---- the five shortcuts, each demonstrated ---------------------------
print("\nshortcut 2, a zero vector makes the set dependent:",
independent([[1.0, 0.0], [0.0, 0.0]])[0])
print("shortcut 3, two identical vectors:",
independent([[1.0, 2.0], [1.0, 2.0]])[0])
print("shortcut 5, one a multiple of another:",
independent([[1.0, 2.0], [2.0, 4.0]])[0])
print("shortcut 5 with a NEGATIVE multiple:",
independent([[1.0, 2.0], [-3.0, -6.0]])[0])
print("counting bound, 3 vectors in R^2:",
independent([[1.0, 0.0], [0.0, 1.0], [3.0, 5.0]])[0])
# ---- order changes the surviving set, never the count ----------------
v = [[1.0, 2.0, -3.0], [2.0, -1.0, 1.0], [4.0, 3.0, -5.0]]
print("\nforwards pivots:", independent(v)[1], " rank:", np.linalg.matrix_rank(np.array(v).T))
print("backwards pivots:", independent(v[::-1])[1], " rank:",
np.linalg.matrix_rank(np.array(v[::-1]).T))
print("third is 2*first + second:", np.allclose(np.array(v[2]), 2 * np.array(v[0]) + np.array(v[1])))
# ---- 2-D: independence is nonzero determinant ------------------------
print()
for pair in ([[2.2, 0.6], [0.6, 2.0]], [[2.2, 0.6], [4.4, 1.2]], [[2.2, 0.6], [-2.2, -0.6]]):
D = np.array(pair, dtype=float).T
print(f" det = {np.linalg.det(D):+.4f} independent: {independent(pair)[0]}")
# ---- rank is a NUMERICAL question, and needs a tolerance -------------
# No perturbation is needed to make the point: a matrix built to be exactly
# rank 3 already has five NONZERO singular values after the arithmetic.
rng = np.random.default_rng(0)
B = rng.standard_normal((6, 3))
C = np.c_[B, B @ rng.standard_normal((3, 2))] # exactly rank 3, by construction
sv = np.linalg.svd(C, compute_uv=False)
print("\nsingular values:", sv)
print("none is exactly zero:", not np.any(sv == 0.0))
m, n = C.shape
default_tol = max(m, n) * np.finfo(float).eps * sv[0]
print(f"default tolerance = max(m,n) * eps * s0 = {default_tol:.3e}")
print("rank, default tolerance :", np.linalg.matrix_rank(C))
print("rank, tol = 1e-16 :", np.linalg.matrix_rank(C, tol=1e-16))
# How large must a perturbation be before the DEFAULT answer changes?
for scale in (1e-16, 1e-15, 1e-14, 1e-13):
g = np.random.default_rng(1)
Cn = C + scale * g.standard_normal(C.shape)
print(f" perturbation {scale:.0e} -> default rank {np.linalg.matrix_rank(Cn)}")Example 2.14 independent: True pivot columns: [0, 1, 2]
Example 2.15 pivot columns: [0, 1, 2] -> independent: False
rank: 3
x4 == -7x1 - 15x2 - 18x3 : True [ 17. -10. 11. 1.]
shortcut 2, a zero vector makes the set dependent: False
shortcut 3, two identical vectors: False
shortcut 5, one a multiple of another: False
shortcut 5 with a NEGATIVE multiple: False
counting bound, 3 vectors in R^2: Falseforwards pivots: [0, 1] rank: 2
backwards pivots: [0, 1] rank: 2
third is 2*first + second: True
det = +4.0400 independent: True
det = +0.0000 independent: False
det = +0.0000 independent: False
singular values: [5.85820278e+00 1.92322653e+00 5.97373480e-01 1.63064230e-16
1.25180478e-16]
none is exactly zero: True
default tolerance = max(m,n) * eps * s0 = 7.805e-15
rank, default tolerance : 3
rank, tol = 1e-16 : 5
perturbation 1e-16 -> default rank 3
perturbation 1e-15 -> default rank 3
perturbation 1e-14 -> default rank 5
perturbation 1e-13 -> default rank 5Three things to read off.
Example 2.15 is confirmed exactly. Three pivot columns out of four, and the relation reproduces the fourth coefficient vector to the digit. The book’s claim, executed.
The shortcut lines all print False — which is the correct answer, because independent returns
whether the set is independent, and every one of those sets is dependent. Shortcut 2 and 3 needed no
arithmetic at all.
Rank needs a tolerance, and no perturbation is required to show it. The last block builds a matrix that is exactly rank 3 by construction — two of its five columns are literal combinations of the other three. Its singular values come back as , , , and then and . Not one of them is zero.
matrix_rank reports 3 because its default threshold is
, comfortably above those last two. Lower the
threshold to and the same matrix has rank 5. Neither answer is wrong; the question
“is this number zero?” has no floating-point answer without a threshold.
The perturbation sweep locates the tipping point: noise at still reports rank 3, and noise at reports 5. That boundary is not a property of the mathematics — it is where the noise crosses . §2.6 makes this the defining practical difficulty of rank.
On real data
Section titled “On real data”Reading the plot
Section titled “Reading the plot”The second figure is the honest picture of rank in practice. A matrix that is mathematically rank 3
has, after any floating-point arithmetic, five nonzero singular values — three large and two
around . matrix_rank reports 3 because it counts only those above a tolerance derived from
machine epsilon and the matrix size.
Push the noise up and the trailing singular values climb through the line, and the reported rank rises with them. There is no noise level at which the answer flips cleanly, because the underlying quantity is continuous and the answer is an integer.
The practical consequence: “are these features independent?” is not a yes/no question on real data. It is a question about how close to dependent they are, which is what the condition number measures and what §9.2’s regularisation exists to handle. Two features that are 99.99% collinear will be reported as independent and will still wreck a linear fit.
Pitfalls
Section titled “Pitfalls”Compare
Section titled “Compare”| you want to know | cheapest route | cost |
|---|---|---|
| is there a zero vector? | look | free |
| is one a multiple of another? | look | free |
| are there more vectors than dimensions? | compare counts | free |
| are two vectors in independent? | determinant nonzero | |
| which of vectors are independent? | pivot columns of the row-echelon form | |
| how many are independent? | np.linalg.matrix_rank | via SVD |
| how close to dependent are they? | np.linalg.cond, or the singular-value spread | via SVD |
The last row is the one that matters most in practice and is the one the definition does not ask about.
-
What exactly does linear independence require?
The trivial combination always sums to zero, for any vectors at all, so its existence proves nothing. The definition is about uniqueness — nothing else reaches zero.
pch.quizShowAnswer
B — That the trivial combination is the ONLY one summing to zero — The trivial combination always sums to zero, for any vectors at all, so its existence proves nothing. The definition is about uniqueness — nothing else reaches zero.
-
In the book's East Africa example, three direction vectors are linearly dependent. Which one is the redundant one?
The book makes exactly this point: given the west and southwest vectors you can construct the northwest one. The redundancy belongs to the set, not to any member of it.
pch.quizShowAnswer
C — None of them individually — any two of the three suffice, which is why independence is a property of the set — The book makes exactly this point: given the west and southwest vectors you can construct the northwest one. The redundancy belongs to the set, not to any member of it.
-
You run the pivot-column test on three vectors and it accepts the first two. What happens if you reorder the vectors?
The book warns that building the matrix imposes an ordering, and pivot columns are independent of what is to their left. Which vectors survive depends on the order; how many survive does not — that count is the rank.
pch.quizShowAnswer
B — A possibly different subset is accepted, but the count is the same — The book warns that building the matrix imposes an ordering, and pivot columns are independent of what is to their left. Which vectors survive depends on the order; how many survive does not — that count is the rank.
-
A matrix is mathematically rank 3. After floating-point arithmetic, how many nonzero singular values does it typically have?
Exact zeros do not survive arithmetic. The reported rank is a count of singular values above a threshold, and lowering the threshold raises the reported rank — so rank on real data is a numerical question, not an algebraic one.
pch.quizShowAnswer
B — All of them — the trailing ones are around 1e-16 rather than zero, which is why matrix_rank needs a tolerance — Exact zeros do not survive arithmetic. The reported rank is a count of singular values above a threshold, and lowering the threshold raises the reported rank — so rank on real data is a numerical question, not an algebraic one.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – The cheapest shortcut
Section titled “Exercise 1 – The cheapest shortcut”Exercise 2 – Independence is nonzero determinant in 2-D
Section titled “Exercise 2 – Independence is nonzero determinant in 2-D”Exercise 3 – The counting bound
Section titled “Exercise 3 – The counting bound”Exercise 4 – The book’s Example 2.15 relation
Section titled “Exercise 4 – The book’s Example 2.15 relation”Exercise 5 – Rank is a numerical question
Section titled “Exercise 5 – Rank is a numerical question”Recall card
Section titled “Recall card”- A linear combination is a weighted sum of vectors, and the zero vector is always the trivial combination of any set, which is why its existence proves nothing.
- Independence means the trivial solution is the only one reaching zero — the whole definition is in the word only.
- “A non-trivial combination reaches zero” and “some vector is redundant” are the same statement, because you can rearrange one into the other.
- An independent set has no redundancy — remove any vector and the span shrinks.
- A zero vector, or two identical vectors, forces dependence — both cost nothing to check.
- One vector being any multiple of another forces dependence, positive or negative, which is why zero area happens twice per revolution.
- The reliable test is the pivot columns of the row-echelon form: all columns pivot means independent, and one non-pivot column means dependent.
- Building the matrix imposes an ordering, so which vectors survive depends on the order offered — but the count never does, and that count is the rank.
- You can test coefficient vectors instead of the vectors themselves when the vectors are combinations of a known independent set.
- More vectors than dimensions is automatic dependence — no arithmetic needed.
- Independence is a property of a set, never of a single vector. “Which one is redundant” usually has several right answers.
- On real data rank needs a tolerance, and the tolerance decides. Near dependence does not show as a rank deficiency; it shows as a large condition number.
Next: the minimal set that builds everything, and how to count it — Basis and Rank.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading