Take a = (1, 2, 3) and b = (4, 0, 6). The per-feature differences are 3, 2 and 3:
p = 1: 3 + 2 + 3 = 8.000 (Manhattan)
p = 1.5: 5.591 (in between)
p = 2: √(9 + 4 + 9) = √22 = 4.690 (Euclidean)
p = 3: ³√(27 + 8 + 27) = ³√62 = 3.958
p = ∞: max(3, 2, 3) = 3.000 (Chebyshev)
every p from 1 to ∞ gives a different number, and they
are ordered: L∞ ≤ … ≤ L3 ≤ L2 ≤ L1.
Cosine distance needs no per-feature p; it compares direction only. Here a·b = 22, ‖a‖ = √14, ‖b‖ = √52, so dcos = 1 − 22 / (√14·√52) = 0.185 — the two vectors point in fairly similar directions even though their straight-line distance is large.
Now the payoff. The six-point set from chapter 02, query (2.0, 2.0), k = 3:
Euclidean neighbours: #1 A 0.800, #4 B 0.985, #2 A 1.100 → A
Cosine neighbours: #5 B 0.009, #6 B 0.010, #2 A 0.022 → B
same six points, same k, opposite predictions.
Euclidean asks "which point is closest?"; cosine asks
"which point points the same way?" — and on this data
the B points win the second question.
Numeric anchor: #5 B (3.4, 2.6) has Euclidean
distance 1.523
but cosine distance 0.0088
because (2.0, 2.0) and (3.4, 2.6) point in almost the
same direction.
Phase 1, Lesson 14 develops norms and distances properly — including why every p-norm obeys that ordering and when the differences matter. This lesson only needs the three rulers that KNN uses most.