Search

Search papers and lessons

Cross Product

Level 1 · 9 min read

The cross product takes two 3D vectors and returns a third vector that is perpendicular to both, with a length equal to the area of the parallelogram they span.

On this page

  • Colour = topic mix
  • Linear algebra
  • Sign in to see your progress

TL;DR

The cross product takes two vectors in three-dimensional space and produces a third vector. That new vector points straight out of the flat surface spanned by the first two, so it is perpendicular to both. Its length equals the area of the parallelogram those two vectors form.

The formula is a short list of multiplications and subtractions, and the direction follows a right-hand rule.

Where you'll see it: in 3D graphics for computing surface normals, in physics for torque and magnetic force, and in geometry for the area and normal of a flat patch.

Intuition

A direction made from two directions

Suppose you push on the end of a wrench. The force you apply is one vector, and the handle from the bolt to your hand is another. The turning effect, called torque, does not point along either of them. It points along the axis around which the bolt turns, which is perpendicular to both the handle and the push. The cross product is the tool that gives you that perpendicular direction.

It exists because the dot product, which you may already know, answers a different question. The Dot Product of two vectors is a single number that measures how much they point the same way. A dot product cannot give a direction. To get a new direction from two given ones, you need a second operation, and in three dimensions the cross product is that operation.

Why only in three dimensions?

In two dimensions, two vectors span the whole plane, so no direction is left that is perpendicular to both. In three dimensions, the set of vectors perpendicular to two non-parallel vectors is a line, and that line has exactly two unit directions, one for each side. The cross product picks one of them by a fixed rule. In higher dimensions the perpendicular set is bigger, so there is no single natural answer, and the cross product is usually replaced by the wedge product.

flowchart LR
  A[Vector a] --> C[Cross product a times b]
  B[Vector b] --> C
  C --> D[Perpendicular to a and b]
  C --> E[Length equals parallelogram area]
  C --> F[Direction from right-hand rule]

The math

Definition

Definition: Cross product

For vectors a=(a1,a2,a3)\mathbf{a} = (a_1, a_2, a_3) and b=(b1,b2,b3)\mathbf{b} = (b_1, b_2, b_3) in R3\mathbb{R}^3, the cross product is

a×b=(a2b3−a3b2a3b1−a1b3a1b2−a2b1).\mathbf{a} \times \mathbf{b} = \begin{pmatrix} a_2 b_3 - a_3 b_2 \\ a_3 b_1 - a_1 b_3 \\ a_1 b_2 - a_2 b_1 \end{pmatrix}.

The symbols a1,a2,a3a_1, a_2, a_3 are the three coordinates of a\mathbf{a}, and the same for b\mathbf{b}. The result is again a vector in three dimensions. Each component is a difference of two products, using the two coordinates other than the one being computed. The first component ignores the first coordinate, the second ignores the second, and the third ignores the third.

A helpful way to remember the pattern is a determinant with the unit vectors i,j,k\mathbf{i}, \mathbf{j}, \mathbf{k} across the top row. Expanding a 3×33 \times 3 Determinant along that row produces the same three components.

Three properties

Every cross product satisfies these identities. They are the facts you will use most.

  1. Perpendicularity. a⋅(a×b)=0\mathbf{a} \cdot (\mathbf{a} \times \mathbf{b}) = 0 and b⋅(a×b)=0\mathbf{b} \cdot (\mathbf{a} \times \mathbf{b}) = 0. The result is orthogonal to both inputs.
  2. Length. ∥a×b∥=∥a∥ ∥b∥sin⁡θ\|\mathbf{a} \times \mathbf{b}\| = \|\mathbf{a}\| \, \|\mathbf{b}\| \sin\theta, where θ\theta is the angle between a\mathbf{a} and b\mathbf{b}. The right side is the area of the parallelogram with sides a\mathbf{a} and b\mathbf{b}.
  3. Anticommutativity. b×a=−(a×b)\mathbf{b} \times \mathbf{a} = -(\mathbf{a} \times \mathbf{b}). Swapping the order reverses the direction.

The second property explains why parallel vectors give a zero cross product. If θ=0\theta = 0 or θ=180\theta = 180 degrees, then sin⁡θ=0\sin\theta = 0, and the parallelogram has no area. The first property explains the direction. The sign is fixed by the right-hand rule: point the fingers of your right hand along a\mathbf{a}, curl them toward b\mathbf{b} through the smaller angle, and the thumb points along a×b\mathbf{a} \times \mathbf{b}.

Triple product and volume

The scalar triple product a⋅(b×c)\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) gives the volume of the parallelepiped spanned by three vectors, up to sign. It equals the determinant of the matrix whose rows are a\mathbf{a}, b\mathbf{b} and c\mathbf{c}. This links the cross product to the determinant as a volume measure.

Worked examples

Example
Computing a cross product by hand

Take a=(1,2,3)\mathbf{a} = (1, 2, 3) and b=(4,5,6)\mathbf{b} = (4, 5, 6).

  1. First component: a2b3−a3b2=2⋅6−3⋅5=12−15=−3a_2 b_3 - a_3 b_2 = 2 \cdot 6 - 3 \cdot 5 = 12 - 15 = -3.
  2. Second component: a3b1−a1b3=3⋅4−1⋅6=12−6=6a_3 b_1 - a_1 b_3 = 3 \cdot 4 - 1 \cdot 6 = 12 - 6 = 6.
  3. Third component: a1b2−a2b1=1⋅5−2⋅4=5−8=−3a_1 b_2 - a_2 b_1 = 1 \cdot 5 - 2 \cdot 4 = 5 - 8 = -3.
  4. So a×b=(−3,6,−3)\mathbf{a} \times \mathbf{b} = (-3, 6, -3).

Check perpendicularity. a⋅(−3,6,−3)=−3+12−9=0\mathbf{a} \cdot (-3, 6, -3) = -3 + 12 - 9 = 0, and b⋅(−3,6,−3)=−12+30−18=0\mathbf{b} \cdot (-3, 6, -3) = -12 + 30 - 18 = 0. Both are zero, as required.

Check the area. The length is 9+36+9=54≈7.35\sqrt{9 + 36 + 9} = \sqrt{54} \approx 7.35. Using ∥a∥2∥b∥2−(a⋅b)2=14⋅77−322=1078−1024=54\|\mathbf{a}\|^2 \|\mathbf{b}\|^2 - (\mathbf{a} \cdot \mathbf{b})^2 = 14 \cdot 77 - 32^2 = 1078 - 1024 = 54, the same number appears, which confirms the length formula.

Interpretation: the parallelogram spanned by these two vectors has area about 7.35, and its normal points in the direction (−1,2,−1)(-1, 2, -1).

Example
The standard basis and the right-hand rule

Let i=(1,0,0)\mathbf{i} = (1, 0, 0) and j=(0,1,0)\mathbf{j} = (0, 1, 0). Using the formula with a1=1a_1 = 1, a2=0a_2 = 0, a3=0a_3 = 0 and b1=0b_1 = 0, b2=1b_2 = 1, b3=0b_3 = 0:

  1. First component: 0⋅0−0⋅1=00 \cdot 0 - 0 \cdot 1 = 0.
  2. Second component: 0⋅0−1⋅0=00 \cdot 0 - 1 \cdot 0 = 0.
  3. Third component: 1⋅1−0⋅0=11 \cdot 1 - 0 \cdot 0 = 1.

So i×j=(0,0,1)=k\mathbf{i} \times \mathbf{j} = (0, 0, 1) = \mathbf{k}. Swapping the order gives j×i=−k\mathbf{j} \times \mathbf{i} = -\mathbf{k}.

Interpretation: the three axes of a right-handed coordinate system obey i×j=k\mathbf{i} \times \mathbf{j} = \mathbf{k}, j×k=i\mathbf{j} \times \mathbf{k} = \mathbf{i} and k×i=j\mathbf{k} \times \mathbf{i} = \mathbf{j}. Reversing any pair flips the sign, which is the anticommutativity property in action.

Tradeoffs and failure modes

SituationProblemBetter choice
Two vectors in 2DThe cross product is not defined as a vectorUse the 2D scalar form a1b2−a2b1a_1 b_2 - a_2 b_1, which gives signed area
Vectors in four or more dimensionsThere is no unique perpendicular directionUse the wedge product or work with a matrix
Need the angle between vectorsThe cross product gives only the sine, and the sign depends on orientationUse the dot product for the cosine
Mixing up the signThe result depends on the order of the inputsFix the order and apply the right-hand rule consistently

A common failure is applying the cross product to the wrong kind of object. It acts on vectors, not on points. The difference of two points is a vector, so p−q\mathbf{p} - \mathbf{q} is a valid input, but adding two points is not meaningful. Another failure is forgetting that the result is only a direction when its length is nonzero. If the two inputs are parallel, the result is the zero vector, and no normal direction exists.

History

The modern vector form of the cross product came from the work of Josiah Willard Gibbs and Oliver Heaviside in the late 1800s. They wanted a compact way to write the forces and fields that Maxwell's equations described. Before that, the same operation appeared inside quaternions, which William Rowan Hamilton introduced in 1843. Hamilton's quaternion product contains both a dot part and a cross part, and the vector notation came from separating those parts. (Gibbs and Heaviside each developed vector analysis independently in the 1880s.)

Torque, angular momentum and the magnetic force on a moving charge are all cross products, and textbooks in physics and engineering use the notation for them. In computing, the same formula is used for normal calculations in 3D graphics.

Check yourself

QuestionRecall: what does the cross product of two vectors point along?Show answer

It points perpendicular to both input vectors. Which of the two perpendicular directions it picks is set by the right-hand rule, and the length is the area of the parallelogram spanned by the inputs.

QuestionComputation: find the cross product of (2, 0, 1) and (0, 3, 0).Show answer

Using the formula: the first component is 0⋅0−1⋅3=−30 \cdot 0 - 1 \cdot 3 = -3. The second is 1⋅0−2⋅0=01 \cdot 0 - 2 \cdot 0 = 0. The third is 2⋅3−0⋅0=62 \cdot 3 - 0 \cdot 0 = 6. So the result is (−3,0,6)(-3, 0, 6). Check: (2,0,1)⋅(−3,0,6)=−6+6=0(2, 0, 1) \cdot (-3, 0, 6) = -6 + 6 = 0, so the result is perpendicular to the first input as required.

QuestionWhy: why does the cross product of two parallel vectors equal the zero vector?Show answer

Parallel vectors span a line, not a parallelogram with area, so the area term is zero. Algebraically, if b=c a\mathbf{b} = c\,\mathbf{a}, every component of the formula has the form ai⋅caj−aj⋅caia_i \cdot c a_j - a_j \cdot c a_i, which is zero. Geometrically, sin⁡θ=0\sin\theta = 0 when the angle is zero or 180 degrees.

QuestionApplied: a flat triangle in a 3D scene has corners at (0, 0, 0), (2, 0, 0) and (0, 2, 0). What is its area?Show answer

The two edge vectors from the first corner are (2,0,0)(2, 0, 0) and (0,2,0)(0, 2, 0). Their cross product is (0⋅0−0⋅2,0⋅0−2⋅0,2⋅2−0⋅0)=(0,0,4)(0 \cdot 0 - 0 \cdot 2, 0 \cdot 0 - 2 \cdot 0, 2 \cdot 2 - 0 \cdot 0) = (0, 0, 4), with length 4. The parallelogram they span has area 4, so the triangle has area 2. This is the standard way to compute a triangle's area and its surface normal in a 3D mesh.

QuestionApplied: in a 3D renderer you have two edge vectors of a triangle and need the surface normal for lighting. Why do you use a cross product, and why would you normalise the result?Show answer

The cross product gives a vector perpendicular to the triangle's surface, which is the surface normal the lighting formula needs. Normalising it sets its length to 1 so that the lighting formula depends only on direction. Without normalising, a larger triangle would look brighter for the wrong reason, since its cross product is longer.

Sources

  • Wikipedia, "Cross product"
  • Gilbert Strang, Introduction to Linear Algebra, Wellesley-Cambridge Press