Pre-algebra Refresh · 18 min

Quantities live on a line

Every number, including the negative ones, is a position on one straight line. Distance from zero has a name, and you'll use it for the rest of the course.

0 / 0

You already trust this picture

You’ve drawn it a hundred times without thinking: a straight line, a zero in the middle, numbers marching off in both directions.

We’re going to make it official, because this one picture is the whole foundation. Every number in this course is a position on a line, and a surprising amount of math turns out to be just two questions: which way, and how far.

The line has exactly three parts

A number line is three decisions. Where zero sits (the origin). Which way is positive (by convention, right). And how long one unit is. Fix those three things and every real number has exactly one home on the line.

Drag the marker. Queue up some steps and watch it walk.

-10-9-8-7-6-5-4-3-2-10123456789100
0 position: 0
no steps; add some below
0 steps left

There is no number you can name that doesn’t land somewhere on this line: negative, fraction, decimal, all of them. That’s the claim the rest of this module rests on.

A negative number is not a broken number

School taught you negatives as debt: “you owe me three.” Fine for money, terrible as a definition. It makes 3-3 sound like a damaged 33, a quantity with something missing.

It isn’t. 3-3 is a position, three units left of zero, every bit as real and as locatable as +3+3. The minus sign isn’t damage. It’s a direction.

-10-9-8-7-6-5-4-3-2-10123456789103
reflections 0
product 3
parity even → positive

Press ×(1)\times(-1). The point doesn’t shrink or break; it reflects across zero. Same distance out, opposite side.

Direction and magnitude are two separate facts

Once a number is a position, it carries two independent pieces of information:

  • direction: which side of zero it’s on (that’s the sign)
  • magnitude: how far from zero it is (a size, never negative)

7-7 and +7+7 disagree on direction and agree on magnitude. Pulling those two apart is the move the rest of this lesson is about.

Magnitude has a name: absolute value

The magnitude of a number, its distance from zero with the sign thrown away, is its absolute value, written between two bars:

x={xx0xx<0|x| = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}

Read the second line slowly. When xx is negative, x-x is positive: flipping a negative gives a positive. So 7=(7)=7|-7| = -(-7) = 7. Absolute value never hands back a negative. It’s a distance, and a distance has no side.

Strip the sign

Absolute value answers exactly one question: how far from zero, ignoring which way?

What is 7|-7|?

Distance between any two points

Distance from zero is the easy case. The real tool is the distance between any two positions xx and yy:

distance(x,y)=xy\text{distance}(x, y) = |x - y|

Subtract them, then take the absolute value. The subtraction might come out negative depending on which number you wrote first; the bars clean that up. Distance doesn’t care about order.

How far apart

A point sits at x=2.4x = -2.4. A target sits at t=1.1t = 1.1.

How far apart are they? Use xt|x - t|.

Where this goes

Hold onto x|x|. In a few modules, numbers stop being single positions and become vectors, whole lists of positions at once. The tool that measures a vector’s size is the norm, written x\|\mathbf{x}\|. It is absolute value with more dimensions: still “distance from the origin,” still never negative.

And when you train a neural network, the single number you drive toward zero (the loss) is a distance. You just met its one-dimensional ancestor.

Lesson complete

Nice tinkering.