3D Cross Product
The 3D cross product (aka 3D outer product or vector product) of two vectors \(\mathbf{a}\) and \(\mathbf{b}\) is only defined on three dimensional vectors as another vector \(\mathbf{a}\times\mathbf{b}\) that is orthogonal to the plane containing both \(\mathbf{a}\) and \(\mathbf{b}\) and has a magnitude of
\[|\mathbf{a}\times\mathbf{b}|=|\mathbf{a}| |\mathbf{b}| |\sin\theta|\]
where \(\theta\) is the angle between \(\mathbf{a}\) and \(\mathbf{b}\). The length of the cross product equals the area of the parallelogram bordered by the two vectors. Note that if \(\mathbf{a}\) and \(\mathbf{b}\) have a length of one, the length of the cross product is only one when \(\theta=90^\circ\), as \(\sin\theta=1\).
Another definition of the cross-product keeps the direction of the cross product in a unit vector \(\hat{\mathbf{n}}\) perpendicular to \(\mathbf{a}\) and \(\mathbf{b}\) such that:
\[\mathbf{a}\times\mathbf{b}=\hat{\mathbf{n}}|\mathbf{a}||\mathbf{b}|\sin\theta\]
From which is also obvious that collinear vectors \(\mathbf{a}\) and \(\mathbf{b}\) result in \(\sin\theta=0\) and thus \(\mathbf{a}\times\mathbf{b} = \mathbf{0}\)
To derive the cross product, we use the determinant, similar to the calculation of the 2D perp-product or perp-roduct using the determinant:
\[\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|\\ &= (a_yb_z-a_zb_y)\hat{\mathbf{x}} - (a_zb_x-a_xb_z)\hat{\mathbf{y}} + (a_xb_y-a_yb_x)\hat{\mathbf{z}}\\ &= \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}\]
With \(\hat{\mathbf{x}}, \hat{\mathbf{y}}\) and \(\hat{\mathbf{z}}\) being the orthonormal basis.
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}\]
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\).
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).
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.