Vectors in 3D
Nothing about vectors was really tied to two dimensions — that was just easy to draw. A vector
in three dimensions simply carries a third component:
\vec{v} = \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix}.
Every rule survives untouched. Add component by component, scale every component, 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}.
An arrow in space
Below is a 3D vector drawn in an isometric view, with its three component steps shown along the
x, y and z axes.
Adjust the sliders and watch the arrow move through space; the readout gives its length by the
three-term Pythagoras above.
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.