The 3D cross product (also called the 3D outer product or vector product) of two vectors \(\mathbf{a}\) and \(\mathbf{b}\) is defined in \(\mathbb{R}^3\) as a vector \(\mathbf{a}\times\mathbf{b}\) that is orthogonal to both \(\mathbf{a}\) and \(\mathbf{b}\). Its magnitude is
\[ \lvert \mathbf{a}\times\mathbf{b}\rvert=\lvert \mathbf{a}\rvert\,\lvert \mathbf{b}\rvert\sin\theta, \]
where \(\theta\) is the angle between \(\mathbf{a}\) and \(\mathbf{b}\) (so \(0\le\theta\le\pi\)). In this range, \(\sin\theta\ge 0\).
Vectors \(\mathbf{a}\) and \(\mathbf{b}\) span a plane; \(\mathbf{a}\times\mathbf{b}\) is perpendicular to that plane.
Geometrically, the length of the cross product \(\lvert \mathbf{a}\times\mathbf{b}\rvert\) equals the (signed) area of the parallelogram spanned by \(\mathbf{a}\) and \(\mathbf{b}\): base \(\lvert \mathbf{a}\rvert\) times height \(\lvert \mathbf{b}\rvert\sin\theta\). The direction of \(\mathbf{a}\times\mathbf{b}\) encodes the orientation of that area.
The parallelogram has base \(\lvert \mathbf{a}\rvert\) and height \(\lvert \mathbf{b}\rvert\sin\theta\), hence area \(\lvert \mathbf{a}\rvert\,\lvert \mathbf{b}\rvert\sin\theta\).
Reversing the inputs \(\mathbf{a}\) and \(\mathbf{b}\) inverts the orientation, so the cross product changes sign:
\[ \mathbf{b}\times\mathbf{a}=-(\mathbf{a}\times\mathbf{b}). \]
A useful special case is when both vectors have unit length. If \(\lvert \mathbf{a}\rvert=\lvert \mathbf{b}\rvert=1\), then
\[ \lvert \mathbf{a}\times\mathbf{b}\rvert=\sin\theta, \]
so \(\lvert \mathbf{a}\times\mathbf{b}\rvert=1\) exactly when \(\theta=90^\circ\) (because \(\sin\theta=1\) there).
An equivalent way to package direction & magnitude is to factor out a unit normal vector \(\hat{\mathbf{n}}\) perpendicular to both \(\mathbf{a}\) and \(\mathbf{b}\):
\[ \mathbf{a}\times\mathbf{b}=\hat{\mathbf{n}}\,\lvert \mathbf{a}\rvert\,\lvert \mathbf{b}\rvert\sin\theta. \]
From this it is immediate that collinear (parallel) vectors satisfy \(\sin\theta=0\), and therefore
\[ \mathbf{a}\times\mathbf{b}=\mathbf{0}. \]
To derive the cross product, set \(\mathbf{c} = \mathbf{a}\times\mathbf{b}\). Since \(\mathbf{c}\) is orthogonal to both, \(\mathbf{a}\) and \(\mathbf{b}\), we know that
\[\mathbf{a}\cdot\mathbf{c} = a_xc_x+a_yc_y+a_zc_z=0\]
\[\mathbf{b}\cdot\mathbf{c} = b_xc_x+b_yc_y+b_zc_z=0\]
To eliminate \(c_z\) multiply the first equation by \(b_z\) and the second by \(a_z\), then subtract:
\[(a_xb_z-a_zb_x)c_x + (a_yb_z-a_zb_y)c_y=0\]
This equation has the form \(pc_x+qc_y=0\), for which an obvious solution is \(c_x=q\) and \(c_y=-p\). Thus
\[c_x=a_yb_z-a_zb_y\]\[c_y=a_zb_x-a_xb_z\]
and by substituting in the original equations:
\[c_z=a_xb_y-a_yb_x\]
Alternatively, we can derive the cross product using the determinant, similar to the calculation of the 2D perp-product or perp-roduct using the determinant with \(\hat{\mathbf{x}}, \hat{\mathbf{y}}\) and \(\hat{\mathbf{z}}\) being the orthonormal basis.:
\[\begin{array}{rl} \mathbf{a}\times\mathbf{b} &= \left|\begin{array}{ccc}\hat{\mathbf{x}}&\hat{\mathbf{y}}&\hat{\mathbf{z}}\\ a_x & a_y & a_z\\ b_x & b_y & b_z \end{array} \right|\\ &= \hat{\mathbf{x}}\left|\begin{array}{cc} a_y & a_z\\ b_y & b_z \end{array} \right| - \hat{\mathbf{y}}\left|\begin{array}{cc} a_x & a_z\\ b_x & b_z \end{array} \right| + \hat{\mathbf{z}}\left|\begin{array}{cc} a_x & a_y\\ b_x & b_y \end{array} \right|\\ &= \hat{\mathbf{x}}(a_yb_z-a_zb_y) - \hat{\mathbf{y}}(a_zb_x-a_xb_z) + \hat{\mathbf{z}}(a_xb_y-a_yb_x)\\ &= \left(\begin{array}{c} a_yb_z-a_zb_y\\ a_zb_x-a_xb_z\\ a_xb_y-a_yb_x \end{array}\right) \end{array}\]
Cross Product Properties
There are two possible choices to compute the cross product, each the negation of the other. This makes the cross product not commutative and thus anticommutative / antisymmetric. The one chosen is determined by the right-hand rule. If your index finger is \(\mathbf{a}\), your middle finger \(\mathbf{b}\) then your thumb is the positive cross product \(\mathbf{a}\times\mathbf{b}\).
\[\mathbf{a}\times\mathbf{b}=-(\mathbf{b}\times\mathbf{a}) = (-\mathbf{b})\times\mathbf{a}\]
Additive Distribution
\[\mathbf{a}\times(\mathbf{b}+\mathbf{c}) = \mathbf{a}\times\mathbf{b}+\mathbf{a}\times\mathbf{c}\]
\[(\mathbf{a}+\mathbf{b})\times\mathbf{c} = \mathbf{a}\times\mathbf{c}+\mathbf{b}\times\mathbf{c}\]
Großmann Identity or Double vector product
Left Association
\[(\mathbf{a}\times\mathbf{b})\times\mathbf{c} = (\mathbf{a}\cdot\mathbf{c})\mathbf{b} - (\mathbf{b}\cdot\mathbf{c})\mathbf{a}\]
Right Association
\[\mathbf{a}\times(\mathbf{b}\times\mathbf{c}) = (\mathbf{a}\cdot\mathbf{c})\mathbf{b} - (\mathbf{a}\cdot\mathbf{b})\mathbf{c}\]
Lie Identity
\[\mathbf{a}\times(\mathbf{b}\times\mathbf{c}) + \mathbf{c}\times(\mathbf{a}\times\mathbf{b}) + \mathbf{b}\times(\mathbf{c}\times\mathbf{a}) = \mathbf{0}\]
Dot-Cross Association
\[\mathbf{a}\cdot(\mathbf{b}\times\mathbf{c}) = (\mathbf{a}\times\mathbf{b})\cdot\mathbf{c} \]
Scalar Association
\[(\alpha\mathbf{a})\cdot(\beta\mathbf{b}) = (\alpha\beta)(\mathbf{a}\times\mathbf{b})\]
\[\alpha(\mathbf{a}\times\mathbf{b}) = (\alpha\mathbf{a})\times\mathbf{b} = \mathbf{a}\times(\alpha\mathbf{b})\]
Normality
\[(\mathbf{a}\times\mathbf{b})\cdot\mathbf{a} = (\mathbf{a}\times\mathbf{b})\cdot\mathbf{b} = 0\]
Nilpotent
\[\mathbf{a}\times\mathbf{a}=\mathbf{0}\]
\[\mathbf{a}\times\mathbf{0} = \mathbf{0}\times\mathbf{a} = \mathbf{0}\]
Jacobi Identity
\[\mathbf{a}\times(\mathbf{b}\times\mathbf{c}) + \mathbf{b}\times(\mathbf{c}\times\mathbf{a}) + \mathbf{c}\times(\mathbf{a}\times\mathbf{b}) = \mathbf{0}\]
Cyclic Permutations
The following cyclic permutations of cross products for the vectors \(\mathbf{a}\), \(\mathbf{b}\) and \(\mathbf{c}\) hold:
\[\mathbf{a}\times\mathbf{b}=\mathbf{b}\times\mathbf{c}=\mathbf{c}\times\mathbf{a}\]
\[\mathbf{a}\times\mathbf{b}+\mathbf{b}\times\mathbf{c}+\mathbf{c}\times\mathbf{a}=\mathbf{0}\]
Lagrange Identity
\[(\mathbf{a}\times\mathbf{b})\cdot(\mathbf{c}\times\mathbf{d}) = (\mathbf{a}\cdot\mathbf{c})(\mathbf{b}\cdot\mathbf{d}) - (\mathbf{a}\cdot\mathbf{d})(\mathbf{b}\cdot\mathbf{c})\]
From which follows that the square of the norm is
\[|\mathbf{a}\times\mathbf{b}|^2 = |\mathbf{a}|^2|\mathbf{b}|^2 - (\mathbf{a}\cdot\mathbf{b})^2\]
which is a nice connection between the dot-product and the cross product. Especially with normalized vectors this is
\[\underbrace{|\hat{\mathbf{a}}\times\hat{\mathbf{b}}|^2}_{=\sin^2\theta} = 1 - \underbrace{(\hat{\mathbf{a}}\cdot\hat{\mathbf{b}})^2}_{=\cos^2\theta}\]
But we can go further with the square of the norm:
\[\begin{array}{rl} |\mathbf{a}\times\mathbf{b}|^2 &= (\mathbf{a}\times\mathbf{b})\cdot(\mathbf{a}\times\mathbf{b})\\ &= (\mathbf{a}\cdot\mathbf{a})(\mathbf{b}\cdot\mathbf{b}) - (\mathbf{a}\cdot\mathbf{b})^2\\ &= |\mathbf{a}|^2|\mathbf{b}|^2(1-\cos^2\theta)\\ &= |\mathbf{a}|^2|\mathbf{b}|^2\sin^2\theta \end{array}\]
From which follows the definition of the cross product:
\[|\mathbf{a}\times\mathbf{b}|=|\mathbf{a}||\mathbf{b}|\sin\theta\]
Which works since the angle between \(\mathbf{a}\) and \(\mathbf{b}\) is always between 0° and 180° and therefore \(\sin\theta\geq 0\).
Scalar Triple Product
The dot-cross product \(\mathbf{a}\cdot(\mathbf{b}\times\mathbf{c})\) has the name scalar triple product and is denoted by \([\mathbf{a},\mathbf{b},\mathbf{c}]\). It computes the (signed) volume of the parallelepiped spanned by the vectors \(\mathbf{a}\), \(\mathbf{b}\) and \(\mathbf{c}\):
\[\begin{array}{rl} [\mathbf{a},\mathbf{b},\mathbf{c}] &= \det(\mathbf{a}\;\mathbf{b}\;\mathbf{c})\\ &= \mathbf{a}\cdot (\mathbf{b}\times \mathbf{c})\\ &= \mathbf{b}\cdot (\mathbf{c}\times \mathbf{a})\\ &= \mathbf{c}\cdot (\mathbf{a}\times \mathbf{b})\\ \end{array}\]
The sign is positive if \(\mathbf{a}\), \(\mathbf{b}\) and \(\mathbf{c}\) form a right handed set and negative if they form a left handed set.
Vector Triple Product
The vector triple product (also called the triple cross product) is the cross product of one vector with the cross product of the other two:
\[ \mathbf{a}\times(\mathbf{b}\times\mathbf{c}). \]
It is a vector, and it always lies in the plane spanned by the last two vectors (here: the plane of \(\mathbf{b}\) and \(\mathbf{c}\)). Using the standard expansion (BAC–CAB),
\[ \mathbf{a}\times(\mathbf{b}\times\mathbf{c}) = \mathbf{b}\,(\mathbf{a}\cdot\mathbf{c})-\mathbf{c}\,(\mathbf{a}\cdot\mathbf{b}). \]
Since the result is a linear combination of \(\mathbf{b}\) and \(\mathbf{c}\), it follows immediately that
\[ \mathbf{a}\times(\mathbf{b}\times\mathbf{c}) \in \operatorname{span}\{\mathbf{b},\mathbf{c}\}. \]
A closely related identity is obtained when the parentheses are placed differently:
\[ (\mathbf{a}\times\mathbf{b})\times\mathbf{c}. \]
This is again a vector, now lying in the plane spanned by the first two vectors \(\mathbf{a}\) and \(\mathbf{b}\), and it is perpendicular to \(\mathbf{c}\). Algebraically,
\[ (\mathbf{a}\times\mathbf{b})\times\mathbf{c} = \mathbf{b}\,(\mathbf{a}\cdot\mathbf{c})-\mathbf{a}\,(\mathbf{b}\cdot\mathbf{c}). \]
In particular, the expression is a linear combination of \(\mathbf{a}\) and \(\mathbf{b}\), hence
\[ (\mathbf{a}\times\mathbf{b})\times\mathbf{c} \in \operatorname{span}\{\mathbf{a},\mathbf{b}\}. \]
A useful special case: if \(\mathbf{c}\perp\mathbf{a}\) and \(\mathbf{c}\perp\mathbf{b}\) (equivalently \(\mathbf{c}\parallel \mathbf{a}\times\mathbf{b}\)), then \(\mathbf{a}\cdot\mathbf{c}=\mathbf{b}\cdot\mathbf{c}=0\) and therefore
\[ (\mathbf{a}\times\mathbf{b})\times\mathbf{c}=0. \]
Applications
Normal to a triangle
The most common application of the cross product is to generate a vector orthogonal to two other vectors. Suppose we have three points \(P\), \(Q\) and \(R\) and want to generate a unit vector \(\hat{\mathbf{n}}\) that is orthogonal to the plane formed by the three points.
Now \(\mathbf{a}=Q-P\) and \(\mathbf{b}=R-P\) and the normal can be found with \(\mathbf{n}=\mathbf{a}\times\mathbf{b}\). The direction of the normal is usually chosen to point from the inside to the outside of our object.
Interestingly, the length \(|\mathbf{n}|\) here equals twice the area of the triangle (since halve of the parallelogram formed by \(\mathbf{a}\) and \(\mathbf{b}\) is our triangle).
Equation of a plane given three points
Given three points \(P_1\), \(P_2\), \(P_3\), we can form two vectors \(\mathbf{v}_1=\vec{P_1P_2}\) and \(\mathbf{v}_2=\vec{P_1P_3}\) that lie in that plane. Now let \(P=(x,y,z)^T\) be a general point in space. \(P\) lies in the plane iff the vector \(\mathbf{v}_3=\vec{P_1P}\) lies in that plane, which is the case if and only if the volume of the parallelepiped spanned by \(\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3\) is zero and therefore the Scalar Triple Product:
\[[\mathbf{v_1},\mathbf{v_2},\mathbf{v_3}] = 0\]
This is enough to solve for the plane equation. Another method fixes a point, i.e. \(P_1\), in the plane and requiring that every vector in the plane will tail \(P_1\) and is normal to \(\mathbf{n}\). Therefore
\[\mathbf{n} = \mathbf{v}_1\times\mathbf{v}_2\]
is one normal to the plane. Now \(P\) is in the plane if and only if \(\mathbf{v}_3\) is orthogonal to \(\mathbf{n}\).
\[\mathbf{v}_3\cdot\mathbf{n} = 0\]
From there the typical plane equation can be read off, which has the form
\[(x-P_{1,x})\mathbf{n}_x+(y-P_{1,y})\mathbf{n}_y+(z-P_{1,z})\mathbf{n}_z=0\]
Distance between two lines
Consider two lines in space \(\ell_1\) and \(\ell_2\) such that point \(\ell_1\) passes through \(P_1\) and is parallel to vector \(\mathbf{v}_1\) and \(\ell_2\) passes through \(P_2\) and is parallel to \(\mathbf{v}_2\). We want to compute the smallest distance \(d\) between the two lines.
If the lines intersect, the distance is \(d=0\).
If they are parallel, then \(d\) corresponds to the distance between point \(P_2\) and \(\ell_1\):
\[d=\frac{\|\overrightarrow{P_1P_2}\times\mathbf{v}_1\|}{\|\mathbf{v}_1\|}\]
If the lines are not paralll and do not intersect (skew lines) then let \(\mathbf{n}=\mathbf{v}_1\times\mathbf{v}_2\) be a vector perpendicular to both lines. The projection of vector onto \(\mathbf{n}\) gives \(d\):
\[d=\frac{|\overrightarrow{P_1P_2}\cdot\mathbf{n}|}{\|\mathbf{n}\|}\]
Test if two vectors are parallel
Like the dot product, the cross product can be used to determine if two vectors \(\mathbf{a}\) and \(\mathbf{b}\) are parallel, which is the case when \(\mathbf{a}\times\mathbf{b}=\mathbf{0}\). This result comes directly from the definition of the length of the cross product, since \(\sin(\theta)=0\) for 0° and 180°. Calculating \(|\mathbf{a}\times\mathbf{b}|=0\) or simply \((\mathbf{a}\times\mathbf{b})\cdot(\mathbf{a}\times\mathbf{b})=0\) has the advantage of using less operations with nonnormalized vectors over the parallel-test using the dot-product.