The Essence of Linear Algebra
Vectors and Vector Spaces
What Are Vectors?
Imagine you're giving someone directions. You might say, "Walk three blocks east and four blocks north." That instruction is a vector. It has a magnitude (the total distance) and a direction (northeast-ish). In mathematics and computer science, vectors are simply lists of numbers that represent a point in space, holding both size and direction.
Vectors are a foundational element of linear algebra.
The directions "three blocks east and four blocks north" can be written as a vector . Each number in the vector is called a component. This vector lives in a 2-dimensional space because it has two components. A vector like would live in a 3-dimensional space. In machine learning, vectors can have thousands or even millions of dimensions, representing complex data like images or text.
Vector Operations
There are two fundamental operations you can perform with vectors: addition and scalar multiplication.
Vector addition is like following one set of directions after another. If you first walk [3, 4] and then walk [1, -2] (one block east, two blocks south), where do you end up? You just add the corresponding components:
Your final position is four blocks east and two blocks north of your starting point.
Scalar multiplication involves scaling a vector by a plain number (a "scalar"). If you wanted to walk twice as far in the same direction as our original vector, you would multiply it by the scalar 2:
The new vector points in the same direction but is twice as long. Multiplying by a negative scalar would flip the vector's direction.
Combinations and Span
When we combine scalar multiplication and vector addition, we get a linear combination. For example, we can take two vectors and and combine them like this: .
This simple idea is incredibly powerful. The set of all possible vectors you can create by taking linear combinations of a set of vectors is called their span.
Think of span as all the points you can reach. If you have a set of vectors, their span is the line, plane, or higher-dimensional space they can "paint" through linear combinations.
For example, the span of a single vector like is an infinite line passing through the origin and the point (2,1). You can get to any point on that line by multiplying the vector by some scalar.
If you have two vectors that don't point along the same line, like (east) and (north), their span is the entire 2D plane. You can reach any point by finding the right scalars and to form the combination .
The Basis of a Space
This leads to the ideas of basis and dimension. A vector space is the set of all possible vectors of a certain length (e.g., all 2D vectors, which form the 2D plane). A basis for a vector space is a set of vectors that is just large enough to span the entire space, without any redundancy.
Basis
noun
A set of linearly independent vectors that span a vector space.
For a basis, two conditions must be met:
- The vectors must span the space (you can reach every point).
- The vectors must be linearly independent (none of the vectors can be made from a combination of the others).
This second point is about efficiency. The set of vectors {[1, 0], [0, 1], [2, 2]} spans the 2D plane, but it's not a basis because [2, 2] is redundant, it can be made from the other two (2*[1,0] + 2*[0,1]). The set {[1, 0], [0, 1]} is a basis because both vectors are needed and they're sufficient.
The number of vectors in any basis for a space is called the dimension of that space. For the 2D plane, the dimension is 2. For 3D space, it's 3. In machine learning, the dimension of a vector space can be very high, reflecting the complexity of the data.
Let's check your understanding of these core concepts.
Which of the following best describes a vector in the context of mathematics?
Given the vectors $$
vec{u} = [2, 5]
vec{v} = [-3, 1] 2
vec{u} +
vec{v} $$?
Understanding these building blocks—vectors, operations, span, and basis—is the first step into the world of linear algebra that powers so much of modern AI.

