Imagine you have a box with only red, green, and
blue colored pencils. How many colors can you draw? The answer
is: infinitely many. By mixing different proportions of
RGB, from deep purple to light yellow, any color can be created. This is
the power of linear combinations— building infinite
possibilities from finite "ingredients." This chapter will reveal this
magical mathematical mechanism and how it supports the entire edifice of
linear algebra.
Starting
from Mixing Colors: What Is a Linear Combination?
In Chapter 1, we understood that vectors are quantities with
direction and magnitude. Now, let's think about a more interesting
question: If you're given several vectors, which positions in
space can you "reach" using them?
Linear Combinations in Daily
Life
Before answering this abstract question, let's look at some familiar
scenarios:
Scenario 1: Mixing Cocktails
Suppose you're a bartender with two base liquors: - Liquor A: 40%
alcohol, 10g sugar per liter - Liquor B: 20% alcohol, 30g sugar per
liter
You want to make a cocktail with 30% alcohol and 20g sugar. How do
you do it?
If you use liters of A andliters of B, then: - Alcohol: - Sugar:Solving this system
gives— half a liter
of A plus half a liter of B.
Here,is a linear
combination of vectorsand, with
coefficientsand.
Scenario 2: Walking Navigation
You're standing at an intersection, and your friend tells you: "Walk
300 meters east, then 400 meters north."
In vector terms: -: Unit vector pointing east -: Unit vector pointing
north
Your displacement is:This is also a linear combination! The
coefficients are 300 and 400.
Scenario 3: RGB Colors
Every pixel on a computer monitor is a mixture of red (R), green (G),
and blue (B) light:Where. For example: -= Pure red -= Yellow (red + green) -= Purple
Every color is a linear combination of the three "basis vectors" red,
green, and blue.
Mathematical
Definition of Linear Combinations
Now we can give a rigorous definition:
Definition (Linear Combination): Given vectorsand scalars, their linear combination is:
Hereare
called coefficients or weights.
Key Understanding: - Linear combinations only
involve two operations: scalar multiplication and
vector addition - The coefficientscan be any real numbers (positive,
negative, or zero) - "Linear" means no squares, cubes, products,
or other nonlinear terms
Why Is It Called "Linear"?
Consider a vectorin the 2D plane.
What do all its scalar multiplesform?
Whengoes fromto: -: The origin -: -: -:All these points together form a line passing
through the origin!
This is the geometric origin of "linear": scalar multiples of a
single vector form a line.
Linear Combinations in 2D
Space
Now consider two non-parallel vectorsand.
Where can their linear combinationreach?
Whenrange over all real
numbers,covers the
entire 2D plane!
Let's verify a few points: -
- -
Conclusion: Linear combinations of two non-parallel
vectors can cover the entire 2D plane.
But what if two vectors are parallel? For example,and?
Note that,
so their linear combination:No matter howare
chosen, the result is always a scalar multiple of— they can only cover a line!
This leads to a key question: Given a set of vectors, what are all
the positions they can "reach"?
Span: All Places Vectors Can
Reach
Definition of Span
Definition (Span): The span of a
vector setis the set of all possible linear combinations:
Intuition: - Span is all the positions you can
"reach" using these vectors - Imagine you have a "vector remote control"
that can adjust each vector's coefficient - All the positions you can
reach by adjusting the coefficients constitute the span
Different Cases of Span
Let's systematically look at the spans of different vector
combinations:
Case 1: A Single Non-Zero Vector: A line through the
origin (in the direction of)
For example:This is the line through the origin
with slope 2.
Case 2: Two Collinear Vectors (Parallel)where: Still just a line
Even though there are two vectors, the second doesn't provide a new
"direction," so the span doesn't grow.
Case 3: Two Non-Collinear 2D Vectorswhereare not parallel: The entireplane
For example:Case 4: Two 3D Vectorsin: A plane through the
origin
For example:is the-plane (all
points where)
Case 5: Three Coplanar 3D Vectors
Still just a plane. The third vector, if it can be expressed using
the first two, doesn't increase the span.
Case 6: Three Non-Coplanar 3D Vectors: The entire 3D space
Important
Observations: The Shape of Span
From the examples above, we can see: - Span always passes
through the origin (because when all coefficients are 0, we get
the zero vector) - Span is closed (the linear
combination of two points in the span is still in the span) - The "size"
of the span depends on the "degree of independence" between vectors
These properties make span a special geometric object — a
subspace (detailed later).
Practical Significance of
Span
Example 1: Can You Mix the Target from Available
Materials?
A chemistry lab has three solutions: - Solution A: 5% acid, 10% salt
- Solution B: 10% acid, 5% salt - Solution C: 2% acid, 2% salt
Question: Can you mix a solution with 15% acid and 12% salt?
View each solution as a vector:The question
becomes: Isin?
Note thatare not
parallel, so.
Thereforemust be in the
span — it can be mixed!
Example 2: Coordinate Systems in Graphics
In 3D games, each object has its own local coordinate
system defined by three vectors.
Any point on the object's surface can be expressed as a linear
combination of these three vectors.
If, it means this local coordinate system is
"complete" and can describe any position in 3D space.
Linear
Independence: A Vector Set Without Redundancy
From the previous discussion, we noticed a phenomenon: sometimes
adding a vector doesn't increase the span — for example, when the new
vector can be "expressed" by existing vectors.
This leads to one of the most important concepts in linear algebra:
linear independence.
Starting from Redundancy
Consider three vectors: - -
-What is the span
of these three vectors?
Note that, so:Sois redundant—
removing it doesn't affect the span.
Definition of Linear
Independence
Definition (Linear Independence): A vector setis
linearly independent if and only if: > holds only
when.
Equivalently: If there exist non-zero coefficients
that make the linear combination equal to the zero vector, the vectors
are linearly dependent.
Intuitive Understanding: - Linearly independent = no
vector is "redundant" - Linearly independent = each vector provides a
new "direction" - Linearly independent = you can't "construct" any one
vector from the others
Geometric Understanding
2D case: - Two vectors are linearly independentThey are not parallel -
Two vectors are linearly dependentThey are collinear
3D case: - Three vectors are linearly
independentThey are
not coplanar - Three vectors are linearly dependentThey are coplanar
Methods for
Determining Linear Independence
Method 1: Definition Method
Setand solve this homogeneous system. - If only the zero
solutionexists:
Linearly independent - If non-zero solutions exist: Linearly
dependent
Example: Determine ifare linearly independent.
SetWe get the system:Solving:(verify:)
A non-zero solution exists, so these three vectors are
linearly dependent!
Form a matrix with the-dimensional vectors as columns (or
rows) and compute the determinant: - Determinant: Linearly independent -
Determinant: Linearly
dependent
For the example above:So they are
linearly dependent. (Determinant computation will be detailed in Chapter
4)
Important
Properties of Linear Independence
Property 1: Ifis
linearly independent, then any of its subsets is also linearly
independent.
Conversely: If some subset is linearly dependent,
then the whole set is linearly dependent.
Property 2: In, more thanvectors must be linearly dependent.
Intuition:-dimensional space
has at most"independent
directions."
Property 3: Ifis
linearly independent and, then the
representation ofis
unique.
This property is extremely important — it guarantees the
uniqueness of coordinates.
Equivalent
Conditions for Linear Dependence
The following conditions are equivalent (choose any one to
judge):
1.is linearly dependent 2. There exist non-zerosuch that$c_i_i = n$-dimensional
vectors) The determinant of the formed matrix is 0
Basis: The Smallest Complete
Set
Now we can define one of the most central concepts in linear algebra:
the basis.
Definition of Basis
Definition (Basis): A basis of a
vector spaceis a vector setsatisfying: 1. Linearly
independent: No redundancy 2. Spans:Intuition: - A basis is the "smallest
complete toolbox" - "Complete" means it can represent any vector in the
space - "Smallest" means no extra vectors
Standard Basis
The standard basis ofconsists ofvectors:Eachhas 1 in the-th position and 0 elsewhere.
For example, the standard basis of:Characteristics of the standard
basis: - Mutually perpendicular (orthogonal) - All have length 1 (unit
vectors) - Coordinatesare
the coefficients in the standard basis:
Non-Standard Bases
Bases are not unique! The following vector sets are all bases
for:
Example 1:Verification: - Linearly independent? Set, get, so. - Spans? Two non-parallel 2D vectors
span all of.
Example 2:This is a "stretched version" of the standard basis —
stretched by 2 along the-axis and
by 3 along the-axis.
Example 3:This is a "slanted" basis but still valid.
Coordinates: Same
Vector in Different Bases
What are the coordinates of vectorin different bases?
In the standard basis:, coordinates areIn basis: SetGet, solving givesCoordinates areKey Understanding: - The same vector (the
same arrow in space) has different coordinates in
different bases - Coordinates only have meaning after specifying
a basis - Thewe
usually write implicitly uses the standard basis
Existence and Uniqueness of
Bases
Existence Theorem: Every non-zero vector space has a
basis.
Uniqueness: Bases are not unique, but the
number of vectors in any basis is unique (this is the
dimension).
How to find a basis?
Method: Start by selecting vectors from the space, adding them one by
one, checking if they're still linearly independent each time. When you
can't add any more (any new vector would cause linear dependence),
you've found a basis.
Dimension: The
"Degrees of Freedom" of a Space
Definition of Dimension
Definition (Dimension): The
dimension of a vector spaceis the number of vectors in any basis
of. Written as.
Why is this definition valid? An important theorem
guarantees: all bases of the same vector space have the same number of
vectors.
Intuition of Dimension
Dimension can be understood as: - How many independent
parameters are needed to describe a point in the space -
How many independent directions of movement exist in
the space - The maximum number of linearly independent
vectors the space can hold
Dimensions of Common Spaces
Space
Dimension
Explanation
A point (zero vector space)
0
No freedom of movement
A line
1
Can only move back and forth
A plane
2
Back-forth + left-right
3D space
3
Back-forth + left-right + up-down
independent directions
Relationship
Between Dimension and Linear Independence
Key Theorem: In an-dimensional space: - More thanvectors must be linearly dependent -
Exactlylinearly independent
vectors form a basis - Fewer thanvectors cannot span the entire space
Example: In: - 4 vectors must be
linearly dependent (may spanbut with redundancy) - 3
linearly independent vectors form a basis - 2 vectors can span at most a
plane
Subspaces: Spaces Within
Spaces
Definition of Subspace
Definition (Subspace): A subspace
of a vector spaceis a subsetofsatisfying: 1. Contains the zero
vector:> 2. Closed
under addition: If, then> 3. Closed under scalar multiplication: If, thenfor any scalarIntuition: A subspace
is a "space within a space"— it is itself a vector space but "lives"
inside a larger space.
Examples of Subspaces
Subspaces of:
Zero space: Contains only the zero
vector, dimension 0
A line through the origin: e.g.,,
dimension 1
A plane through the origin: e.g.,
(the-plane), dimension 2
itself: Dimension
3
Note: Lines or planes not passing through the origin
are not subspaces!
For example, (the plane) is not a subspace because: - It doesn't contain the zero
vector -, where, not
closed
Span as Subspace
Important Fact: The span of any set of vectors is a
subspace.satisfies: 1. 2. Sum of two linear
combinations is still a linear combination 3. Linear combination times a
scalar is still a linear combinationThis gives us a simple way to
construct subspaces: take some vectors and find their span.
Intersection and Sum of
Subspaces
Intersection: The intersection of two subspaces is
still a subspace.
Example: The intersection of the-plane and-plane inis the-axis.
Sum:Example: The sum of the-axis and-axis is the-plane.
Dimension Formula:
Practical Case Study: RGB
Color Space
Let's dive deep into the RGB color space as a practical
application.
Mathematical Structure
of the RGB Model
In the RGB color model: - Each color is represented as a 3D
vector -(8-bit color depth)
or(normalized)
The three basic color vectors:Any color is a linear combination of these:
Linearity of Color Mixing
Additive mixing (mixing of light, as in
monitors):Example: Redplus greenequals yellowBrightness
adjustment:darkens,brightens.
Color Space as a Vector
Space
Strictly speaking, if we restrict, the RGB color space is not a
vector space (not closed under addition and scalar multiplication).
But if we allow(a theoretical extension), we get thevector space.
Practical application: In image processing,
intermediate calculations often use floating-point numbers (unrestricted
range), and the values are clipped toonly at the end.
Subspaces of Color Space
Grayscale images: Colors whereThis is a 1-dimensional
subspace of (a line
through the origin).
Colors seen by certain types of color-blind
people:
Some types of color blindness can only distinguish blue and yellow
(red+green), which is equivalent to projectingonto a 2-dimensional
subspace.
Color Space Transformations
Different color spaces (RGB, HSV, LAB, etc.) correspond to different
basis choices.
Converting from RGB to another color space is a change of
basis— this involves matrix multiplication (topic of the next
chapter).
defis_linearly_independent(vectors): """ Check if a set of vectors is linearly independent vectors: list of vectors, each vector is a numpy array """ iflen(vectors) == 0: returnTrue # Stack vectors as columns of a matrix matrix = np.column_stack(vectors) # Compute rank rank = np.linalg.matrix_rank(matrix) # If rank equals number of vectors, linearly independent return rank == len(vectors)
defis_in_span(target, basis_vectors): """ Check if target vector is in the span of basis_vectors """ matrix = np.column_stack(basis_vectors) # Try to solve the linear system matrix @ coeffs = target try: coeffs, residuals, rank, s = np.linalg.lstsq(matrix, target, rcond=None) # Check if it's actually a solution (small residual) reconstructed = matrix @ coeffs return np.allclose(reconstructed, target) except: returnFalse
Misconception 1: "Vectorsandcan span the 2D plane"
Wrong!, they are
collinear and can only span a line.
Misconception 2: "Three vectors always span a larger
space than two vectors"
Not necessarily! If the third vector is in the span of the first two,
the space doesn't grow.
Misconception 3: "Linearly independent vectors must
be orthogonal (perpendicular)"
Wrong!andare linearly independent but not
orthogonal. Orthogonality is a stronger condition than linear
independence.
Misconception 4: "The basis is unique"
Wrong! The same space can have infinitely many bases. But the
dimension (size of the basis) is unique.
Misconception 5: "A subspace can be any subset"
Wrong! A subspace must satisfy three conditions (contains zero,
closed under addition, closed under scalar multiplication).
Exercises
Basic Problems
1. Determine if the following vector sets are
linearly independent:
(a) (b) (c) (d)2. Find the dimension of
the span of the following vector sets:
(a)in (b)in (c)in3. Canbe expressed as a linear
combination ofand? If so, find the coefficients.
4. What is the dimension of? How many vectors are needed
to form a basis?
5. Determine if the following sets are subspaces
of:
(a)
(b)
(c) (d)
Intermediate Problems
6. Prove: Ifis linearly independent, thenis also linearly
independent.
7. Given, find asuch thatis a
basis for.
8. Prove: Anyvectors inmust be linearly
dependent.
9. Let,.
Findand.
10. Prove: Ifis
linearly independent and, thencan be uniquely
expressed as a linear combination of the.
Thinking Problems
11. The RGB color space is 3-dimensional. Can all
colors be represented using mixtures of only 2 colors? Why or why
not?
12. Consider the set of allreal matrices with matrix
addition and scalar multiplication. Is this a vector space? If so, what
is its dimension? Give a basis.
13. Why is a line through the origin a subspace,
while a line not through the origin is not? Analyze using the three
conditions in the definition.
14. In, 100 random vectors are
almost always linearly independent, but 101 vectors must be linearly
dependent. Why?
Programming Problems
15. Write a Python function to check if a given set
of vectors is linearly independent. Use the determinant or rank
method.
16. Implement a function that, given a set of
vectors, finds a maximal linearly independent subset (i.e., a basis for
the span).
17. Write a program to visualize the plane spanned
by two vectors in 3D space.
18. Implement an interactive program: the user
inputs two 2D vectors and coefficients, and the program displays the linear combination result
and visualizes "moving within the span."
Exercise Solutions
Basic Problems
1. Determine if the following vector sets are
linearly independent:
(a)
Solution: Linearly dependent. Note
that, so they
are collinear.
(b)
Solution: Linearly independent.
These are the standard basis vectors, which are clearly independent.
(c)
Solution: Linearly independent. Set
up:Solving:. Only the zero
solution exists, so they're independent.
(d)
Solution: Linearly dependent. Note
that (verify:).
2. Find the dimension of the span:
(a)in: Dimension
1 (a line)
(b)in: Dimension
1 (collinear vectors span a line)
(c)in:
Dimension 2 (two non-collinear vectors span a
plane)
3. Canbe
expressed as a linear combination ofand?
Solution: Set up:From the
second equation:.
Substituting into the first:
Solution: Yes, this is a subspace.
- Contains zero:satisfies - Closed under addition:
Ifand, then - Closed under scalar
multiplication: If,
then
(b)
Solution: No, not a subspace. -
Doesn't contain zero:gives
(c)
Solution: No, not a subspace. - Not
closed under addition:andare in the set
(both satisfy), but their
sumgives
Intermediate Problems
6. Find all possible dimensions of subspaces of:
Solution: 0, 1, 2, 3, 4 - 0: The
zero space - 1: Lines
through the origin - 2: Planes through the origin - 3: 3D hyperplanes
through the origin - 4:itself
7. Prove: Ifis linearly independent, thenis also linearly
independent.
Proof: Supposewere linearly
dependent. Then there exist non-zero coefficients (not both zero) such that:But
then:This is a non-trivial linear combination
ofequaling zero, contradicting their linear
independence. Therefore,must be linearly independent. ∎
8. Find a basis forwhere: - - -
Solution: Check ifcan be written as a combination
of:This gives:From the first two:. Check in the third:Since, it's
redundant.
Answer:or equivalentlyforms a basis. The span is a 2D plane in.
9. Given basisof, find the coordinates
ofwith respect to.
Solution: Set up:Adding:. Then.
Answer:
10. Is the set of allupper triangular matrices a subspace of allmatrices?
Solution: Yes.
Upper triangular matrices have the form.
Contains zero matrix:
Closed under addition: Sum of two upper triangular matrices is upper
triangular
Closed under scalar multiplication: Scalar times upper triangular is
upper triangular
11. Prove or disprove: The set of all
invertiblematrices is a
subspace of allmatrices.
Solution: False (not a
subspace).
Counterexample: The identity matrixis invertible, butis also invertible.
However, (the zero
matrix), which is not invertible.
Therefore, the set is not closed under addition, so it's not a
subspace.
12. Given vectors in:. Are they linearly independent? Do they
form a basis for?
Solution: Check the determinant:
Answer: Since the determinant is non-zero, they are
linearly independent. Since we have 3 linearly independent vectors
in (a 3-dimensional
space), they form a basis for.
Advanced Problems
13. Why is a line through the origin a subspace,
while a line not through the origin is not?
Solution:
Line through originfor some: - Contains zero:
When, we get - Closed under addition: - Closed
under scalar multiplication:
Line not through originwhere: - Doesn't contain zero: Settinggives - Not closed under addition:, which has a "" term, not in the original
form
14. In, 100 random vectors are
almost always linearly independent, but 101 vectors must be linearly
dependent. Why?
Solution:
Dimension theorem: In an-dimensional space, any set of more
thanvectors must be linearly
dependent.
For: - Maximum
number of linearly independent vectors = dimension = 100 - 100 "generic"
vectors (in general position) will be linearly independent with
probability 1 - 101 vectors must be linearly dependent,
because you can't have more than 100 independent directions in a
100-dimensional space
Intuition: Think of it as degrees of freedom. You
have only 100 "slots" for independent directions. The 101st vector must
be expressible as a combination of the first 100.
defmaximal_independent_subset(vectors): """ Find maximal linearly independent subset (a basis for the span) """ A = np.column_stack(vectors) m, n = A.shape independent_indices = [] current_matrix = np.zeros((m, 0)) for i inrange(n): test_matrix = np.column_stack([current_matrix, A[:, i]]) if np.linalg.matrix_rank(test_matrix) > len(independent_indices): independent_indices.append(i) current_matrix = test_matrix basis = [vectors[i] for i in independent_indices] return independent_indices, basis
# Test vectors = [ np.array([1, 0, 0]), np.array([1, 1, 0]), np.array([2, 1, 0]), # Dependent on first two np.array([0, 0, 1]) ]
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D
defvisualize_span_3d(v1, v2): """Visualize plane spanned by two 3D vectors""" fig = plt.figure(figsize=(10, 8)) ax = fig.add_subplot(111, projection='3d') # Generate points on the plane s = np.linspace(-2, 2, 20) t = np.linspace(-2, 2, 20) S, T = np.meshgrid(s, t) X = S * v1[0] + T * v2[0] Y = S * v1[1] + T * v2[1] Z = S * v1[2] + T * v2[2] # Plot plane ax.plot_surface(X, Y, Z, alpha=0.3, cmap='viridis') # Plot basis vectors ax.quiver(0, 0, 0, v1[0], v1[1], v1[2], color='r', arrow_length_ratio=0.15, linewidth=3) ax.quiver(0, 0, 0, v2[0], v2[1], v2[2], color='g', arrow_length_ratio=0.15, linewidth=3) ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') ax.set_title('Span of two 3D vectors') plt.show()
This chapter established the core conceptual framework of linear
algebra:
Concept
Definition
Intuition
Linear combination
Weighted sum of vectors
Span
All possible linear combinations
All reachable positions
Linear independence
Only zero solution
No redundancy
Basis
Independent + spans
Smallest complete set
Dimension
Size of basis
Degrees of freedom
Subspace
Contains zero + closed
Space within a space
These concepts will pervade all of linear algebra:
Chapter 3: The span of a matrix's column vectors is
the column space
Chapter 4: Determinants determine linear
independence
Chapter 5: The solution space of linear systems is
a subspace
Chapter 6: Eigenvectors form special bases
Chapter 7: Orthogonal bases simplify
calculations
Chapter 9: SVD gives the "optimal" basis
Preview: Next Chapter
"Matrices as Linear Transformations"
Matrices aren't just tables of numbers — they are agents of
transformation!
We will explore: - The geometric meaning of matrix-vector
multiplication - Matrix representations of rotation, scaling, shearing,
projection - Matrix multiplication = composition of transformations -
Determinant = how transformation affects area/volume
Get ready to change your view of matrices!
References
Strang, G. (2019). Linear Algebra and Learning from Data.
Chapter 1.
3Blue1Brown. Essence of Linear Algebra, Chapters 2-3.
[YouTube]
Axler, S. (2015). Linear Algebra Done Right. Chapter
1-2.
Boyd, S., & Vandenberghe, L. (2018). Introduction to Applied
Linear Algebra. Chapter 2-5.
Horn, R. A., & Johnson, C. R. (2012). Matrix Analysis.
Chapter 0.