Vectors in Space

Arrows in three dimensions: the dot product that measures alignment, the cross product that measures area, and the lines and planes they describe

Vectors in Space

An arrow in space is three numbers. Two ways of multiplying arrows turn those numbers into geometry: the dot product measures how much two arrows agree, and the cross product builds a third arrow standing perpendicular to both. With them, lines and planes in space become single equations you can solve.

The Dot Product

Drag the tips of u and v. Watch the shadow of v on the line of u, and see the same number come out of two very different recipes.

4.75
u · v
48.8°
angle θ between u and v
1.83
comp_u v = u·v / |u| (signed shadow)
2.60, 2.77
|u|, |v|
u·v = u₁v₁ + u₂v₂ + u₃v₃ = 2.50·1.20 + 0.50·2.00 + 0.50·1.50 = 4.750
|u||v| cos θ = 2.598 × 2.773 × cos(48.8°) = 4.750
The angle is acute (49° < 90°), so cos θ > 0 and u · v is positive: v leans along u, and its shadow points the same way as u.

Drag a coloured tip to move it; drag anywhere else to turn the view. In space mode a tip slides in the plane facing you, so turn the view to push it in a new direction. The violet arrow is proj_u v = (u·v / |u|²) u, and the dashed segment is the dropped perpendicular. “Make perpendicular” subtracts that shadow from v, one step of the Gram–Schmidt process.

Go deeper:Why the Two Formulas Agree

The dot product of u = (u₁, u₂, u₃) and v = (v₁, v₂, v₃) is u·v = u₁v₁ + u₂v₂ + u₃v₃. It is symmetric, it distributes over addition, and u·u = |u|². The law of cosines applied to the triangle with sides u, v and v − u says |v − u|² = |u|² + |v|² − 2|u||v| cos θ. Expanding the left side with the dot product gives |u|² + |v|² − 2 u·v. Compare the two: u·v = |u||v| cos θ.

So the sign of u·v tells you the kind of angle at a glance: positive for acute, zero for a right angle, negative for obtuse. The scalar projection comp_u v = u·v/|u| is the signed length of the shadow of v on the line of u, and the vector projection proj_u v = (u·v/|u|²) u is that shadow as an arrow. Subtracting it leaves the part of v perpendicular to u, the basic step of the Gram–Schmidt process.

Physics uses the dot product for work. A constant force F pushing an object through a displacement d does work W = F·d = |F||d| cos θ. Only the component of the force along the motion counts: pulling a sledge with a rope at 30° to the ground does work |F||d| cos 30°, and a force perpendicular to the motion, like the tension in a string whirling a stone in a circle, does no work at all.

The Cross Product

u × v stands perpendicular to u and v, as long as the area of the parallelogram they span. Swap them to flip it, and add a third vector w to measure a volume.

(0.1, −0.6, 3.4)
u × v (rounded)
3.415
|u × v| = area of the parallelogram
3.415
|u||v| sin θ (the same)
—
w · (u × v) = signed volume
u × v =
ijk2.00.40.00.61.80.3
i: u₂v₃ − u₃v₂ = 0.40·0.30 − 0.00·1.80 = 0.12
j: u₃v₁ − u₁v₃ = 0.00·0.60 − 2.00·0.30 = −0.60
k: u₁v₂ − u₂v₁ = 2.00·1.80 − 0.40·0.60 = 3.36
u × v is perpendicular to both (u·(u×v) = 0.00, v·(u×v) = 0.00). Curl the fingers of your right hand from u towards v and your thumb points along u × v.

Drag a coloured tip to move that vector in the plane facing you; drag elsewhere to turn the view. Swapping u and v reverses the curl and flips u × v to point the other way: v × u = −(u × v). The dashed green segment is the height of the box above the parallelogram, |w · n̂|, so volume = base area × height.

Go deeper:Area, Orientation and Volume

The cross product is u × v = (u₂v₃ − u₃v₂, u₃v₁ − u₁v₃, u₁v₂ − u₂v₁), most easily remembered as the determinant with rows i j k, u and v, expanded along the first row. A direct calculation shows u·(u × v) = 0 and v·(u × v) = 0, so it is perpendicular to both, and that |u × v|² = |u|²|v|² − (u·v)², which is |u|²|v|²(1 − cos²θ). Hence |u × v| = |u||v| sin θ: base |u| times height |v| sin θ, the area of the parallelogram.

Two arrows are perpendicular to the parallelogram; the formula picks the one given by the right-hand rule, so that i × j = k. Swapping the rows of a determinant changes its sign, so v × u = −(u × v): the cross product is anticommutative, and u × u = 0. It is also not associative: (i × i) × j = 0 but i × (i × j) = −j.

The scalar triple product w·(u × v) is the determinant with rows u, v, w. Its absolute value is the volume of the parallelepiped on u, v and w (base area |u × v| times height |w| |cos φ|, where φ is the angle between w and u × v), and its sign says whether u, v, w is right-handed. It is zero exactly when the three vectors lie in one plane. In physics the cross product gives torque r × F and angular momentum r × p, quantities that have an axis as well as a size.

Lines and Planes

A plane is a point and a normal; a line is a point and a direction. Move them and watch where the line breaks through, and how far the green point is from the plane.

0.87
t where the line meets the plane
(−1.0, −0.9, 1.2)
crossing point
−1.20
n · d (0 means parallel)
1.709
distance from X to the plane
plane: n·(X − P₀) = 0, i.e. 0.60x + 0.40y + 1.60z = 0.96
line: x = −2.00 + 1.20t, y = −1.60 + 0.80t, z = 2.40 − 1.40t
meets where n·(Q + t d − P₀) = 0: t = n·(P₀ − Q)/(n·d) = −1.04/(−1.20) = 0.87
distance = |n·(X − P₀)|/|n| = |3.00|/1.755 = 1.709
The line crosses the plane once, at t = 0.87. Since n·d ≠ 0, the height above the plane, n·(r(t) − P₀), changes steadily with t and passes through 0 exactly once. X is on the side n points to.

Drag P₀, Q or X in the plane facing you, or use the sliders. The plane patch is drawn as a square around P₀, but the plane goes on for ever, and so does the line. Scaling n or d changes the numbers in the equations but not the plane, the line or the distance.

Go deeper:One Equation for a Plane

A point X lies on the plane through P₀ with normal n exactly when X − P₀ is perpendicular to n: n·(X − P₀) = 0. Writing n = (a, b, c) and X = (x, y, z) gives the familiar a x + b y + c z = d with d = n·P₀. The coefficients of x, y and z are a normal vector, so you can read the plane’s tilt straight off its equation, and two planes are parallel when their normals are.

A line needs a point Q and a direction d: r(t) = Q + t d, or in coordinates x = q₁ + d₁t, y = q₂ + d₂t, z = q₃ + d₃t. Substituting into the plane’s equation leaves one linear equation in t, n·(Q − P₀) + t n·d = 0. If n·d ≠ 0 it has exactly one solution. If n·d = 0 the line is parallel to the plane, and either every t works (the line lies in the plane) or none does.

The distance from X to the plane is the length of the shadow of X − P₀ on the normal: |n·(X − P₀)|/|n|. Dividing by |n| makes the answer independent of how long a normal you chose. The same idea, a projection onto a well-chosen direction, gives the distance between two skew lines: project the vector joining them onto the cross product of their directions.

Key Takeaways

  • u·v = u₁v₁ + u₂v₂ + u₃v₃ = |u||v| cos θ, so its sign tells acute, right or obtuse.
  • u × v is perpendicular to u and v, with length equal to the area of their parallelogram.
  • The triple product w·(u × v) is the signed volume of the parallelepiped on u, v and w.
  • A plane is n·(X − P₀) = 0, and the distance to it is |n·(X − P₀)|/|n|.

Spot a mistake or have an idea?

Search