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:

v=32+42=5\|v\| = \sqrt{3^2 + 4^2} = 5

For two points a and b, the distance between them is the length of their difference:

d(a,b)=bad(a, b) = \|b - a\|
abd(a, b) = ||b - a||fixed distance from a
A circle is the set of points at one fixed distance from a center.

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):

ba=[3,4]b-a = [3,4]

so:

d(a,b)=[3,4]=5d(a,b) = \|[3,4]\| = 5
MATH-C04-T03-001Exercise: Compute a distance

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:

ba=[3,4]b-a = [3,4]

Then measure the length of that difference vector:

d(a,b)=32+42=5d(a,b) = \sqrt{3^2 + 4^2} = 5

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.

MATH-C04-T03-002Exercise: Read a circle

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.

MATH-C04-T03-003Exercise: Choose the careful claim

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.

MATH-C04-T03-004Exercise: Distance changes neighbors

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.