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:

[a1,a2]+[b1,b2]=[a1+b1, a2+b2][a_1,a_2] + [b_1,b_2] = [a_1+b_1,\ a_2+b_2] [a1,a2][b1,b2]=[a1b1, a2b2][a_1,a_2] - [b_1,b_2] = [a_1-b_1,\ a_2-b_2]

Scalar multiplication stretches, shrinks, or flips:

c[a1,a2]=[ca1, ca2]c[a_1,a_2] = [ca_1,\ ca_2]

Scaling by zero produces the zero vector, which has no direction.

The dot product collapses two vectors into one scalar:

ab=a1b1+a2b2++anbna\cdot b = a_1b_1 + a_2b_2 + \cdots + a_nb_n

Norm and distance measure size and separation:

v=v12+v22++vn2\|v\| = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2} ba=distance from a to b\|b-a\| = \text{distance from } a \text{ to } b

Cosine similarity compares direction:

abab\frac{a \cdot b}{\|a\|\|b\|}

Projection measures the part of one vector along another direction:

projb(a)=abbbb\operatorname{proj}_b(a) = \frac{a \cdot b}{b \cdot b}b

Key Notation

Read each notation as an action:

  • v=[v1,v2]v = [v_1, v_2]: vv has coordinates v1v_1 and v2v_2; a two-dimensional vector.
  • a+ba + b: add matching coordinates.
  • aba - b: subtract matching coordinates.
  • cvcv: multiply every coordinate of vv by the scalar cc.
  • aba \cdot b: multiply matching entries, then add.
  • v\|v\|: the norm of vv; the length of vv.
  • ab\|a-b\|: the norm of aba-b; the distance between aa and bb.
  • abab\frac{a \cdot b}{\|a\|\|b\|}: cosine similarity; directional similarity after length normalization.
  • projb(a)\operatorname{proj}_b(a): projection of aa onto bb; the part of aa along bb.

Operation Types

Knowing the output type prevents many mistakes.

  • a+ba+b: two matching vectors go in; one vector comes out.
  • aba-b: two matching vectors go in; one vector comes out.
  • cvcv: a scalar and a vector go in; one vector comes out.
  • aba\cdot b: two matching vectors go in; one scalar comes out.
  • v\|v\|: one vector goes in; one scalar length comes out.
  • ab\|a-b\|: two positions go in; one scalar distance comes out.
  • Scalar component of aa along bb: two vectors go in, with b0b\ne0; one scalar comes out.
  • projb(a)\operatorname{proj}_b(a): two vectors go in, with b0b\ne0; one vector comes out.
  • Residual aprojb(a)a-\operatorname{proj}_b(a): 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 aa along bb is a number. The projection of aa onto bb 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:

  1. Treating vector coordinates as unordered.
  2. Adding coordinates into one number when the result should be a vector.
  3. Matching shapes while forgetting that coordinate meanings must match.
  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. Using cosine similarity with a zero vector.
  8. Confusing scalar component with projected vector.
  9. Forgetting that projection leaves a residual.
  10. Assuming every embedding coordinate has a simple human label.

Quick Checks

For a=[2,3]a=[2,3] and b=[4,1]b=[4,1]:

a+b=[6,4],ba=[2,2]a+b=[6,4],\qquad b-a=[2,-2] ab=2×4+3×1=11a\cdot b = 2\times4 + 3\times1 = 11

For v=[3,4]v=[3,4]:

v=5\|v\|=5

For a=[1,0]a=[1,0] and b=[0,1]b=[0,1]:

ab=0a\cdot b=0

The vectors are perpendicular.

For a=[3,2]a=[3,2] and b=[1,0]b=[1,0]:

projb(a)=[3,0]\operatorname{proj}_b(a)=[3,0]

and:

aprojb(a)=[0,2]a-\operatorname{proj}_b(a)=[0,2]

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.