TExcelTAD
Home › Calculus in Depth › The Cross Product

The Cross Product

The cross product takes two vectors in R3\mathbb{R}^3 and returns a third vector perpendicular to both. Its length is the area of the parallelogram they span, and its direction follows the right-hand rule. This lesson defines it with determinants, proves its geometric properties, and builds the scalar triple product, which gives volumes and tests for coplanarity.

For a gentler first pass, see Dot and Cross Products.

Definition via determinants

A 2×22 \times 2 determinant is ∣abcd∣=ad−bc\begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc. For a=⟨a1,a2,a3⟩\mathbf{a} = \langle a_1, a_2, a_3 \rangle and b=⟨b1,b2,b3⟩\mathbf{b} = \langle b_1, b_2, b_3 \rangle,

a×b=∣ijka1a2a3b1b2b3∣=⟨a2b3−a3b2, a3b1−a1b3, a1b2−a2b1⟩\mathbf{a} \times \mathbf{b} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3 \end{vmatrix} = \langle a_2b_3 - a_3b_2,\ a_3b_1 - a_1b_3,\ a_1b_2 - a_2b_1 \rangle

The "determinant" with i,j,k\mathbf{i}, \mathbf{j}, \mathbf{k} in its first row is a memory aid: expand along that row. The cross product exists only in R3\mathbb{R}^3 (and, in a weaker form, R7\mathbb{R}^7). In 2D, the scalar a1b2−a2b1a_1b_2 - a_2b_1 plays its role.

Geometric properties

Theorem 1. a×b\mathbf{a} \times \mathbf{b} is orthogonal to both a\mathbf{a} and b\mathbf{b}.

Proof. Expand: a⋅(a×b)=a1(a2b3−a3b2)+a2(a3b1−a1b3)+a3(a1b2−a2b1)\mathbf{a} \cdot (\mathbf{a} \times \mathbf{b}) = a_1(a_2b_3 - a_3b_2) + a_2(a_3b_1 - a_1b_3) + a_3(a_1b_2 - a_2b_1). The six terms cancel in pairs, so the sum is 0. The same calculation works for b\mathbf{b}. ∎

Theorem 2. ∣a×b∣=∣a∣ ∣b∣sin⁡θ\lvert \mathbf{a} \times \mathbf{b} \rvert = \lvert \mathbf{a} \rvert \, \lvert \mathbf{b} \rvert \sin\theta, where θ∈[0,π]\theta \in [0, \pi] is the angle between a\mathbf{a} and b\mathbf{b}.

Proof. Expanding both sides gives Lagrange's identity:

∣a×b∣2=∣a∣2∣b∣2−(a⋅b)2\lvert \mathbf{a} \times \mathbf{b} \rvert^2 = \lvert \mathbf{a} \rvert^2 \lvert \mathbf{b} \rvert^2 - (\mathbf{a} \cdot \mathbf{b})^2

Substitute a⋅b=∣a∣∣b∣cos⁡θ\mathbf{a} \cdot \mathbf{b} = \lvert \mathbf{a} \rvert \lvert \mathbf{b} \rvert \cos\theta: ∣a×b∣2=∣a∣2∣b∣2(1−cos⁡2θ)=∣a∣2∣b∣2sin⁡2θ\lvert \mathbf{a} \times \mathbf{b} \rvert^2 = \lvert \mathbf{a} \rvert^2 \lvert \mathbf{b} \rvert^2 (1 - \cos^2\theta) = \lvert \mathbf{a} \rvert^2 \lvert \mathbf{b} \rvert^2 \sin^2\theta. Take the square root, using sin⁡θ≥0\sin\theta \ge 0 on [0,π][0, \pi]. ∎

Corollaries.

  • ∣a×b∣\lvert \mathbf{a} \times \mathbf{b} \rvert is the area of the parallelogram spanned by a\mathbf{a} and b\mathbf{b} (base ∣a∣\lvert \mathbf{a} \rvert, height ∣b∣sin⁡θ\lvert \mathbf{b} \rvert \sin\theta). Half of it is the area of the triangle.
  • Nonzero vectors a\mathbf{a} and b\mathbf{b} are parallel if and only if a×b=0\mathbf{a} \times \mathbf{b} = \mathbf{0}.

The direction is fixed by the right-hand rule: curl your fingers from a\mathbf{a} to b\mathbf{b} through θ\theta, and your thumb points along a×b\mathbf{a} \times \mathbf{b}. For the basis vectors, 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}.

Algebraic rules (and non-rules)

Rule Note
a×b=−(b×a)\mathbf{a} \times \mathbf{b} = -(\mathbf{b} \times \mathbf{a}) anti-commutative: order matters
(ca)×b=c(a×b)=a×(cb)(c\mathbf{a}) \times \mathbf{b} = c(\mathbf{a} \times \mathbf{b}) = \mathbf{a} \times (c\mathbf{b})
a×(b+c)=a×b+a×c\mathbf{a} \times (\mathbf{b} + \mathbf{c}) = \mathbf{a} \times \mathbf{b} + \mathbf{a} \times \mathbf{c} distributive
a×a=0\mathbf{a} \times \mathbf{a} = \mathbf{0}
(a×b)×c≠a×(b×c)(\mathbf{a} \times \mathbf{b}) \times \mathbf{c} \ne \mathbf{a} \times (\mathbf{b} \times \mathbf{c}) in general not associative: (i×i)×j=0(\mathbf{i} \times \mathbf{i}) \times \mathbf{j} = \mathbf{0} but i×(i×j)=−j\mathbf{i} \times (\mathbf{i} \times \mathbf{j}) = -\mathbf{j}
a×(b×c)=(a⋅c)b−(a⋅b)c\mathbf{a} \times (\mathbf{b} \times \mathbf{c}) = (\mathbf{a} \cdot \mathbf{c})\mathbf{b} - (\mathbf{a} \cdot \mathbf{b})\mathbf{c} the "BAC − CAB" rule
python · try it yourself
import numpy as np

a, b = np.array([2.0, -1.0, 3.0]), np.array([1.0, 4.0, 0.0])
c = np.cross(a, b)
print("a x b =", c, "  b x a =", np.cross(b, a))
print("orthogonal:", c @ a, c @ b)
lhs = np.linalg.norm(c) ** 2
rhs = (a @ a) * (b @ b) - (a @ b) ** 2
print("|a x b|^2 =", round(float(lhs), 10), " Lagrange:", float(rhs))
print("triangle area =", round(float(np.linalg.norm(c)) / 2, 4))

i, j = np.array([1, 0, 0]), np.array([0, 1, 0])
print("(i x i) x j =", np.cross(np.cross(i, i), j), "  i x (i x j) =", np.cross(i, np.cross(i, j)))
a x b = [-12.   3.   9.]   b x a = [12. -3. -9.]
orthogonal: 0.0 0.0
|a x b|^2 = 234.0  Lagrange: 234.0
triangle area = 7.6485
(i x i) x j = [0 0 0]   i x (i x j) = [ 0 -1  0]

The scalar triple product

a⋅(b×c)=∣a1a2a3b1b2b3c1c2c3∣\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = \begin{vmatrix} a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3 \\ c_1 & c_2 & c_3 \end{vmatrix}

Theorem 3. ∣a⋅(b×c)∣\lvert \mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) \rvert is the volume of the parallelepiped with edges a\mathbf{a}, b\mathbf{b} and c\mathbf{c}.

Proof. The base is the parallelogram on b\mathbf{b} and c\mathbf{c}, with area ∣b×c∣\lvert \mathbf{b} \times \mathbf{c} \rvert. The height is the length of the projection of a\mathbf{a} onto the base normal b×c\mathbf{b} \times \mathbf{c}, which is ∣a∣∣cos⁡φ∣\lvert \mathbf{a} \rvert \lvert \cos\varphi \rvert, where φ\varphi is the angle between a\mathbf{a} and b×c\mathbf{b} \times \mathbf{c}. So the volume is ∣b×c∣∣a∣∣cos⁡φ∣=∣a⋅(b×c)∣\lvert \mathbf{b} \times \mathbf{c} \rvert \lvert \mathbf{a} \rvert \lvert \cos\varphi \rvert = \lvert \mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) \rvert. ∎

So three vectors are coplanar exactly when a⋅(b×c)=0\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = 0. The sign gives the orientation: positive when a,b,c\mathbf{a}, \mathbf{b}, \mathbf{c} form a right-handed system. The triple product is cyclic, a⋅(b×c)=b⋅(c×a)=c⋅(a×b)\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = \mathbf{b} \cdot (\mathbf{c} \times \mathbf{a}) = \mathbf{c} \cdot (\mathbf{a} \times \mathbf{b}), because cyclically permuting the rows of a determinant does not change it.

Torque. A force F\mathbf{F} applied at position r\mathbf{r} relative to a pivot produces torque τ=r×F\boldsymbol{\tau} = \mathbf{r} \times \mathbf{F}, with ∣τ∣=∣r∣∣F∣sin⁡θ\lvert \boldsymbol{\tau} \rvert = \lvert \mathbf{r} \rvert \lvert \mathbf{F} \rvert \sin\theta. Only the perpendicular part of the force turns the wrench.

python · try it yourself
import numpy as np

a, b, c = np.array([1.0, 2.0, 0.0]), np.array([0.0, 1.0, 3.0]), np.array([2.0, 0.0, 1.0])
vol = a @ np.cross(b, c)
print("a·(b×c) =", vol, "  det =", round(float(np.linalg.det(np.array([a, b, c]))), 10))
print("cyclic b·(c×a) =", b @ np.cross(c, a))

d = 2 * a - 3 * b                                   # lies in the plane of a and b
print("coplanar a, b, 2a-3b:", a @ np.cross(b, d))

r, F = np.array([0.3, 0.0, 0.0]), np.array([0.0, 40.0, -10.0])   # m, N
print("torque r x F =", np.cross(r, F) + 0.0, " |τ| =", round(float(np.linalg.norm(np.cross(r, F))), 4), "N·m")
a·(b×c) = 13.0   det = 13.0
cyclic b·(c×a) = 13.0
coplanar a, b, 2a-3b: 0.0
torque r x F = [ 0.  3. 12.]  |τ| = 12.3693 N·m

In software

  • Surface normals and winding. A triangle with vertices P0,P1,P2P_0, P_1, P_2 has normal n=(P1−P0)×(P2−P0)\mathbf{n} = (P_1 - P_0) \times (P_2 - P_0). Swapping two vertices flips n\mathbf{n}. GPUs use this winding order (counter-clockwise = front by default in OpenGL) to cull back faces, so a mesh exported with the wrong winding renders inside-out (Cross Product in games).
  • Handedness. The formula is the same in left- and right-handed engines, but the picture flips: in a left-handed system a×b\mathbf{a} \times \mathbf{b} points the "other" way under the right-hand rule. That is why the same code can produce mirrored cameras after an engine port (Handedness).
  • Orientation tests. The 2D cross product sign answers "is point CC left of line ABAB?", the core of convex hulls, polygon triangulation and segment intersection. In 3D, the triple-product sign tells which side of a plane a point lies on.
  • Physics. Angular velocity, torque and the velocity of a point on a spinning body (v=ω×r\mathbf{v} = \boldsymbol{\omega} \times \mathbf{r}) are all cross products (Rotation Dynamics).

Exercises

Exercise 1: Compute and check

Compute ⟨1,0,2⟩×⟨3,−1,1⟩\langle 1, 0, 2 \rangle \times \langle 3, -1, 1 \rangle and verify that the result is orthogonal to both vectors.

Answer

⟨2,5,−1⟩\langle 2, 5, -1 \rangle

Solution
x:0⋅1−2⋅(−1)=2y:2⋅3−1⋅1=5z:1⋅(−1)−0⋅3=−1⟨2,5,−1⟩⋅⟨1,0,2⟩=2+0−2=0;⟨2,5,−1⟩⋅⟨3,−1,1⟩=6−5−1=0\begin{aligned} x&: 0 \cdot 1 - 2 \cdot (-1) = 2 \\ y&: 2 \cdot 3 - 1 \cdot 1 = 5 \\ z&: 1 \cdot (-1) - 0 \cdot 3 = -1 \\ &\langle 2, 5, -1 \rangle \cdot \langle 1, 0, 2 \rangle = 2 + 0 - 2 = 0; \quad \langle 2, 5, -1 \rangle \cdot \langle 3, -1, 1 \rangle = 6 - 5 - 1 = 0 \end{aligned}

Exercise 2: Triangle area

Find the area of the triangle with vertices P(1,1,0)P(1, 1, 0), Q(3,1,2)Q(3, 1, 2), R(1,4,1)R(1, 4, 1).

Answer

19≈4.359\sqrt{19} \approx 4.359

Solution
PQ→=⟨2,0,2⟩,PR→=⟨0,3,1⟩PQ→×PR→=⟨0⋅1−2⋅3,2⋅0−2⋅1,2⋅3−0⋅0⟩=⟨−6,−2,6⟩∣PQ→×PR→∣=36+4+36=76=219area=12⋅219=19≈4.359\begin{aligned} \overrightarrow{PQ} &= \langle 2, 0, 2 \rangle, \qquad \overrightarrow{PR} = \langle 0, 3, 1 \rangle \\ \overrightarrow{PQ} \times \overrightarrow{PR} &= \langle 0 \cdot 1 - 2 \cdot 3, 2 \cdot 0 - 2 \cdot 1, 2 \cdot 3 - 0 \cdot 0 \rangle = \langle -6, -2, 6 \rangle \\ \lvert \overrightarrow{PQ} \times \overrightarrow{PR} \rvert &= \sqrt{36 + 4 + 36} = \sqrt{76} = 2\sqrt{19} \\ \text{area} &= \tfrac{1}{2} \cdot 2\sqrt{19} = \sqrt{19} \approx 4.359 \end{aligned}

Exercise 3: Are four points coplanar?

Are A(0,0,0)A(0, 0, 0), B(1,2,3)B(1, 2, 3), C(2,1,0)C(2, 1, 0) and D(3,3,3)D(3, 3, 3) in one plane?

Answer

Yes: AB→⋅(AC→×AD→)=0\overrightarrow{AB} \cdot (\overrightarrow{AC} \times \overrightarrow{AD}) = 0.

Solution
AC→×AD→=⟨1⋅3−0⋅3,0⋅3−2⋅3,2⋅3−1⋅3⟩=⟨3,−6,3⟩AB→⋅⟨3,−6,3⟩=3−12+9=0\begin{aligned} \overrightarrow{AC} \times \overrightarrow{AD} &= \langle 1 \cdot 3 - 0 \cdot 3, 0 \cdot 3 - 2 \cdot 3, 2 \cdot 3 - 1 \cdot 3 \rangle = \langle 3, -6, 3 \rangle \\ \overrightarrow{AB} \cdot \langle 3, -6, 3 \rangle &= 3 - 12 + 9 = 0 \end{aligned}

Indeed D=B+CD = B + C.

Exercise 4: Fix the winding (code)

A mesh triangle has vertices (0,0,0)(0,0,0), (0,1,0)(0,1,0), (1,0,0)(1,0,0), and the outward normal should point toward +z+z. Compute its normal, detect that the winding is wrong, and fix it by swapping two vertices.

Answer

The normal is ⟨0,0,−1⟩\langle 0, 0, -1 \rangle (wrong side). After swapping the last two vertices it is ⟨0,0,1⟩\langle 0, 0, 1 \rangle.

Solution
python · try it yourself
import numpy as np
tri = [np.array(v, float) for v in [(0, 0, 0), (0, 1, 0), (1, 0, 0)]]
normal = lambda t: np.cross(t[1] - t[0], t[2] - t[0])
print("normal:", normal(tri))
if normal(tri) @ np.array([0, 0, 1]) < 0:
    tri[1], tri[2] = tri[2], tri[1]
print("fixed :", normal(tri))
normal: [ 0.  0. -1.]
fixed : [0. 0. 1.]

Test yourself

What is j×i\mathbf{j} \times \mathbf{i}?

  1. k\mathbf{k}
  2. −k-\mathbf{k}
  3. 0\mathbf{0}
  4. i\mathbf{i}

∣a×b∣\lvert \mathbf{a} \times \mathbf{b} \rvert equals…

  1. ∣a∣∣b∣cos⁡θ\lvert \mathbf{a} \rvert \lvert \mathbf{b} \rvert \cos\theta
  2. the area of the parallelogram spanned by a\mathbf{a} and b\mathbf{b}
  3. the volume spanned by a\mathbf{a} and b\mathbf{b}
  4. a⋅b\mathbf{a} \cdot \mathbf{b}

a⋅(b×c)=0\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = 0 tells you that…

  1. a,b,c\mathbf{a}, \mathbf{b}, \mathbf{c} all have length 0
  2. a\mathbf{a} is parallel to b\mathbf{b}
  3. a,b,c\mathbf{a}, \mathbf{b}, \mathbf{c} are coplanar
  4. b×c=a\mathbf{b} \times \mathbf{c} = \mathbf{a}