Review
Use these notes to review Chapter 2 quickly.
Core Picture
A vector is an ordered list of numbers with meaning.
The same coordinate list can be read in different ways depending on context:
- as a position: where something is
- as a direction: how something changes
- as a difference: how to get from one position to another
- as a representation: how a model stores useful information
The numbers alone are not enough. Coordinate order and coordinate meaning both matter.
Core Operations
Vector addition and subtraction happen coordinate by coordinate:
Scalar multiplication stretches, shrinks, or flips:
Scaling by zero produces the zero vector, which has no direction.
The dot product collapses two vectors into one scalar:
Norm and distance measure size and separation:
Cosine similarity compares direction:
Projection measures the part of one vector along another direction:
Key Notation
Read each notation as an action:
- : has coordinates and ; a two-dimensional vector.
- : add matching coordinates.
- : subtract matching coordinates.
- : multiply every coordinate of by the scalar .
- : multiply matching entries, then add.
- : the norm of ; the length of .
- : the norm of ; the distance between and .
- : cosine similarity; directional similarity after length normalization.
- : projection of onto ; the part of along .
Operation Types
Knowing the output type prevents many mistakes.
- : two matching vectors go in; one vector comes out.
- : two matching vectors go in; one vector comes out.
- : a scalar and a vector go in; one vector comes out.
- : two matching vectors go in; one scalar comes out.
- : one vector goes in; one scalar length comes out.
- : two positions go in; one scalar distance comes out.
- Scalar component of along : two vectors go in, with ; one scalar comes out.
- : two vectors go in, with ; one vector comes out.
- Residual : a vector and its projection go in; one leftover vector comes out.
Distinctions to Keep Clear
b - a is a vector. It points from a to b.
||b - a|| is a scalar. It is the distance between a and b.
The dot product is a scalar. It can act as a weighted sum, score, or alignment measure.
Cosine similarity is also a scalar, but it removes the direct effect of vector length. It is undefined if either vector has norm zero.
The scalar component of along is a number. The projection of onto is a vector.
An embedding is a learned or computed vector representation. It can be useful even when no single coordinate has a simple human label.
Traps to Avoid
Check yourself for these errors:
- Treating vector coordinates as unordered.
- Adding coordinates into one number when the result should be a vector.
- Matching shapes while forgetting that coordinate meanings must match.
- Treating the dot product as ordinary multiplication.
- Forgetting that subtraction has direction.
- Comparing raw dot products when length should be removed.
- Using cosine similarity with a zero vector.
- Confusing scalar component with projected vector.
- Forgetting that projection leaves a residual.
- Assuming every embedding coordinate has a simple human label.
Quick Checks
For and :
For :
For and :
The vectors are perpendicular.
For and :
and:
Bridge to Matrices
Matrices organize many vector operations at once.
A matrix-vector product is a structured way to combine coordinates. Each output entry can be read as a dot product between one matrix row and the input vector. That is why vectors come before matrices in this path.
Next, work through the chapter exercises. They should feel like practice with these ideas, not like a new topic.