Skip to content

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 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.

diagram Diagram mermaid

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.

Given a vector space VV and vectors x1,,xkV\mathbf{x}_1,\dots,\mathbf{x}_k \in V, every vector of the form

v=λ1x1++λkxk=i=1kλixiV\mathbf{v} = \lambda_1\mathbf{x}_1 + \cdots + \lambda_k\mathbf{x}_k = \sum_{i=1}^{k}\lambda_i\mathbf{x}_i \in V

with λ1,,λkR\lambda_1,\dots,\lambda_k \in \mathbb{R} is a linear combination of them.

The zero vector can always be written as one, because 0=i0xi\mathbf{0} = \sum_i 0\,\mathbf{x}_i 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.

x1,,xk are linearly dependent    λ1,,λk with at least one λi0 such that i=1kλixi=0\mathbf{x}_1,\dots,\mathbf{x}_k \text{ are \textbf{linearly dependent}} \iff \exists\,\lambda_1,\dots,\lambda_k \text{ with at least one } \lambda_i \neq 0 \text{ such that } \sum_{i=1}^{k}\lambda_i\mathbf{x}_i = \mathbf{0} x1,,xk are linearly independent    i=1kλixi=0 forces λ1==λk=0\mathbf{x}_1,\dots,\mathbf{x}_k \text{ are \textbf{linearly independent}} \iff \sum_{i=1}^{k}\lambda_i\mathbf{x}_i = \mathbf{0} \text{ forces } \lambda_1 = \cdots = \lambda_k = 0

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.

Straight from the book’s remarks, and worth internalising because they save real work:

  1. There is no third option. kk vectors are either linearly dependent or linearly independent.
  2. If any xi=0\mathbf{x}_i = \mathbf{0}, the set is dependent. Take λi=1\lambda_i = 1 and everything else zero — a non-trivial route to zero, immediately.
  3. If two vectors are identical, the set is dependent. Take +1+1 and 1-1 on the pair.
  4. A set of nonzero vectors with k2k \ge 2 is dependent if and only if at least one of them is a linear combination of the others.
  5. In particular, if xi=λxj\mathbf{x}_i = \lambda\mathbf{x}_j for any λ\lambda, 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.

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

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

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 b1,,bk\mathbf{b}_1,\dots,\mathbf{b}_k are linearly independent and each xj=Bλj\mathbf{x}_j = \mathbf{B}\boldsymbol\lambda_j where B=[b1,,bk]\mathbf{B} = [\mathbf{b}_1,\dots,\mathbf{b}_k], then

{x1,,xm} independent    {λ1,,λm} independent\{\mathbf{x}_1,\dots,\mathbf{x}_m\} \text{ independent} \iff \{\boldsymbol\lambda_1,\dots,\boldsymbol\lambda_m\} \text{ independent}

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: mm linear combinations of kk vectors are linearly dependent whenever m>km > k. You cannot have more independent vectors than the dimension you are working in. Five vectors in R3\mathbb{R}^3 are dependent, without looking at them.

The book’s Example 2.14. Are these independent in R4\mathbb{R}^4?

x1=[1234],x2=[1102],x3=[1211]\mathbf{x}_1 = \begin{bmatrix}1\\2\\-3\\4\end{bmatrix},\quad \mathbf{x}_2 = \begin{bmatrix}1\\1\\0\\2\end{bmatrix},\quad \mathbf{x}_3 = \begin{bmatrix}-1\\-2\\1\\1\end{bmatrix}

Write them as columns and eliminate:

[111212301421]        [111010001000]\begin{bmatrix}1 & 1 & -1\\ 2 & 1 & -2\\ -3 & 0 & 1\\ 4 & 2 & 1\end{bmatrix} \;\rightsquigarrow\;\cdots\;\rightsquigarrow\; \begin{bmatrix}1 & 1 & -1\\ 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\end{bmatrix}

Every column is a pivot column, so the only solution to λ1x1+λ2x2+λ3x3=0\lambda_1\mathbf{x}_1 + \lambda_2\mathbf{x}_2 + \lambda_3\mathbf{x}_3 = \mathbf{0} is λ1=λ2=λ3=0\lambda_1 = \lambda_2 = \lambda_3 = 0. Independent.

The book’s Example 2.15, which shows the coefficient shortcut. With b1,,b4\mathbf{b}_1,\dots,\mathbf{b}_4 linearly independent and

x1=b12b2+b3b4x2=4b12b2+4b4x3=2b1+3b2b33b4x4=17b110b2+11b3+b4\begin{aligned} \mathbf{x}_1 &= \mathbf{b}_1 - 2\mathbf{b}_2 + \mathbf{b}_3 - \mathbf{b}_4\\ \mathbf{x}_2 &= -4\mathbf{b}_1 - 2\mathbf{b}_2 + 4\mathbf{b}_4\\ \mathbf{x}_3 &= 2\mathbf{b}_1 + 3\mathbf{b}_2 - \mathbf{b}_3 - 3\mathbf{b}_4\\ \mathbf{x}_4 &= 17\mathbf{b}_1 - 10\mathbf{b}_2 + 11\mathbf{b}_3 + \mathbf{b}_4 \end{aligned}

we never touch the bi\mathbf{b}_i at all. We test the coefficient vectors:

A=[1421722310101111431]    [100701015001180000]\mathbf{A} = \begin{bmatrix}1 & -4 & 2 & 17\\ -2 & -2 & 3 & -10\\ 1 & 0 & -1 & 11\\ -1 & 4 & -3 & 1\end{bmatrix} \;\rightsquigarrow\; \begin{bmatrix}1 & 0 & 0 & -7\\ 0 & 1 & 0 & -15\\ 0 & 0 & 1 & -18\\ 0 & 0 & 0 & 0\end{bmatrix}

The fourth column is not a pivot column, and the reduced form reads off the relation directly:

x4=7x115x218x3\mathbf{x}_4 = -7\mathbf{x}_1 - 15\mathbf{x}_2 - 18\mathbf{x}_3

so x1,,x4\mathbf{x}_1,\dots,\mathbf{x}_4 are linearly dependent. Note we proved something about four vectors in an unknown space by doing arithmetic on four vectors in R4\mathbb{R}^4.

A tiny case, entirely by hand. Are (1,2)(1,2), (2,4)(2,4) independent? Look for λ1,λ2\lambda_1, \lambda_2 with

λ1[12]+λ2[24]=[00]\lambda_1\begin{bmatrix}1\\2\end{bmatrix} + \lambda_2\begin{bmatrix}2\\4\end{bmatrix} = \begin{bmatrix}0\\0\end{bmatrix}

The first row gives λ1=2λ2\lambda_1 = -2\lambda_2; the second gives 2λ1=4λ22\lambda_1 = -4\lambda_2, the same condition. So λ2=1,λ1=2\lambda_2 = 1, \lambda_1 = -2 works — non-trivial. Dependent, as shortcut 5 predicted, since (2,4)=2(1,2)(2,4) = 2(1,2).

And the count check: three vectors in R2\mathbb{R}^2 must be dependent, because m=3>k=2m = 3 > k = 2. No arithmetic required.

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.

sketch Independence = nonzero area p5.js
A fixed amber vector and a rotating violet vector. The parallelogram they span has an area equal to the determinant. When the violet vector lines up with the amber one, the area collapses to zero and the vectors become linearly dependent.

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: x2=λx1\mathbf{x}_2 = \lambda\mathbf{x}_1 with λ\lambda negative is just as dependent as with λ\lambda positive. Shortcut 5 says “for any λ\lambda”, and the sketch shows why the sign is irrelevant.

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.

vectorThe third vector adds nothingspan in R^3
x1x2x3
rank 0of 3basis empty
accepted0rank so far0spansjust the origin
setup3 candidate vectors in R^3, and an empty basis. Each one will be offered in turn, and the only question asked of it is whether it reaches somewhere the ones already accepted cannot.
1/9

Watch the red residual segment vanish on the last candidate — it was already in the plane the first two spanned.

The third vector is 2x1+x22\mathbf{x}_1 + \mathbf{x}_2, so its residual is exactly zero and it is rejected. Rank 2 in R3\mathbb{R}^3: the three vectors span a plane, not space.

And the order-dependence the book warns about, made concrete — the same three vectors, offered backwards:

vectorSame vectors, different order, different basisspan in R^3
x1x2x3
rank 0of 3basis empty
accepted0rank so far0spansjust the origin
setup3 candidate vectors in R^3, and an empty basis. Each one will be offered in turn, and the only question asked of it is whether it reaches somewhere the ones already accepted cannot.
1/9

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.

independence.py
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)}")
text
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: False
text
forwards  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 5

Three things to read off.

Example 2.15 is confirmed exactly. Three pivot columns out of four, and the relation x4=7x115x218x3\mathbf{x}_4 = -7\mathbf{x}_1 - 15\mathbf{x}_2 - 18\mathbf{x}_3 reproduces the fourth coefficient vector (17,10,11,1)(17, -10, 11, 1) 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 5.865.86, 1.921.92, 0.5970.597, and then 1.6×10161.6\times10^{-16} and 1.3×10161.3\times10^{-16}. Not one of them is zero.

matrix_rank reports 3 because its default threshold is max(m,n)εσ1=7.8×1015\max(m,n)\cdot\varepsilon\cdot\sigma_1 = 7.8\times10^{-15}, comfortably above those last two. Lower the threshold to 101610^{-16} 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 101510^{-15} still reports rank 3, and noise at 101410^{-14} reports 5. That boundary is not a property of the mathematics — it is where the noise crosses 7.8×10157.8\times10^{-15}. §2.6 makes this the defining practical difficulty of rank.

figure The determinant passes through zero twice per revolution matplotlib
Plot of the absolute determinant of two two-dimensional vectors as the second rotates through a full turn, showing two zeros where the vectors become collinear, one at zero degrees and one at 180 degrees. Plot of the absolute determinant of two two-dimensional vectors as the second rotates through a full turn, showing two zeros where the vectors become collinear, one at zero degrees and one at 180 degrees.
Both crossings are dependence. A negative multiple is just as redundant as a positive one, which is why the shortcut says 'for any lambda'.
figure Where the reported rank comes from matplotlib
Log plot of the singular values of a rank-three matrix that has been perturbed by noise of increasing size, with the default numerical rank tolerance drawn as a horizontal line. As the noise grows the trailing singular values rise above the line and the reported rank increases. Log plot of the singular values of a rank-three matrix that has been perturbed by noise of increasing size, with the default numerical rank tolerance drawn as a horizontal line. As the noise grows the trailing singular values rise above the line and the reported rank increases.
Rank is the count of singular values above a tolerance. The trailing ones are never exactly zero after any real computation, so the threshold is doing the deciding.

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 101610^{-16}. 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.

you want to knowcheapest routecost
is there a zero vector?lookfree
is one a multiple of another?lookfree
are there more vectors than dimensions?compare countsfree
are two vectors in R2\mathbb{R}^2 independent?determinant nonzeroO(1)O(1)
which of nn vectors are independent?pivot columns of the row-echelon formO(mn2)O(mn^2)
how many are independent?np.linalg.matrix_rankO(mn2)O(mn^2) via SVD
how close to dependent are they?np.linalg.cond, or the singular-value spreadO(mn2)O(mn^2) via SVD

The last row is the one that matters most in practice and is the one the definition does not ask about.

pch.quizTag Check yourself
  1. What exactly does linear independence require?

    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.

  2. In the book's East Africa example, three direction vectors are linearly dependent. Which one is the redundant one?

    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.

  3. You run the pivot-column test on three vectors and it accepts the first two. What happens if you reorder the vectors?

    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.

  4. A matrix is mathematically rank 3. After floating-point arithmetic, how many nonzero singular values does it typically have?

    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.

Exercise 2 – Independence is nonzero determinant in 2-D

Section titled “Exercise 2 – Independence is nonzero determinant in 2-D”

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”
  • 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.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading