Welcome to the second module of our course. In the previous lessons, we focused on the "forward pass" in machine learning—how a model like a neural network takes an input and, through a series of affine transformations g(Wx + b), computes an output. We also saw why matrix algebra is the language of choice for this: it allows for massive parallelization, making it computationally feasible to train complex models.
Now, we shift our focus from how a model computes to how a model learns. This begins the "inverse problem": how do we find the right values for the weights W and biases b in the first place? To answer this, we need a deeper understanding of the geometry of data and transformations. Our first step on this journey is to master one of the most fundamental concepts in all of linear algebra: the linear combination. This simple idea of building new vectors from a set of old ones is the key to understanding how data is represented, transformed, and understood in machine learning.
The Basic Recipe: Building Vectors
At its heart, a linear combination is just a recipe for constructing one vector out of others using the two basic operations you already know: scalar multiplication (scaling) and vector addition.
Imagine you have a set of ingredient vectors, say and . A linear combination of these vectors is what you get when you scale each one by some amount (e.g., by scalars and ) and add the results together. The final vector is .
The following image provides a perfect geometric illustration. The vector is formed by taking the vector , scaling it by a factor of 3.7, taking the vector and scaling it by 0.7, and then adding the two scaled vectors together.

This concept is so foundational that it's worth seeing it explained with the outstanding geometric intuition provided by 3Blue1Brown.
Linear combinations, span, and basis vectors | Chapter 2, Essence of linear algebra
This video, "Linear combinations, span, and basis vectors," brilliantly reframes what vector coordinates mean and generalizes the idea to arbitrary sets of vectors.
Watch from the beginning to understand how any vector in the standard xy-plane is actually a linear combination of the standard basis vectors, \mathbf{\hat{i}} and \mathbf{\hat{j}}. Your coordinates are simply the scalars in this combination. Continue watching from here to see how we can use any two vectors (as long as they don't point in the same direction) as a new basis, creating a whole new coordinate system. The segment from this point formally defines the term "linear combination." Finally, watch the explanation of "span" from here. The span is the set of all possible vectors you can create through a linear combination of your basis vectors. This is a crucial geometric concept we will build upon.
The key insight is that our familiar coordinates for a vector, like , are nothing more than the scalars in a linear combination using the standard basis: . By changing the basis vectors, we can represent the exact same vector with a completely different set of coordinates.
Formally, given a set of vectors in an -dimensional space, a linear combination of these vectors is any vector that can be written in the form:
where are scalars.
To solidify this idea, let's turn to the text version of the 3Blue1Brown lesson, which includes a helpful interactive exercise.
3Blue1Brown - Linear combinations, span, and basis vectors
This article recaps the core ideas from the video and lets you test your understanding.
Read through the page to reinforce the concepts of basis vectors, linear combinations, and span. Then, try to solve the quiz question near the bottom of the page that starts with "Given the linear combination...". You are given two basis vectors, \mathbf{v}_1 = [2, -1] and \mathbf{v}_2 = [1, 2], and asked to find the scalars a and b such that a\mathbf{v}_1 + b\mathbf{v}_2 produces the vector [7, 4]. This is a direct application of what we've just learned.
The Machine Learning Connection: Features as Building Blocks
This might seem abstract, but it's one of the most powerful ideas for understanding data. In machine learning, a "data point" is almost always represented as a vector of "features". For your work in computational biology, this could be a vector of gene expression levels, physicochemical properties of an amino acid, or counts of different k-mers in a DNA sequence.
Just like a geometric vector can be expressed as a linear combination of basis vectors, a data point can be thought of as a linear combination of its features. A linear model, such as linear regression or a logistic regression classifier, quite literally finds the best set of scalar weights () to form a linear combination of the feature vectors () to make a prediction:
This is a linear combination of the features. But the real power comes when we realize we can change the features. We can create new, more powerful features that are themselves combinations of the original ones. This is called feature engineering or representation learning.
Consider a simple classification problem where the data isn't separable by a straight line. By creating new features, we can often make the problem linearly separable in a higher-dimensional space. The following article provides an excellent explanation of this.
This chapter from "The Mechanics of Machine Learning" explains how creating new features allows linear models to capture non-linear patterns.
First, read the section on Polynomials. Notice how a non-linear quadratic function in 2D becomes a linear function in a 6D space. The prediction, w^T \Phi_2^{\text{poly}}(x), is a linear combination of the new polynomial features (1, x_1, x_2, x_1^2, x_1x_2, x_2^2). These are our new "basis vectors". Then, read the section on Basis functions. This generalizes the idea. We can represent our prediction function as a linear combination of any set of basis functions, f(x) = \sum_{k=1}^{B} w_k b_k(x). The functions b_k(x) are our new, engineered features.
This concept is at the heart of many advanced ML models:
- Kernel Methods (like in Support Vector Machines): These methods implicitly map data into an extremely high-dimensional feature space. A prediction is then made as a linear combination of the "similarity" (dot product) between a new point and the training points in this feature space.
- Neural Networks: You can think of each hidden layer in a neural network as learning a new, more useful representation of the data it receives. The output of a hidden layer is a new vector of features. The next layer then works with a linear combination of these learned features.
This image, which we've seen before, can be re-interpreted in this light. The activation vector is a new representation of the input vector , expressed in a basis learned by the weight matrix . The network's final output will be a function of a linear combination of these activations.

Conclusion
In this lesson, we established the fundamental concept of a linear combination. It is the simple act of scaling vectors and adding them together, but it unlocks a powerful way of thinking about data and models.
Key Takeaways:
- Linear Combination: A vector is a linear combination of other vectors if it can be written as for some scalars .
- Basis and Coordinates: The coordinates of a vector are simply the scalars of a linear combination with respect to a chosen set of basis vectors (e.g., and ).
- Features as Basis: In machine learning, we can think of features as basis vectors. A data point is represented by its coordinates in that feature space.
- Representation Learning: The goal of many advanced ML algorithms is to find a new set of basis features (a new representation) in which the problem becomes easier. A model's final prediction is often a linear combination of these new, powerful features.
This brings us to a crucial question. In the 3Blue1Brown video, we saw that if our two basis vectors happened to line up, their span was just a line, not the full 2D plane. We couldn't "reach" every point. What does this mean? It means one of our vectors was redundant. This idea of redundancy is central to our next topic: linear dependence. We will explore what it means for a set of vectors—or a set of features in a dataset—to be redundant, and why that can be problematic for machine learning models.