Length, Distance, and Spheres
Length measures one vector.
Distance measures how far apart two points are.
For a vector v = [3, 4], the Euclidean length is:
For two points a and b, the distance between them is the length of their
difference:
Length Versus Distance
Length starts at the origin unless context says otherwise.
Distance starts with two points:
subtract the points
measure the difference vector
For a = (1, 2) and b = (4, 6):
so:
Let a = (1, 2) and b = (4, 6).
What is the Euclidean distance between them?
Compute it first, then check your number.
HintDifference first
First compute b - a, then take its length.
SolutionDistance from difference
Distance starts by subtracting the two points:
Then measure the length of that difference vector:
Circles and Spheres
In two dimensions, all points at a fixed distance from a center form a circle.
In three dimensions, they form a sphere.
In higher dimensions, people still say sphere, even though we cannot draw it.
This idea appears in ML whenever we compare representations by distance.
A circle centered at a with radius 5 contains points whose distance from
a is what number?
Compute it first, then check your number.
HintRadius as distance
Radius means fixed distance from the center.
SolutionFixed distance
The radius is 5, so every point on the circle is distance 5 from the
center.
Distance Is a Choice
Euclidean distance is common, but it is not the only distance. Different tasks may use Manhattan distance, cosine distance, edit distance, or learned distances.
The important habit is to ask what the distance is measuring.
If distance defines what counts as close, changing the distance can change which points count as neighbors.
That is not a technicality. In a retrieval system, the distance choice can change which document is returned. In a clustering system, it can change which points are grouped together. "Close" is not just a word; it is part of the model.
Enter 1 if this is the careful claim:
Distance defines
what this system means
by close.
Enter 2 for:
There is only one
useful distance
for every
ML problem.
Compute it first, then check your number.
HintAsk what close means
The distance function defines what counts as close.
SolutionDistance is part of the model
Enter 1. The distance choice defines what the system treats as near or
far.
Enter 1 if changing the distance function can change which point counts as
the nearest neighbor.
Compute it first, then check your number.
HintNear depends on the measure
Ask whether two measures must always rank all points in the same order.
SolutionNearest depends on distance
Enter 1. The nearest point is nearest under a chosen distance. Change the
distance, and the ordering of neighbors can change.
Before Moving On
Distance is not a decorative number. It defines which points count as close.