Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

4.2. Linear Independence

Introduction

There’s an idea we used all throughout Chapter 4.1 that we haven’t given a name to.

Definitions

Intuitively, if a set of vectors is linearly dependent, then at least one of the vectors is a linear combination of the others. If we think of vectors as building blocks, if a set of vectors is linearly dependent, then at least one of the building blocks is redundant, because you can create it from the other building blocks.

Equivalently, if a set of vectors is linearly dependent, there’s a non-trivial linear combination of the vectors that equals the zero vector (by non-trivial, I mean that at least one of the coefficients is non-zero).

Why are these two conditions equivalent? Here’s one way to see it. Suppose v1=αv2+βv3\vec v_1 = \alpha \vec v_2 + \beta \vec v_3, meaning that v1\vec v_1 can be written as a linear combination of v2\vec v_2 and v3\vec v_3. Rearranging the equation above gives us

v1αv2βv3=0\vec v_1 - \alpha \vec v_2 - \beta \vec v_3 = \vec 0

which shows us a non-trivial linear combination of v1,v2,v3\vec v_1, \vec v_2, \vec v_3 that gives 0\vec 0. The converse (reverse direction) is true too: if you start with a non-trivial linear combination of v1,v2,,vd\vec v_1, \vec v_2, \ldots, \vec v_d that gives 0\vec 0, then you can rearrange it to get v1=some linear combination of v2,,vd\vec v_1 = \text{some linear combination of } \vec v_2, \ldots, \vec v_d.

Examples

Let’s look at several sets of vectors and comment on their linear independence (or lack thereof).

VectorsLinearly...Why?
[103],[215]\begin{bmatrix} 1 \\ 0 \\ 3 \end{bmatrix}, \begin{bmatrix} 2 \\ 1 \\ 5 \end{bmatrix}IndependentNeither is a multiple of the other.
[103],[215],[5210],[111]\begin{bmatrix} 1 \\ 0 \\ 3 \end{bmatrix}, \begin{bmatrix} 2 \\ 1 \\ 5 \end{bmatrix}, \begin{bmatrix} 5 \\ 2 \\ 10 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}DependentThese vectors live in R3\mathbb{R}^3, which is a universe that only has 3 independent directions, so you only need 3 vectors to span it. Give 4 vectors, we can write at least one of them as a linear combination of the others.
[103],[215],[5213]\begin{bmatrix} 1 \\ 0 \\ 3 \end{bmatrix}, \begin{bmatrix} 2 \\ 1 \\ 5 \end{bmatrix}, \begin{bmatrix} 5 \\ 2 \\ 13 \end{bmatrix}Dependentfirst vector+2(second vector)=third vector\text{first vector} + 2(\text{second vector}) = \text{third vector}
[103],[215],[5210]\begin{bmatrix} 1 \\ 0 \\ 3 \end{bmatrix}, \begin{bmatrix} 2 \\ 1 \\ 5 \end{bmatrix}, \begin{bmatrix} 5 \\ 2 \\ 10 \end{bmatrix}IndependentThe first two were already linearly independent from the first example, and we can’t write the third as a linear combination of the first two.

Note that if a set of vectors is linearly dependent, it doesn’t mean that every vector in the set can be written as a linear combination of the others. It just means that there’s at least one vector that can be written as a linear combination of the others. A good go-to example for this is the one below – v1\color{orange} \vec v_1 and v2\color{#3d81f6} \vec v_2 are scalar multiples of each other, making the entire set of three vectors linearly dependent, but v3\color{#d81b60} \vec v_3 is not a linear combination of v1\color{orange} \vec v_1 and v2\color{#3d81f6} \vec v_2.

Image produced in Jupyter

Unique Linear Combinations

Fact: If a set of vectors v1,v2,,vdRn{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d} \in \mathbb{R}^n is linearly independent, then any vector bRn\vec b \in \mathbb{R}^n in the span of the vectors can be written as a unique linear combination of the vectors.

We’ve built intuition for this above; now let’s give a formal proof. But first, note that the statement assumes that bspan({v1,v2,,vd})\vec b \in \text{span}(\{{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d}\}) to begin with: it is not saying that if v1,v2,,vdRn{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d} \in \mathbb{R}^n are linearly independent, then any bRn\vec b \in \mathbb{R}^n can be written as a linear combination of the vectors. That’s not true. The vectors v1=[100]\vec v_1 = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} and v2=[010]\vec v_2 = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} are linearly independent, but b=[001]\vec b = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} is not a linear combination of the first two. Hopefully, the fact above is a little more clear now. (Re-read it again before proceeding to the next paragraph.)

Let’s imagine an alternate universe where bspan({v1,v2,,vd})\vec b \in \text{span}(\{{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d}\}) can be written as two different linear combinations of the vectors. (We’re doing a proof by contradiction, if you’re familiar with the idea.) In other words, suppose

a1v1+a2v2++advd=ba_1 {\color{#3d81f6}\vec v_1} + a_2 {\color{#3d81f6}\vec v_2} + \ldots + a_d {\color{#3d81f6}\vec v_d} = \vec b

and

c1v1+c2v2++cdvd=bc_1 {\color{#3d81f6}\vec v_1} + c_2 {\color{#3d81f6}\vec v_2} + \ldots + c_d {\color{#3d81f6}\vec v_d} = \vec b

and not all of the aia_i and cic_i are equal, meaning there’s at least one ii such that aicia_i \neq c_i.

What happens if we subtract the two equations?

(a1c1)v1+(a2c2)v2++(adcd)vd=0(a_1 - c_1) {\color{#3d81f6}\vec v_1} + (a_2 - c_2) {\color{#3d81f6}\vec v_2} + \ldots + (a_d - c_d) {\color{#3d81f6}\vec v_d} = \vec 0

Since v1,v2,,vd{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d} are linearly independent, the only way this equation can hold is if all of the coefficients on the vi\color{#3d81f6}\vec v_i are zero. In other words, we’d need

a1c1=0a2c2=0adcd=0a_1 - c_1 = 0 \\ a_2 - c_2 = 0 \\ \ldots \\ a_d - c_d = 0

But if that’s the case, then ai=cia_i = c_i for all ii, which contradicts our assumption that not all of the aia_i and cic_i are equal.

So, this means that it can’t be the case that b\vec b can be written as two different linear combinations of the vectors. In other words, if bspan({v1,v2,,vd})\vec b \in \text{span}(\{{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d}\}) and v1,v2,,vd{\color{#3d81f6}\vec v_1}, {\color{#3d81f6}\vec v_2}, \ldots, {\color{#3d81f6}\vec v_d} are linearly independent, then b\vec b can be written as a unique linear combination of the vectors.

Linearly independent vectors are desirable, since there’s only one way to use them as building blocks to create any other vector in their span.

Activity 1


Algorithm for Finding Linearly Independent Subsets with the Same Span

Given a set of vectors v1,v2,,vdRn\vec v_1, \vec v_2, \ldots, \vec v_d \in \mathbb{R}^n, we’d like to find a subset of the vectors that is linearly independent and has the same span as the original set of vectors. In Chapter 4.3, we’ll call this subset a basis for the span of the original set of vectors.

In other words, we’d like to “drop” the vectors that are linearly dependent on the others. For example, if we have 3 vectors in R3\mathbb{R}^3 and they span a plane, we can drop one of them and still span the same plane (not just any plane), because a plane is a 2-dimensional space, and you only need 2 vectors to span a plane.

In the example below, we can remove any one of the three vectors (which all point in different directions), and the span of the remaining two is still the exact same plane!

Loading...

Dropping any “unnecessary” vectors will give us the desirable property that any vector in the span of the original set of vectors can be written as a unique linear combination of the vectors in the subset. (Remember that this has a connection to finding optimal model parameters in linear regression – this is not just an arbitrary exercise in theory.)

One way to produce a linear independent subset is to execute the following algorithm:

given v_1, v_2, ..., v_d
initialize linearly independent set S = {v_1}
for i = 2 to d:
    if v_i is not a linear combination of S:
        add v_i to S

The vectors we add to S are a basis for the span of the original set of vectors. The number of vectors we’re left with is the dimension of the span of the original set of vectors. Again, these are ideas we formalize in Chapter 4.3.

Let’s evaluate this algorithm on the following set of vectors:

v1=[340],v2=[011],v3=[322],v4=[653],v5=[251]\vec v_1 = \begin{bmatrix} 3 \\ 4 \\ 0 \end{bmatrix}, \quad \vec v_2 = \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix}, \quad \vec v_3 = \begin{bmatrix} -3 \\ -2 \\ 2 \end{bmatrix}, \quad \vec v_4 = \begin{bmatrix} 6 \\ 5 \\ -3 \end{bmatrix}, \quad \vec v_5 = \begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix}

First, we start with S={v1}\color{orange} S = \{\vec v_1\}.

  • Iteration 1 (i=2i = 2): Is v2\vec v_2 a linear combination of the vectors in SS?
    No, since v2\vec v_2 is not a multiple of v1\vec v_1. The first components (3 in v1\vec v_1, 0 in v2\vec v_2) imply that if v2\vec v_2 were a multiple of v1\vec v_1 it’d need to be 0v10 \vec v_1, but the other components of v2\vec v_2 are non-zero.

    Outcome: Add v2\vec v_2 to SS. Now, S={v1,v2}\color{orange} S = \{\vec v_1, \vec v_2\}.

  • Iteration 2 (i=3i = 3): Is v3\vec v_3 a linear combination of the vectors in SS?
    To determine the answer, we need to try and find scalars a1a_1 and a2a_2 such that a1v1+a2v2=v3a_1 \vec v_1 + a_2 \vec v_2 = \vec v_3.

    a1[340]+a2[011]=[322]    {3a1+0a2=34a1+1a2=20a1+1a2=2a_1 \begin{bmatrix} 3 \\ 4 \\ 0 \end{bmatrix} + a_2 \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} -3 \\ -2 \\ 2 \end{bmatrix} \implies \begin{cases} 3a_1 + 0a_2 = -3 \\ 4a_1 + 1a_2 = -2 \\ 0a_1 + 1a_2 = 2 \end{cases}

    The first equation implies a1=1a_1 = -1 and the third equation implies a2=2a_2 = 2. Plugging both into the second equation gives 4(1)+1(2)=24(-1) + 1(2) = -2, which is consistent. This means that v3=v1+2v2\vec v_3 = - \vec v_1 + 2 \vec v_2, so v3\vec v_3 is a linear combination of v1\vec v_1 and v2\vec v_2, and we should not add it to SS.

    Outcome: Leave SS unchanged. Now, S={v1,v2}\color{orange} S = \{\vec v_1, \vec v_2\}.

  • Iteration 4 (i=4i = 4): Is v4\vec v_4 a linear combination of the vectors in SS?
    To determine the answer, we need to try and find scalars a1a_1 and a2a_2 such that a1v1+a2v2=v4a_1 \vec v_1 + a_2 \vec v_2 = \vec v_4.

    a1[340]+a2[011]=[653]    {3a1+0a2=64a1+1a2=50a1+1a2=3a_1 \begin{bmatrix} 3 \\ 4 \\ 0 \end{bmatrix} + a_2 \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 6 \\ 5 \\ -3 \end{bmatrix} \implies \begin{cases} 3a_1 + 0a_2 = 6 \\ 4a_1 + 1a_2 = 5 \\ 0a_1 + 1a_2 = -3 \end{cases}

    Similarly, we see that a1=2a_1 = 2 (from the first equation) and a2=3a_2 = -3 (from the third equation) are consistent with the second equation. This means that v4=2v13v2\vec v_4 = 2 \vec v_1 - 3 \vec v_2, so v4\vec v_4 is a linear combination of v1\vec v_1 and v2\vec v_2, and we should not add it to SS.

    Outcome: Leave SS unchanged. Now, S={v1,v2}\color{orange} S = \{\vec v_1, \vec v_2\}.

  • Iteration 5 (i=5i = 5): Is v5\vec v_5 a linear combination of the vectors in SS?
    To determine the answer, we need to try and find scalars a1a_1 and a2a_2 such that a1v1+a2v2=v5a_1 \vec v_1 + a_2 \vec v_2 = \vec v_5.

    a1[340]+a2[011]=[251]    {3a1+0a2=24a1+1a2=50a1+1a2=1a_1 \begin{bmatrix} 3 \\ 4 \\ 0 \end{bmatrix} + a_2 \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix} \implies \begin{cases} 3a_1 + 0a_2 = 2 \\ 4a_1 + 1a_2 = 5 \\ 0a_1 + 1a_2 = 1 \end{cases}

    The first equation implies a1=23a_1 = \frac{2}{3} and the third equation implies a2=1a_2 = 1. Plugging both into the second equation gives 4(23)+1(1)=11354(\frac{2}{3}) + 1(1) = \frac{11}{3} \neq 5, which means the system is inconsistent. So, v5\vec v_5 is not a linear combination of v1\vec v_1 and v2\vec v_2, and we should add it to SS.

    Outcome: Add v5\vec v_5 to SS. Now, S={v1,v2,v5}\color{orange} S = \{\vec v_1, \vec v_2, \vec v_5\}.

v1,v2,v5\vec v_1, \vec v_2, \vec v_5 are linearly independent vectors that have the same span as the original set of vectors. And since these are 3 linearly independent vectors in R3\mathbb{R}^3, their span is all of R3\mathbb{R}^3, since R3\mathbb{R}^3 is 3-dimensional and only has 3 independent directions to begin with! If there were more vectors in our list, they would surely be linearly dependent on S={v1,v2,v5}S = \{ \vec v_1, \vec v_2, \vec v_5 \}, and so we wouldn’t need to consider them.

Note that the subset that this algorithm produces is not unique, meaning that there exist other subsets of 3 of {v1,v2,v3,v4,v5}\{\vec v_1, \vec v_2, \vec v_3, \vec v_4, \vec v_5\} that are also linearly independent and have the same span as all of {v1,v2,v3,v4,v5}\{\vec v_1, \vec v_2, \vec v_3, \vec v_4, \vec v_5\} do (which is also the span of {v1,v2,v5}\{\vec v_1, \vec v_2, \vec v_5\}) If you started with v5\vec v_5, then considered v4\vec v_4, then considered v3\vec v_3, and so on, you’d end up with a subset that includes v4\vec v_4, for instance.

What is fixed, though, is how many linearly independent vectors you need to span the entire subspace that these five vectors span, and the answer to that is 3.

Homework 4 and Lab 5 will have you practice this algorithm several times, though – as mentioned above – we’ll use the power of Python to handle some of this for us, soon.

Activity 2

Here’s one final abstract activity to think about. Answers aren’t provided since there’s a very similar question on Homework 5. But come ask us questions about it in office hours!

Activity 3