Vectors in 3D

Tell an air-traffic controller how fast a plane is moving and one number is never enough. They need to know how fast it's moving north–south, how fast east–west, and how fast it's climbing or descending — three numbers, not one, because the sky is three-dimensional. A GPS receiver, a drone's flight computer, and a video-game camera all face the very same problem: the flat page you learned vectors on has only two directions to move in, but the real world has three.

The same problem shows up everywhere you look. A submarine pilot needs to know depth as well as north–south and east–west position before they can be sure they're not about to scrape the sea floor. A weather balloon's tracking station reports its ground position and its altitude, because "where is it?" in the real atmosphere is a three-number question. Two numbers were always secretly an approximation — a flattened shadow of the real, three-dimensional problem.

The good news is that nothing about vectors was ever really tied to two dimensions — that was just easy to draw. Every tool already in your kit — addition, scaling, length, the dot product — survives the trip into three dimensions almost untouched. A vector in three dimensions simply carries a third component:

\vec{v} = \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix}.

Add component by component, scale every component the same way, and the dot product and length just grow one more term:

\vec{u}\cdot\vec{v} = u_x v_x + u_y v_y + u_z v_z, \qquad \lVert\vec{v}\rVert = \sqrt{v_x^2 + v_y^2 + v_z^2}.

Notice the shape of that length formula: it's just Pythagoras' theorem, run one extra round. In 2D you square two legs of a right triangle and take the root; in 3D you square three edges of a box and take the root. Same idea, one more term to carry along.

An arrow in space

Below is a 3D vector in a rotatable view. Drag the box to rotate it and slide the components to move the arrow through space. A dashed line drops the tip onto the xy floor: the shaded rectangle there reads off v_x and v_y, and the drop's height gives v_z. Think of the floor as the ground (north–south and east–west) and the drop as altitude — exactly the controller's three numbers from the hook above. The readout gives its length by the three-term Pythagoras above.

Try dragging just one slider at a time and watch what stays put: moving v_z alone slides the arrow's tip straight up or down without disturbing where its shadow lands on the floor, while moving v_x or v_y alone slides the floor shadow sideways without changing the altitude at all. The three components really do behave as three completely independent knobs — exactly what you'd expect from a rule that adds, scales and squares each coordinate on its own.

Worked example: the length of a 3D vector

Let's find the length of \vec{v} = (2, 3, 6) by hand — no diagram needed, just the formula.

\lVert\vec{v}\rVert = \sqrt{2^2 + 3^2 + 6^2} = \sqrt{4 + 9 + 36} = \sqrt{49} = 7.

Square each component, add the squares, take the square root — the exact same three steps as the 2D formula, just with one more square to add before the root. It's a happy coincidence that 4 + 9 + 36 lands on the perfect square 49; most 3D vectors give an untidy decimal length, which is perfectly normal.

Worked example: dot product and perpendicularity

The dot product's most useful trick carries over unchanged too: two vectors are perpendicular exactly when their dot product is zero. Take \vec{u} = (1, 2, -2) and \vec{v} = (2, -1, 0).

\vec{u}\cdot\vec{v} = (1)(2) + (2)(-1) + (-2)(0) = 2 - 2 + 0 = 0.

Multiply matching components, add the three results, and the answer is zero — so \vec{u} and \vec{v} meet at a right angle, even though nothing about this pair of arrows looks obviously "square" when you first write down their coordinates. The dot product tells you instantly, without ever having to draw them.

Worked example: adding displacements

A delivery drone sits at position (10, 5, 3) metres (east, north, altitude) above its launch pad. Its flight computer plans a move described by the displacement vector (4, -2, 6) — four metres further east, two metres back to the south, and six metres higher. Component-wise addition gives its new position:

(10, 5, 3) + (4, -2, 6) = (10+4,\ 5-2,\ 3+6) = (14, 3, 9).

Each coordinate only ever talks to its own partner — the east numbers add to give the new east number, the altitude numbers add to give the new altitude — exactly as in 2D, just with a third column riding along for the trip.

A real flight computer repeats this exact addition dozens of times a second, once per tiny displacement the drone makes, continually updating its stored position vector. Nothing fancier than three additions, over and over, is what lets the drone always know where it is.

Worked example: scaling a 3D vector

Scalar multiplication is just as unremarkable an extension as addition: multiply every component by the same number. A weather station tracks a balloon drifting with velocity \vec{w} = (1, 2, 0.5) km/h (east, north, rising). If the wind doubles in strength but keeps the same direction, the new velocity is

2\vec{w} = 2(1, 2, 0.5) = (2, 4, 1).

Every one of the three numbers doubles — the balloon still rises at the same rate relative to its horizontal drift, just everything faster. Scaling never mixes components together; it treats x, y and z completely independently, in 3D exactly as it did in 2D.

The one operation that doesn't carry over

Addition, scaling, the dot product, length — every one of these is a direct extension of its 2D version, one more term and done. But there is a famous vector operation that works only in three dimensions and has no simple two-dimensional twin at all: the cross product. Feed it two 3D vectors and it hands back a brand-new vector — not a number, like the dot product does — that points perpendicular to both of the originals, in the one direction perpendicular-to-both actually exists in three dimensions. In flat 2D there's no room for such a direction to live in, so the cross product simply has nothing to extend from. It's a reminder that "add a dimension, add a term" is a great rule of thumb — but not a law.

You can feel why it's special even without the formula: cross the vector pointing purely x (east, say) with the one pointing purely y (north), and the result points purely z (straight up) — a fresh direction that neither original vector had any part of. In flat 2D, "east" and "north" already use up both available directions; there's simply no leftover direction left for a cross product to point along. Three dimensions is the smallest space roomy enough for the idea to make sense at all.

Beyond what we can picture

The drawings stop at three dimensions, but the arithmetic doesn't care. A vector with n components lives in n-dimensional space, and the dot product and length keep the very same shape — just more terms in the sum. A greyscale photo is a vector with one component per pixel; a customer is a vector of their purchases. This is why linear algebra scales so gracefully into machine learning: the pictures end at 3D, but the maths runs to thousands of dimensions without blinking.

You've actually met a familiar 3-component vector already, without calling it one: a colour. Every pixel on a screen is stored as three numbers — how much red, how much green, how much blue — which is exactly a vector in 3D, just with "redness" standing in for x, "greenness" for y, and "blueness" for z. Software that decides whether two colours look "close enough" to match — say, when compressing a photo — often measures the same three-term length formula from this page between the two colour vectors: a small length means the colours are nearly indistinguishable, a large one means they're clearly different.

These two catch even careful students:

Every time your phone's GPS chip fixes your location, it's leaning on exactly the length formula above. Each GPS satellite broadcasts its own position and the time its signal was sent; your phone measures how long the signal took to arrive and turns that into a distance — the length of a 3D vector from the satellite to you. One satellite narrows you down to a sphere of possible positions; a second satellite narrows that to a circle; a third pins you to (almost) one point, and a fourth cleans up the clock error. Four distance calculations, all built on \sqrt{v_x^2+v_y^2+v_z^2}, and your map app knows exactly where you're standing.

The same three numbers show up under the hood of every video game and CAD program too: every character, camera and prop has its position stored as one 3D vector, updated dozens of times a second as you move around the scene. A modern game might be juggling millions of these vectors at once — one for every corner of every 3D model on screen — and every single one of them is stored, added and measured exactly the way this page describes: three numbers, one extra term in every formula, nothing more mysterious than that.