Magnitude of a Vector

Deriving the length of a vector in 1D, 2D and 3D, then N dimensions.

The magnitude of a vector $\bar{v}$ is its length: the distance from its tail to its head. We write it $|\bar{v}|$. This page works out a formula for it in one, two and three dimensions, then uses the pattern to define it in any number of dimensions.

1. One Dimension

A vector in one dimension is a single number, $\bar{v} = (v_x)$. Its length is how far it goes, whichever way it points. That is the absolute value of $v_x$:

$$|\bar{v}| = |v_x|$$
A number line from −5 to 5 with two arrows starting at 0: vector a pointing 3 units right and vector b pointing 3 units left.
Fig 1: $\bar{a} = (3)$ and $\bar{b} = (-3)$ both have length 3.

There is another way to write this, which will matter later. Squaring a number removes its sign, and the positive square root then undoes the squaring:

$$\sqrt{3^2} = \sqrt{9} = 3 \qquad \sqrt{(-3)^2} = \sqrt{9} = 3$$

So $|v_x| = \sqrt{v_x^2}$ for any number $v_x$, and

$$|\bar{v}| = \sqrt{v_x^2}$$

2. Two Dimensions

Draw $\bar{v} = (v_x, v_y)$ from the origin, together with its components.

Axes x and y from the origin O. Vector v runs from O up and to the right; it has a horizontal part v_x along the x-axis and a vertical part v_y up to its head, meeting at a right angle.
Fig 2: The two components of $\bar{v}$ and the vector itself form a right triangle.

The $x$-axis and the dashed line meet at a right angle, so the three lines form a right triangle. Its two shorter sides have lengths $|v_x|$ and $|v_y|$, and its longest side, the hypotenuse, is the vector itself, with length $|\bar{v}|$.

The Pythagorean Theorem says that the square of the hypotenuse equals the sum of the squares of the other two sides:

$$|\bar{v}|^2 = |v_x|^2 + |v_y|^2$$

Squaring removes signs, so $|v_x|^2 = v_x^2$ and $|v_y|^2 = v_y^2$:

$$|\bar{v}|^2 = v_x^2 + v_y^2$$

A length is never negative, so we take the positive square root of both sides:

$$|\bar{v}| = \sqrt{v_x^2 + v_y^2}$$

Example 1

For $\bar{v} = (3, 4)$:

$$|\bar{v}| = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5$$

For $\bar{w} = (-3, 4)$ the answer is the same, $\sqrt{(-3)^2 + 4^2} = 5$. Changing the sign of a component changes the direction of a vector, not its length.

3. Three Dimensions

Now $\bar{v} = (v_x, v_y, v_z)$ points from the origin $O$ to a point $P$ in space. No single right triangle contains all three components, but two right triangles do the job, one after the other.

Three axes from the origin O: x towards the reader, y to the right, z up. On the floor, a rectangle with sides v_x and v_y has a diagonal d from O. From the end of d, a vertical line of height v_z rises at a right angle to the point P. Vector v runs straight from O to P.
Fig 3: The floor diagonal $d$, then the height $v_z$, lead from $O$ to $P$.

Step 1: across the floor. Ignore height for a moment. On the floor, which is the plane containing the $x$-axis and the $y$-axis, the components $v_x$ and $v_y$ are the sides of a rectangle. Its diagonal $d$ runs from $O$ to the corner directly below $P$. This is exactly the two-dimensional case:

$$d^2 = v_x^2 + v_y^2$$

Step 2: straight up. From the end of $d$, the point $P$ is a height $|v_z|$ directly above. That vertical line is at right angles to the floor, so it is at right angles to $d$, which lies in the floor. So $d$, the vertical line and $\bar{v}$ form a second right triangle, with $\bar{v}$ as its hypotenuse. By the Pythagorean Theorem again:

$$|\bar{v}|^2 = d^2 + v_z^2$$

Step 3: combine. Substitute $d^2$ from step 1:

$$|\bar{v}|^2 = v_x^2 + v_y^2 + v_z^2$$

and take the positive square root:

$$|\bar{v}| = \sqrt{v_x^2 + v_y^2 + v_z^2}$$

Example 2

For $\bar{v} = (2, 3, 6)$:

$$|\bar{v}| = \sqrt{2^2 + 3^2 + 6^2} = \sqrt{4 + 9 + 36} = \sqrt{49} = 7$$

4. The Pattern

Line the three results up, using numbered components: $v_1$ for $v_x$, $v_2$ for $v_y$ and $v_3$ for $v_z$.

$$\begin{align} \text{1D:} \quad |\bar{v}| &= \sqrt{v_1^2} \\ \text{2D:} \quad |\bar{v}| &= \sqrt{v_1^2 + v_2^2} \\ \text{3D:} \quad |\bar{v}| &= \sqrt{v_1^2 + v_2^2 + v_3^2} \end{align}$$

Each new dimension adds one more squared component under the square root, and the derivations show why. Going from two dimensions to three, the old length $d$ became one side of a new right triangle, and the new component became the other side. Going from one dimension to two works the same way, with $|v_1|$ as the old length and $v_2$ as the new side.

5. N Dimensions

In four or more dimensions we cannot draw the right triangles, so we cannot derive a formula the way we did above. Instead, we define the magnitude so that it continues the pattern.

The magnitude of a vector $\bar{v} = (v_1, v_2, \dots, v_n)$ in $n$ dimensions is

$$|\bar{v}| = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2}$$

This is a choice, but not an arbitrary one. It agrees with every case we could derive: setting $n$ to 1, 2 or 3 gives back the formulas above. And it keeps the step that produced them, where one more dimension adds one more squared component, just as each extra right triangle did.

A shorter way to write the sum uses the symbol $\sum$, the Greek capital letter sigma, for “sum”. The expression $\sum_{i=1}^{n} v_i^2$ means “add up $v_i^2$ for every whole number $i$ from 1 to $n$”. So

$$|\bar{v}| = \sqrt{\sum_{i=1}^{n} v_i^2}$$

Example 3

For $\bar{v} = (1, 2, 2, 4)$ in four dimensions:

$$|\bar{v}| = \sqrt{1^2 + 2^2 + 2^2 + 4^2} = \sqrt{1 + 4 + 4 + 16} = \sqrt{25} = 5$$