The Length of a Vector
A flight-tracker app reports a plane's velocity as
(v_x, v_y) = (240, 70) km/h —
240 km/h east and 70 km/h north. Neither
number on its own is "the speed": the plane is moving both east and north at once. So
how fast is it really travelling?
The two components of a vector are the legs of a right triangle, and the vector itself is the
hypotenuse — so its length is exactly what
Pythagoras says it
is. The magnitude (also called the length or
norm) of \vec{v} = \begin{bmatrix} v_x \\ v_y \end{bmatrix}
is
\lVert \vec{v} \rVert = \sqrt{v_x^2 + v_y^2}.
Square each leg, add the squares, then take the square root of the sum — the whole recipe is
just a^2 + b^2 = c^2 read backwards. The double bars mean "size of",
and the answer is never negative — a length simply can't be.
Speed is a scalar; velocity is a vector
This is exactly why physicists keep two separate words. Velocity is the full
vector \vec v = \begin{bmatrix}v_x\\v_y\end{bmatrix} — it carries both
"how fast" and "which way." Speed is just its magnitude,
\lVert\vec v\rVert — a single number with the direction thrown away.
Two cars driving at the same speed but in opposite directions have equal speeds but opposite
velocities; a speedometer only ever shows you the magnitude.
Worked example: the 3-4-5 triangle
Take \vec{v} = \begin{bmatrix} 3 \\ 4 \end{bmatrix}. Square each
component, add the squares, then square-root the total:
\lVert \vec{v} \rVert = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5.
Three whole numbers that satisfy a^2+b^2=c^2 exactly —
3, 4, 5 — are
called a Pythagorean triple. Steer the vector below onto
(3,4), or its double (6,8), and watch the
length below land on a perfectly tidy whole number.
Worked example: how fast is the plane really going?
Back to the plane. Its velocity vector was
\vec{v} = \begin{bmatrix} 240 \\ 70 \end{bmatrix} km/h. Its
speed — the single number a pilot reads off a dial — is the magnitude of that
vector:
\lVert \vec{v} \rVert = \sqrt{240^2 + 70^2} = \sqrt{57600 + 4900} = \sqrt{62500} = 250 \text{ km/h}.
The plane never actually travels at 240 km/h, and never at
70 km/h either — those are just how much of its motion is eastward and
how much is northward. Combine them with Pythagoras and the true speed pops out:
250 km/h. Every GPS chip performs exactly this calculation, many times
a second, to show you one clean speed reading.
When the answer isn't a whole number
Most vectors aren't as tidy as (3,4). Take
\vec{v} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} — the diagonal step of a
unit square:
\lVert \vec{v} \rVert = \sqrt{1^2+1^2} = \sqrt{2} \approx 1.41.
There's nothing wrong here — \sqrt{2} is a perfectly good number, it
just isn't a whole one. Leaving an answer as \sqrt{2} is exact;
writing 1.41 is a rounded approximation. Either is fine depending on
what you need it for, but don't be surprised when Pythagoras doesn't hand you a neat integer —
the 3\text{-}4\text{-}5 triple is the exception, not the rule.
One dimension more: the same idea in 3D
Add a third component and nothing about the idea changes — apply Pythagoras twice: once for the
two flat legs, and once more to bring in height. A vector
\vec{v} = \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix} in space has
magnitude
\lVert \vec{v} \rVert = \sqrt{v_x^2 + v_y^2 + v_z^2}.
For example, a drone climbing with velocity
\begin{bmatrix} 2 \\ 3 \\ 6 \end{bmatrix} m/s (east, north, and
upward) has speed
\sqrt{2^2+3^2+6^2} = \sqrt{4+9+36} = \sqrt{49} = 7 \text{ m/s}.
Every extra dimension just adds one more squared term under the root — the pattern keeps working
no matter how many components a vector has.
Worked example: which runner is faster?
Two runners cross a field, tracked by GPS watches. Runner A's velocity is
\vec{a} = \begin{bmatrix} 5 \\ 12 \end{bmatrix} m/min; runner B's is
\vec{b} = \begin{bmatrix} 8 \\ 9 \end{bmatrix} m/min. Neither pair of
components is directly comparable — A is running more north-heavy, B more east-heavy — so
compare their magnitudes instead:
\lVert \vec{a} \rVert = \sqrt{5^2+12^2} = \sqrt{25+144} = \sqrt{169} = 13, \qquad \lVert \vec{b} \rVert = \sqrt{8^2+9^2} = \sqrt{64+81} = \sqrt{145} \approx 12.04.
Runner A is faster overall — 13 m/min against roughly
12.04 m/min — even though B's components look individually larger in
one direction. Magnitude is what lets you rank vectors by size at all; comparing components
directly would have given the wrong answer.
Distance is the length of a difference
Length quietly gives us distance. The gap between two points
A and B is just the magnitude of the
displacement between them:
\text{distance}(A, B) = \lVert \vec{B} - \vec{A} \rVert.
For example, take A = (1, 2) and B = (4, 6).
The displacement from A to B is
\vec{B}-\vec{A} = \begin{bmatrix} 4-1 \\ 6-2 \end{bmatrix} = \begin{bmatrix} 3 \\ 4 \end{bmatrix}
— that 3-4-5 triangle again — so
\text{distance}(A,B) = \lVert(3,4)\rVert = 5. That's the everyday
distance formula, dressed in vector clothes — and the same quantity a
machine-learning
model uses to decide which data points are "near" one another.
Magnitude obeys one more rule worth knowing, for any two vectors \vec{a}
and \vec{b}:
- \lVert \vec{a} + \vec{b} \rVert \le \lVert \vec{a} \rVert + \lVert \vec{b} \rVert — the length of a sum is never more than the sum of the lengths.
- Equality only happens when \vec{a} and \vec{b} point in exactly the same direction.
It's just the geometric fact that a straight line is the shortest path between two points: walking
the two sides of a triangle is never shorter than cutting straight across the third.
It's tempting to think a vector's "size" should just be
|v_x| + |v_y| — add up how far it goes in each direction. That
quantity is real and useful (it's called the taxicab or Manhattan
distance, because it's how far a taxi drives along a rectangular street grid, unable to cut
diagonally) but it is not the length of the arrow. The straight-line arrow cuts the
corner that the taxi can't, so \sqrt{v_x^2+v_y^2} is always a little
shorter than |v_x|+|v_y| (unless the vector points straight
along one axis, when they agree). Two different, equally legitimate ways to measure "size" — this
page always means the straight-line one.
Two classic slips, both worth guarding against:
-
Forgetting the square root.
v_x^2+v_y^2 is the squared length, not the length itself.
3^2+4^2=25, not 5 — the last step is
always \sqrt{\phantom{x}}. Leaving it off is the single most common
mistake with this formula.
-
Worrying about negative components. A vector's components can absolutely be
negative — \begin{bmatrix} -3 \\ -4 \end{bmatrix} points down-left —
but its magnitude never is. Squaring a negative number erases the sign
((-3)^2=9, exactly like 3^2), so the
length that comes out is always positive. A length of -5 makes no
more sense than a box with -5 cm sides.
That "current speed" reading on a maps app isn't measured directly — it's computed, and it's
exactly the calculation on this page. The GPS chip tracks your position and works out a velocity
vector: how far east and how far north you moved in the last second. It then reports the
magnitude of that vector as your speed, quietly throwing away the direction. That
is why the number stays steady as you round a corner at a constant pace — the components change,
but their combined length doesn't.
Finding \sqrt{62500} is one tap on a phone today, but people have
needed magnitudes for thousands of years — surveyors, sailors, and astronomers all had to find
lengths from Pythagoras long before electronic calculators existed. The trick they used, later
polished by Newton, is to guess and improve: start with any rough guess
g for \sqrt{N}, then replace it with the
average \tfrac12\left(g + \tfrac{N}{g}\right). Each round roughly
doubles the number of correct digits — guess 200 for
\sqrt{62500} and after just two rounds you land on
250.000, exactly. Long before computers, this simple averaging trick
put vector lengths within reach of anyone with pencil, paper, and patience.
Long before Pythagoras had a theorem named after him, Egyptian surveyors known as
"rope-stretchers" used this exact 3-4-5
triple to build the pyramids. They knotted a loop of rope into 12
equal segments, then pulled it taut into a triangle with sides 3,
4 and 5 knots long. Because
3^2+4^2=5^2, that triangle is always right-angled — a free,
portable set-square, thousands of years before anyone wrote down why it worked.
See it explained