Module 1: Vectors
You already understand the core idea. You just haven't given it a name yet.
Imagine someone asks you how to get to the coffee shop. You say: "Walk 3 blocks east, then 4 blocks north."
That pair of instructions — 3 east, 4 north — is a vector. It has a magnitude (how far in total) and a direction (which way to go).
A vector is any quantity that captures both of those things at once. Velocity is a vector: 60 mph north is different from 60 mph east. Force is a vector: you can push a door with 10 N, but the angle you push matters.
Draw a dot at the origin (the center of the grid). Draw another dot somewhere else. Connect them with an arrow. That arrow is the vector — its length is the magnitude, and the direction it points is the direction.
The arrow from the origin to the point (3, 2) can be fully described as [3,2] — go 3 units right, go 2 units up. Those two numbers completely capture the arrow. Nothing is lost.
The tip of the arrow marks a location. So a vector also names a destination: where do you end up if you start at the origin and follow the arrow?
The interactive on the right shows a vector as an arrow. Drag the tip to any position. Notice:
What happens when you drag to the left? The x-component goes negative. What about straight up? The x-component becomes 0.
v = [3, 2] # a 2D vector
v = [3, 2, 5] # a 3D vector — same idea, one more numberIn NumPy (which you will use constantly in ML):
import numpy as np
v = np.array([3, 2])
print(v[0]) # 3 — the x-component
print(v[1]) # 2 — the y-componentThe rest of this course is about what you can do with those arrays — add them, scale them, rotate them, and eventually decompose complicated transformations into simple parts.
A vector is not a point on a map. It is a displacement — an instruction for how to move. [3,2] says "move 3 right and 2 up", regardless of where you start.
We almost always draw vectors starting from the origin, but that's just a convention. The same arrow could start anywhere — it's the same vector.