determin.ant
01-vectors / 1.1

Module 1: Vectors

What is a vector?

Where you'll see this: every time a game engine moves a character, a GPS calculates a route, a physics simulation applies gravity, or a machine learning model stores a data point — it's using vectors. They're the single most common data structure in scientific computing.

You already understand the core idea. You just haven't given it a name yet.

Start with directions

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.

Three ways to picture a vector

1. As an arrow

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.

2. As two numbers

The arrow from the origin to the point (3, 2) can be fully described as [3,  2][3,\; 2] — go 3 units right, go 2 units up. Those two numbers completely capture the arrow. Nothing is lost.

3. As a point in space

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?

All three pictures describe the same object. The arrow, the pair of numbers, and the point are just different lenses for the same idea.

Try it

The interactive on the right shows a vector as an arrow. Drag the tip to any position. Notice:

  • The blue dashed line shows the x-component — how far right (or left)
  • The pink dashed line shows the y-component — how far up (or down)
  • The readout below shows the vector as two numbers

What happens when you drag to the left? The x-component goes negative. What about straight up? The x-component becomes 0.

For the CS folks

A vector is literally an array. In Python, you might write:
v = [3, 2]        # a 2D vector
v = [3, 2, 5]     # a 3D vector — same idea, one more number

In 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-component

The 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.

One key thing to remember

A vector is not a point on a map. It is a displacement — an instruction for how to move. [3,2][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.

Vector Addition
drag the tip of the arrow
-6-6-5-5-4-4-3-3-2-2-1-1112233445566x = 3y = 2v
v = [3, 2]|v| = 3.61