Introduction
Vectors are the first mathematical objects in this course that appear almost everywhere in machine learning.
A vector can store measurements, coordinates, activations, embeddings, scores, or parameters. The same object appears in many places because a model needs a way to turn meaning into numbers it can compute with.
That is the main reason vectors matter for AI. A model cannot directly compute with the idea "this token is related to that token" or "this image patch has this texture." It computes with numbers. Vectors are one of the simplest ways to give those numbers structure.
This chapter keeps the idea small:
a vector is:
an ordered list
of numbers
with meaning
The phrase with meaning matters. The list [2, 4] is only a list until we
know what the two numbers describe.
Another phrase matters too: ordered. The first coordinate has one role, the second coordinate has another role, and later coordinates have their own roles. Changing the order changes the object.
The Central Question
What can we do once an idea is represented as ordered numbers?
We can:
- move through space
- combine measurements
- compare two objects
- measure distance
- score similarity
- feed the numbers into a model
This is why vectors come before matrices, geometry, and deep learning. Many later ideas are built from vector operations.
A Small Example
Suppose a house is described by two measurements:
[rooms, distance_from_station]
Then:
[3, 2]
might mean:
3 rooms
2 kilometers from the station
The list by itself is not enough. The coordinate meanings turn the list into a vector for this problem.
What This Chapter Teaches
You will learn to:
- read vectors as ordered coordinates
- draw vectors as positions and directions
- add and subtract vectors
- scale vectors
- compute dot products
- measure length and distance
- compare directions with cosine similarity
- understand projection as "how much of one vector lies along another"
- connect vectors to embeddings and activations
We will use two-dimensional examples often. Real models use hundreds or thousands of coordinates, but two coordinates let us draw the idea.
A Recurring Picture
Many examples will use vectors such as:
a = [2, 4]
b = [3, 1]
In a diagram, these can be arrows from the origin. In data, they can be two measurements. In a model, they can be two activations.
The arithmetic is the same. The meaning comes from the problem.
This is the habit to build in the chapter:
numbers
-> coordinate meaning
-> operation
-> interpretation
Without the coordinate meaning, vector arithmetic is only symbol pushing. With the meaning attached, the same arithmetic becomes a way to reason about data, representations, and model behavior.
Before You Start
From Chapter 1, you need:
- tuples as ordered collections
- indices as position selectors
- sums as repeated addition
- the habit of saying notation in words
If those feel shaky, review Chapter 1 before going further. Vectors use that language immediately.
Next, we start with the object itself: what a vector is.