Summary and Revision Notes

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 representation: how a model stores useful information

Key Ideas

  • Coordinates are the entries of a vector.
  • Coordinate order matters.
  • Matching shape is not enough; coordinate meaning must match too.
  • Vector addition and subtraction happen coordinate by coordinate.
  • Scalar multiplication stretches, shrinks, or flips a vector.
  • The dot product multiplies matching entries and adds the results.
  • A norm measures vector length.
  • Distance is the norm of a difference.
  • Cosine similarity compares direction after accounting for length.
  • Projection measures the component of one vector along another.
  • Embeddings are learned vectors used as representations.

Key Notation

NotationRead asMeaning
v=[v1,v2]v = [v_1, v_2]v has coordinates v one and v twoa two-dimensional vector
a+ba + ba plus badd matching coordinates
aba - ba minus bsubtract matching coordinates
cvcvc times vmultiply every coordinate by scalar c
aba \cdot ba dot bmultiply matching entries, then add
v\|v\|norm of vlength of v
ab\|a-b\|norm of a minus bdistance between a and b
abab\frac{a \cdot b}{\|a\|\|b\|}cosine similaritydirectional similarity
projb(a)\text{proj}_b(a)projection of a onto bpart of a along b

Operation Types

OperationInputOutput
a+ba+btwo matching vectorsvector
aba-btwo matching vectorsvector
cvcvscalar and vectorvector
aba\cdot btwo matching vectorsscalar
v\|v\|vectorscalar
ab\|a-b\|two positionsscalar
projb(a)\text{proj}_b(a)two vectors, with b0b\ne0vector

Knowing the output type prevents many mistakes.

Common Mistakes

  1. Forgetting that vector coordinates are ordered.
  2. Adding vectors with different shapes.
  3. Adding all vector coordinates into one number when the result should be a vector.
  4. Treating the dot product as ordinary multiplication.
  5. Forgetting that subtraction has direction.
  6. Comparing raw dot products when length should be removed.
  7. Confusing a scalar component with a projected vector.
  8. Assuming every embedding coordinate has a simple human label.
  9. Forgetting that a projection leaves a residual: the part not explained by the projection direction.

Bridge to Matrices

Matrices will organize many vector operations at once.

A matrix-vector product is a structured way to combine vector coordinates. That is why vectors come before matrices in this path.