uu = sp.Matrix([1, 2, 3])
vv = sp.Matrix([4, 5, 6])
uu.cross(vv)\(\displaystyle \left[\begin{matrix}-3\\6\\-3\end{matrix}\right]\)
The dot product turns two vectors into a number. The cross product \(\bm a\times\bm b\) turns them into a new vector, and three properties define that vector completely.
The second property is the one we reach for most often: the cross product delivers a vector perpendicular to both of its factors. The first fixes its length. Since \(\sin\theta\ge 0\) for \(0\le\theta\le\pi\), the length is never negative, and for parallel vectors, \(\theta = 0\) or \(\theta = \pi\), the product is the zero vector. Two directions are perpendicular to both \(\bm a\) and \(\bm b\), and the third property picks one of them: curl the fingers of the right hand from \(\bm a\) towards \(\bm b\) through the angle \(\theta\), and the thumb points along \(\bm a\times\bm b\).
Two products we met earlier, \(ab\) for numbers and \(\bm a\cdot\bm b\) for vectors, may be written without a sign or with a dot. The cross product always has its \(\times\) written out, since it is a different operation from both. It obeys the rules
\[ \begin{aligned} \bm a\times\bm b &= -\bm b\times\bm a && \text{anticommutative law} \\ (s\bm a)\times\bm b &= \bm a\times(s\bm b) = s(\bm a\times\bm b) && \text{associative law for a scalar} \\ \bm a\times(\bm b + \bm c) &= \bm a\times\bm b + \bm a\times\bm c && \text{distributive law from the left} \\ (\bm a + \bm b)\times\bm c &= \bm a\times\bm c + \bm b\times\bm c && \text{distributive law from the right} \\ \bm a\times\bm 0 &= \bm 0\times\bm a = \bm 0 && \text{zero vector} \\ \bm a\times\bm a &= \bm 0 && \text{a vector with itself} \end{aligned} \tag{3.7.1}\]
for any vectors \(\bm a\), \(\bm b\), \(\bm c\) and any real number \(s\). The first row is the one to watch. Swapping the factors reverses the turn from the first vector to the second, so the thumb flips and the product changes sign: the cross product is anticommutative, and the order of the factors always matters. The two distributive laws hold, each with the factors kept in their order, and the last row is the first property with \(\theta = 0\).
The cross product only makes sense in \(\mathbb R^3\). We number the components of a vector \(1\), \(2\), \(3\) for \(x\), \(y\), \(z\), so that \(u_1 = u_x\), \(u_2 = u_y\) and \(u_3 = u_z\), and write \(\bm w = \bm u\times\bm v\) as a determinant with the basis vectors in its first column and the components of \(\bm u\) and \(\bm v\) in the other two,
\[ \bm w = \begin{bmatrix} u_1 \\ u_2 \\ u_3 \end{bmatrix}\times\begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \det\begin{bmatrix} \bm i & u_1 & v_1 \\ \bm j & u_2 & v_2 \\ \bm k & u_3 & v_3 \end{bmatrix} \]
The entries \(\bm i\), \(\bm j\), \(\bm k\) are vectors, but we expand the determinant along the first column and treat each of them like a scalar factor of its two-by-two minor. The minor of \(\bm j\) enters with a minus sign, which we absorb by swapping its two products,
\[ \bm w = \bm i\,({\color{#4a86e8} u_2v_3 - u_3v_2}) + \bm j\,({\color{#e0453a} u_3v_1 - u_1v_3}) + \bm k\,({\color{#b07a3c} u_1v_2 - u_2v_1}) \]
and the three coefficients form the column
\[ \boxed{ \bm u\times\bm v = \begin{bmatrix} \color{#4a86e8} u_2v_3 - u_3v_2 \\ \color{#e0453a} u_3v_1 - u_1v_3 \\ \color{#b07a3c} u_1v_2 - u_2v_1 \end{bmatrix} } \tag{3.7.2}\]
Figure 3.7.3 reads the column off the two vectors written side by side. Each row of \(\bm w\) leaves out its own index and crosses the other two rows of \(\bm u\) and \(\bm v\). The positive product takes the indices in the cyclic order \(1, 2, 3, 1\), as in \(u_2v_3\), \(u_3v_1\) and \(u_1v_2\), and the negative product swaps them. A plane problem has \(u_3 = v_3 = 0\), and then only the third row \(u_1v_2 - u_2v_1\) survives.
The determinant works because its signs follow the same rule as the products of the basis vectors, and the three properties give those products directly. The vectors \(\bm i\) and \(\bm j\) are perpendicular unit vectors, so \(|\bm i\times\bm j| = 1\cdot 1\cdot\sin 90^\circ = 1\); the product is perpendicular to both, so it is \(\pm\bm k\); and the system is right-handed, so it is \(+\bm k\). Two different basis vectors in the cyclic order \(\bm i, \bm j, \bm k, \bm i\) give the third one, the swapped order gives its negative, and equal factors give \(\bm 0\),
\[ \begin{aligned} \bm i\times\bm j &= \bm k, & \bm j\times\bm k &= \bm i, & \bm k\times\bm i &= \bm j \\ \bm j\times\bm i &= -\bm k, & \bm k\times\bm j &= -\bm i, & \bm i\times\bm k &= -\bm j \end{aligned} \]
With \(\bm u = u_1\bm i + u_2\bm j + u_3\bm k\) and \(\bm v\) written in the same way, the distributive laws of 3.7.1 expand \(\bm u\times\bm v\) into nine products. The three with equal basis vectors vanish, and the other six pair up behind each basis vector,
\[ \begin{aligned} \bm u\times\bm v &= {\color{#4a86e8} u_2v_3\,\bm j\times\bm k + u_3v_2\,\bm k\times\bm j} \\ &\quad {}+ {\color{#e0453a} u_3v_1\,\bm k\times\bm i + u_1v_3\,\bm i\times\bm k} \\ &\quad {}+ {\color{#b07a3c} u_1v_2\,\bm i\times\bm j + u_2v_1\,\bm j\times\bm i} \\ &= \bm i\,({\color{#4a86e8} u_2v_3 - u_3v_2}) + \bm j\,({\color{#e0453a} u_3v_1 - u_1v_3}) + \bm k\,({\color{#b07a3c} u_1v_2 - u_2v_1}) \end{aligned} \]
which is the expansion of the determinant, term by term. In each row the positive product has its basis vectors in the cyclic order, as \(\bm j\times\bm k\), and the negative product in the swapped order, as \(\bm k\times\bm j\). The determinant attaches its signs by the same rule: a product that takes the rows \(1, 2, 3\) in cyclic order, such as \(\bm i\,u_2v_3\), gets a plus sign, and one with two rows swapped, such as \(\bm i\,u_3v_2\), gets a minus sign.
The column must be perpendicular to both factors, the second property, and perpendicular means a zero dot product. Multiplying the rows of \(\bm w\) by those of \(\bm u\) gives six products, and they cancel in pairs,
\[ \begin{aligned} \bm w\cdot\bm u &= ({\color{#4a86e8} u_2v_3 - u_3v_2})\,u_1 + ({\color{#e0453a} u_3v_1 - u_1v_3})\,u_2 + ({\color{#b07a3c} u_1v_2 - u_2v_1})\,u_3 \\ &= (u_1u_2v_3 - u_2u_1v_3) + (u_2u_3v_1 - u_3u_2v_1) + (u_3u_1v_2 - u_1u_3v_2) \\ &= 0 \end{aligned} \]
and the same pairing gives \(\bm w\cdot\bm v = 0\). The length, the first property, follows from Lagrange’s identity together with \(\bm u\cdot\bm v = |\bm u||\bm v|\cos\theta\),
\[ \begin{aligned} |\bm u\times\bm v|^2 &= |\bm u|^2|\bm v|^2 - (\bm u\cdot\bm v)^2 \\ &= |\bm u|^2|\bm v|^2(1 - \cos^2\theta) \\ &= |\bm u|^2|\bm v|^2\sin^2\theta \end{aligned} \]
SymPy computes the cross product of two column vectors with .cross(), the first factor in front:
uu = sp.Matrix([1, 2, 3])
vv = sp.Matrix([4, 5, 6])
uu.cross(vv)\(\displaystyle \left[\begin{matrix}-3\\6\\-3\end{matrix}\right]\)
The order matters, and vv.cross(uu) gives the same column with every sign flipped. The method needs three components. For two plane vectors, the scalar cross product \(u_1v_2 - u_2v_1\) is the determinant of the matrix with the vectors as columns:
uu = sp.Matrix([3, 1])
vv = sp.Matrix([1, 2])
sp.Matrix.hstack(uu, vv).det()\(\displaystyle 5\)
With general components, .cross() reproduces the column 3.7.2, and SymPy confirms the perpendicularity and Lagrange’s identity.
u_1, u_2, u_3, v_1, v_2, v_3 = sp.symbols('u_1 u_2 u_3 v_1 v_2 v_3', real=True)
uu = sp.Matrix([u_1, u_2, u_3])
vv = sp.Matrix([v_1, v_2, v_3])
ww = uu.cross(vv)
perp_u = sp.expand(ww.dot(uu)) # zero if w is perpendicular to u
perp_v = sp.expand(ww.dot(vv))
# Lagrange's identity: the difference vanishes identically
lagrange = sp.expand(ww.dot(ww) - (uu.dot(uu)*vv.dot(vv) - uu.dot(vv)**2))The column and the three checks are
\[ \begin{aligned}\bm w = \bm u\times\bm v &= \left[\begin{matrix}u_{2} v_{3} - u_{3} v_{2}\\- u_{1} v_{3} + u_{3} v_{1}\\u_{1} v_{2} - u_{2} v_{1}\end{matrix}\right]\\ \bm w\cdot\bm u &= 0,\qquad \bm w\cdot\bm v = 0\\ |\bm w|^2 - \big(|\bm u|^2|\bm v|^2 - (\bm u\cdot\bm v)^2\big) &= 0\end{aligned} \]
Determine \(\bm a\times\bm b\) for \(\bm a = [3, 2, -4]^\mathsf{T}\) and \(\bm b = [1, -1, 2]^\mathsf{T}\), Figure 3.7.4.
By hand we set up the determinant with \(\bm i\), \(\bm j\), \(\bm k\) in the first column and expand it along that column, or read the rows directly off Figure 3.7.3,
\[ \begin{aligned} \bm a\times\bm b &= \det\begin{bmatrix} \bm i & 3 & 1 \\ \bm j & 2 & -1 \\ \bm k & -4 & 2 \end{bmatrix} = \begin{bmatrix} \color{#4a86e8} 2\cdot 2 - (-4)(-1) \\ \color{#e0453a} (-4)\cdot 1 - 3\cdot 2 \\ \color{#b07a3c} 3\cdot(-1) - 2\cdot 1 \end{bmatrix} = \begin{bmatrix} 0 \\ -10 \\ -5 \end{bmatrix} \end{aligned} \]
The dot products \((\bm a\times\bm b)\cdot\bm a = 0 - 20 + 20 = 0\) and \((\bm a\times\bm b)\cdot\bm b = 0 + 10 - 10 = 0\) confirm the result,
and by the first row of 3.7.1 the product in the other order is \(\bm b\times\bm a = -\bm a\times\bm b\).
aa = sp.Matrix([3, 2, -4])
bb = sp.Matrix([1, -1, 2])
axb = aa.cross(bb)
bxa = bb.cross(aa)SymPy agrees, and swapping the factors flips every component:
\[ \begin{aligned}\bm a\times\bm b &= \left[\begin{matrix}0\\-10\\-5\end{matrix}\right]\\ \bm b\times\bm a &= \left[\begin{matrix}0\\10\\5\end{matrix}\right]\end{aligned} \]
Practise each step below, by hand or in code. The Python switch turns an exercise into code: the same problem is solved with SymPy and checked when we run it.
Find a vector perpendicular to both \(\bm a = [3, 2, -4]^\mathsf{T}\) and \(\bm b = [1, -1, 2]^\mathsf{T}\), that is, a normal to the plane they span, Figure 3.7.5.
This is the typical use of the cross product. By the second property, \(\bm n = \bm a\times\bm b = [0, -10, -5]^\mathsf{T}\) from Example 1 is perpendicular to both, and so is every multiple \(s\bm n\). Often we want the unit normal \(\bm e_n = \bm n/|\bm n|\). The dot product checks the result,
\[ \bm n\cdot\bm a = 0\cdot 3 + (-10)\cdot 2 + (-5)(-4) = 0, \qquad \bm n\cdot\bm b = 0\cdot 1 + (-10)(-1) + (-5)\cdot 2 = 0 . \]
nn = aa.cross(bb)
ee_n = nn/nn.norm()Both dot products vanish, and the unit normal is
\[ \begin{aligned}\bm n\cdot\bm a &= 0,\qquad \bm n\cdot\bm b = 0\\ \bm e_n &= \left[\begin{matrix}0\\- \dfrac{2 \sqrt{5}}{5}\\- \dfrac{\sqrt{5}}{5}\end{matrix}\right]\end{aligned} \]
Two vectors \(\bm u\) and \(\bm v\) from one point span a parallelogram. Its base is \(|\bm u|\) and its height is \(|\bm v|\sin\theta\), Figure 3.7.9, so its area is \(|\bm u||\bm v|\sin\theta\), which is the length of \(\bm u\times\bm v\) by the first property:
\(A = |\bm u\times\bm v|\)
The triangle with two sides along \(\bm u\) and \(\bm v\) is half the parallelogram, \(A = \tfrac12|\bm u\times\bm v|\). Parallel vectors give \(\bm u\times\bm v = \bm 0\) and a zero area, as a flattened parallelogram should.
The column 3.7.2 is built from products of components, and the first property says its length is an area. In the plane we see why. Let \(\bm u = [u_1, u_2]^\mathsf{T}\) and \(\bm v = [v_1, v_2]^\mathsf{T}\). The rectangle around their parallelogram in Figure 3.7.7 has the sides \(u_1 + v_1\) and \(u_2 + v_2\), and cutting away two triangles of area \(\tfrac12u_1u_2\), two of area \(\tfrac12v_1v_2\) and two rectangles of area \(u_2v_1\) leaves the parallelogram,
\[ \begin{aligned} A &= (u_1 + v_1)(u_2 + v_2) - u_1u_2 - v_1v_2 - 2u_2v_1 \\ &= u_1v_2 - u_2v_1 \\ &= \det\begin{bmatrix} u_1 & v_1 \\ u_2 & v_2 \end{bmatrix} \end{aligned} \]
the determinant of the matrix with \(\bm u\) and \(\bm v\) as its columns.
In the figure the turn from \(\bm u\) to \(\bm v\) is counterclockwise. With the two swapped, the determinant changes sign, so it is a signed area: positive for a counterclockwise turn from the first column to the second, negative for a clockwise one. This is the right-hand rule seen from above. With both vectors in the \(xy\) plane of space, \(u_3 = v_3 = 0\), 3.7.2 keeps only its third row, \(\bm u\times\bm v = (u_1v_2 - u_2v_1)\,\bm k\), which points towards the viewer exactly when the turn is counterclockwise. Plane problems therefore drop the \(\bm k\) and keep the number: the cross product of two plane vectors is the scalar
\(\bm u\times\bm v = u_1v_2 - u_2v_1\)
the signed area of their parallelogram. It is positive when \(\bm v\) lies counterclockwise from \(\bm u\), negative when it lies clockwise, and zero when the two are parallel.
Grant Sanderson reads the same number as a scale factor. The matrix with the columns \(\bm u\) and \(\bm v\) carries \(\bm i\) to \(\bm u\) and \(\bm j\) to \(\bm v\), so it turns the unit square, of area \(1\), into the parallelogram, and it scales every other area by the same factor, the determinant.
In space the parallelogram of \(\bm u\) and \(\bm v\) is tilted, and each row of 3.7.2 is a plane determinant built from two of the three rows of \(\bm u\) and \(\bm v\). The third row \(u_1v_2 - u_2v_1\) uses only the \(x\) and \(y\) components, so it is the signed area \(A_{xy}\) of the shadow the parallelogram casts on the \(xy\) plane when we drop \(z\). The first row \(u_2v_3 - u_3v_2\) is the shadow \(A_{yz}\) on the \(yz\) plane, and the second row \(u_3v_1 - u_1v_3\) the shadow \(A_{zx}\) on the \(zx\) plane, read in the cyclic order \(z\), \(x\):
\[ \bm u\times\bm v = \begin{bmatrix} A_{yz} \\ A_{zx} \\ A_{xy} \end{bmatrix} \]
A shadow keeps the lengths along the line where its plane meets the plane of the parallelogram and shrinks the lengths across that line by the cosine of the angle \(\gamma\) between the two planes, which is also the angle between their normals. The normal of the \(xy\) plane is \(\bm k\), so with \(\bm e_n\) the unit normal of the parallelogram, \(A_{xy} = A\cos\gamma = A\,\bm e_n\cdot\bm k\), and in the same way \(A_{yz} = A\,\bm e_n\cdot\bm i\) and \(A_{zx} = A\,\bm e_n\cdot\bm j\). These are the three components of \(A\,\bm e_n\):
\(\bm u\times\bm v = A\,\bm e_n\)
The column computed from the determinant is the area of the parallelogram times its unit normal, which is the first and the second property at once. Its length gives a theorem of Pythagoras for areas, \(A^2 = A_{yz}^2 + A_{zx}^2 + A_{xy}^2\): the squares of the three shadows add up to the square of the true area.
Grant Sanderson builds the cross product along the same path in the video below, from the plane determinant to the vector in space.
The determinant also explains why the basis vectors sit in the first column. In space, the determinant of three columns is the signed volume of the parallelepiped they span, as the plane determinant is the signed area of the parallelogram. Put any vector \(\bm x\) in the first column where \(\bm i\), \(\bm j\), \(\bm k\) stood. The parallelepiped of \(\bm x\), \(\bm u\) and \(\bm v\) stands on the parallelogram of \(\bm u\) and \(\bm v\), of area \(A\), and its height is the part of \(\bm x\) along the unit normal, \(\bm e_n\cdot\bm x\), so its volume is \(A\,\bm e_n\cdot\bm x\). Expanding the same determinant along its first column gives
\[ \begin{aligned} \det\begin{bmatrix} x_1 & u_1 & v_1 \\ x_2 & u_2 & v_2 \\ x_3 & u_3 & v_3 \end{bmatrix} &= x_1(u_2v_3 - u_3v_2) + x_2(u_3v_1 - u_1v_3) + x_3(u_1v_2 - u_2v_1) \\ &= (\bm u\times\bm v)\cdot\bm x \end{aligned} \]
Both expressions hold for every \(\bm x\), and with \(\bm x = \bm i\), \(\bm j\), \(\bm k\) in turn they agree component by component, so \(\bm u\times\bm v = A\,\bm e_n\). The basis vectors in the first column leave \(\bm x\) open, and the expansion keeps the three numbers that multiply its components. Grant Sanderson tells this story with linear transformations in the follow-up video.
Determine the area of the parallelogram spanned by \(\bm u = [-2, 1, 3]^\mathsf{T}\) and \(\bm v = [1, 3, -2]^\mathsf{T}\), Figure 3.7.9.
The area is the length of the cross product,
\[ \bm u\times\bm v = \begin{bmatrix} \color{#4a86e8} 1\cdot(-2) - 3\cdot 3 \\ \color{#e0453a} 3\cdot 1 - (-2)(-2) \\ \color{#b07a3c} (-2)\cdot 3 - 1\cdot 1 \end{bmatrix} = \begin{bmatrix} -11 \\ -1 \\ -7 \end{bmatrix}, \qquad A = |\bm u\times\bm v| = \sqrt{121 + 1 + 49} = \sqrt{171} = 3\sqrt{19} . \]
uu = sp.Matrix([-2, 1, 3])
vv = sp.Matrix([1, 3, -2])
uxv = uu.cross(vv)
A = uxv.norm()SymPy gives the same area:
\[ \bm u\times\bm v = \left[\begin{matrix}-11\\-1\\-7\end{matrix}\right],\qquad A = |\bm u\times\bm v| = 3 \sqrt{19}\approx13.08 \]
Determine the area of the triangle with the corners \(P_1(2, 2, 0)\), \(P_2(-1, 0, 2)\) and \(P_3(0, 4, 3)\), Figure 3.7.10.
The triangle is half the parallelogram spanned by two of its sides. We take both from \(P_1\), each as head minus foot (Chapter 3.5),
\[ \begin{aligned} \bm a &= \bm r_{OP_2} - \bm r_{OP_1} = [-3, -2, 2]^\mathsf{T}, \qquad \bm b = \bm r_{OP_3} - \bm r_{OP_1} = [-2, 2, 3]^\mathsf{T}, \\ \bm a\times\bm b &= \begin{bmatrix} \color{#4a86e8} (-2)\cdot 3 - 2\cdot 2 \\ \color{#e0453a} 2\cdot(-2) - (-3)\cdot 3 \\ \color{#b07a3c} (-3)\cdot 2 - (-2)(-2) \end{bmatrix} = \begin{bmatrix} -10 \\ 5 \\ -10 \end{bmatrix}, \\ A &= \tfrac12|\bm a\times\bm b| = \tfrac12\sqrt{100 + 25 + 100} = \tfrac{15}{2} . \end{aligned} \]
rr_OP1 = sp.Matrix([2, 2, 0])
rr_OP2 = sp.Matrix([-1, 0, 2])
rr_OP3 = sp.Matrix([0, 4, 3])
aa = rr_OP2 - rr_OP1
bb = rr_OP3 - rr_OP1
A = aa.cross(bb).norm()/2The computed area is
\[ \begin{aligned}\bm a &= \left[\begin{matrix}-3\\-2\\2\end{matrix}\right],\qquad \bm b = \left[\begin{matrix}-2\\2\\3\end{matrix}\right],\qquad \bm a\times\bm b = \left[\begin{matrix}-10\\5\\-10\end{matrix}\right]\\ A &= \tfrac12|\bm a\times\bm b| = \dfrac{15}{2}\end{aligned} \]
Any two sides give the same area. From \(P_2\), say, the sides are \(-\bm a\) and \(\bm b - \bm a\), and \((-\bm a)\times(\bm b - \bm a) = -\bm a\times\bm b\) by 3.7.1, a vector of the same length.
Three vectors \(\bm u\), \(\bm v\) and \(\bm w\) from one point span a parallelepiped, Figure 3.7.12. Its base is the parallelogram of \(\bm v\) and \(\bm w\) with the area \(|\bm v\times\bm w|\), and its height \(h\) is the part of \(\bm u\) along the normal of the base. The normal is \(\bm v\times\bm w\), so with \(\varphi\) the angle between \(\bm u\) and \(\bm v\times\bm w\), \(h = |\bm u|\cos\varphi\), and the volume is
\[ V = |\bm v\times\bm w|\,|\bm u|\cos\varphi = \bm u\cdot(\bm v\times\bm w), \]
where we recognise the dot product of \(\bm u\) and \(\bm v\times\bm w\). The product \(\bm u\cdot(\bm v\times\bm w)\) is the scalar triple product. The determinant of 3.7.2 with \(\bm u\) in place of the basis vectors expands to exactly this dot product, \(u_1(v_2w_3 - v_3w_2) + u_2(v_3w_1 - v_1w_3) + u_3(v_1w_2 - v_2w_1)\), so the triple product is the determinant with the three vectors as columns,
\[ \bm u\cdot(\bm v\times\bm w) = \det\begin{bmatrix} u_1 & v_1 & w_1 \\ u_2 & v_2 & w_2 \\ u_3 & v_3 & w_3 \end{bmatrix} \tag{3.7.3}\]
The result carries a sign. It is positive when \(\bm u\) lies on the same side of the base as \(\bm v\times\bm w\), that is, when \(\bm u\), \(\bm v\), \(\bm w\) form a right-handed system. Three vectors can be ordered in \(3\cdot 2\cdot 1 = 6\) ways. A cyclic shift, \(\bm u\cdot(\bm v\times\bm w) = \bm v\cdot(\bm w\times\bm u) = \bm w\cdot(\bm u\times\bm v)\), keeps the sign, and a swap of two vectors reverses it, so three orders give the volume and three its negative. A zero triple product means a parallelepiped without height: the three vectors lie in one plane.
Determine the volume of the parallelepiped spanned by \(\bm u = [1, 1, 3]^\mathsf{T}\), \(\bm v = [4, 0, 0]^\mathsf{T}\) and \(\bm w = [1, 3, 0]^\mathsf{T}\), Figure 3.7.12, and the scalar triple product in all six orders.
The base lies in the \(xy\) plane, so its normal points along \(z\),
\[ \bm v\times\bm w = \begin{bmatrix} \color{#4a86e8} 0\cdot 0 - 0\cdot 3 \\ \color{#e0453a} 0\cdot 1 - 4\cdot 0 \\ \color{#b07a3c} 4\cdot 3 - 0\cdot 1 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 12 \end{bmatrix}, \qquad V = \bm u\cdot(\bm v\times\bm w) = 1\cdot 0 + 1\cdot 0 + 3\cdot 12 = 36 . \]
The figure gives a check: the base has the area \(|\bm v\times\bm w| = 12\), the height is \(h = u_z = 3\), and \(12\cdot 3 = 36\). The six orders follow from 3.7.3 with the columns permuted.
uu = sp.Matrix([1, 1, 3])
vv = sp.Matrix([4, 0, 0])
ww = sp.Matrix([1, 3, 0])
V = uu.dot(vv.cross(ww))
# the triple product p . (q x r) for every order of the three vectors
named = {r'\bm u': uu, r'\bm v': vv, r'\bm w': ww}
rows = []
for (p, P), (q, Q), (r, R) in itertools.permutations(named.items()):
rows.append(rf"{p}\cdot({q}\times {r}) &= {P.dot(Q.cross(R))}")The volume is \(V = 36\), and the six orders give
\[ \begin{aligned}\bm u\cdot(\bm v\times \bm w) &= 36 \\ \bm u\cdot(\bm w\times \bm v) &= -36 \\ \bm v\cdot(\bm u\times \bm w) &= -36 \\ \bm v\cdot(\bm w\times \bm u) &= 36 \\ \bm w\cdot(\bm u\times \bm v) &= 36 \\ \bm w\cdot(\bm v\times \bm u) &= -36\end{aligned} \]
The three cyclic orders \(\bm u\bm v\bm w\), \(\bm v\bm w\bm u\) and \(\bm w\bm u\bm v\) give \(+36\), and the three with two vectors swapped give \(-36\).
A vector need not start at the origin. Let \(\bm v\) start at the point \(A\), whose position vector is \(\bm r = \bm r_{OA}\), and form
\[ \bm c = \bm r\times\bm v . \]
By the three properties, \(\bm c\) is perpendicular to both \(\bm r\) and \(\bm v\), and its length is \(|\bm r||\bm v|\sin\theta = |\bm v|\,d\), where \(d = |\bm r|\sin\theta\) is the perpendicular distance from \(O\) to the line through \(A\) along \(\bm v\). The product depends on the point only through that line. Every point \(P\) on the line has the position vector \(\bm r_{OP} = \bm r + t\bm v\) for some number \(t\), and since \(\bm v\times\bm v = \bm 0\), the rules 3.7.1 give
\[ \bm r_{OP}\times\bm v = \bm r\times\bm v + t\,\bm v\times\bm v = \bm r\times\bm v . \]
The order matters here as everywhere: \(\bm r\) first, then \(\bm v\). In the plane, \(\bm c\) is the scalar \(r_1v_2 - r_2v_1\) of size \(|\bm v|\,d\), positive when \(\bm v\) turns counterclockwise about \(O\). The moments chapter applies this product, in the plane as the moment \(M = Fd\) of a force with a sign for its turning sense.
The vector \(\bm v = [-2, 1, -2]^\mathsf{T}\) starts at the point \(A(5, 0, 2)\), Figure 3.7.13. Determine \(\bm c = \bm r\times\bm v\), where \(\bm r\) is the position vector of \(A\).
With \(\bm r = \bm r_{OA} = [5, 0, 2]^\mathsf{T}\), 3.7.2 gives
\[ \bm c = \bm r\times\bm v = \begin{bmatrix} \color{#4a86e8} 0\cdot(-2) - 2\cdot 1 \\ \color{#e0453a} 2\cdot(-2) - 5\cdot(-2) \\ \color{#b07a3c} 5\cdot 1 - 0\cdot(-2) \end{bmatrix} = \begin{bmatrix} -2 \\ 6 \\ 5 \end{bmatrix}, \]
and it must be perpendicular to both factors, \(\bm c\cdot\bm r = 0\) and \(\bm c\cdot\bm v = 0\).
rr_OA = sp.Matrix([5, 0, 2])
vv = sp.Matrix([-2, 1, -2])
cc = rr_OA.cross(vv)The product and the two checks are
\[ \begin{aligned}\bm c &= \left[\begin{matrix}-2\\6\\5\end{matrix}\right]\\ \bm c\cdot\bm r &= 0,\qquad \bm c\cdot\bm v = 0\end{aligned} \]
The vector \(\bm v\) has the length \(6\) and starts at \(A(5, 0, 2)\), pointing towards \(B(3, 1, 0)\), Figure 3.7.14. Determine \(\bm v\) and \(\bm c = \bm r_{OA}\times\bm v\), and show that \(\bm r_{OB}\times\bm v\) gives the same vector.
A vector is its length times its unit vector (Chapter 3.5), and the unit vector from \(A\) to \(B\) is head minus foot divided by its length,
\[ \begin{aligned} \bm e_{AB} &= \frac{\bm r_{OB} - \bm r_{OA}}{|\bm r_{OB} - \bm r_{OA}|} = \frac{1}{3}\begin{bmatrix} -2 \\ 1 \\ -2 \end{bmatrix}, \qquad \bm v = 6\,\bm e_{AB} = \begin{bmatrix} -4 \\ 2 \\ -4 \end{bmatrix}, \\ \bm c &= \bm r_{OA}\times\bm v = \bm r_{OB}\times\bm v . \end{aligned} \]
The point \(B\) lies on the line through \(A\) along \(\bm v\), so both position vectors give the same product. The vector \(\bm v\) is twice the vector of Example 6, so by 3.7.1 \(\bm c\) is twice the product found there.
rr_OA = sp.Matrix([5, 0, 2])
rr_OB = sp.Matrix([3, 1, 0])
ee_AB = (rr_OB - rr_OA)/(rr_OB - rr_OA).norm()
vv = 6*ee_AB
cc = rr_OA.cross(vv)
cc_B = rr_OB.cross(vv) # from the other point on the lineBoth position vectors give the same product:
\[ \begin{aligned}\bm v &= \left[\begin{matrix}-4\\2\\-4\end{matrix}\right]\\ \bm r_{OA}\times\bm v &= \left[\begin{matrix}-4\\12\\10\end{matrix}\right],\qquad \bm r_{OB}\times\bm v = \left[\begin{matrix}-4\\12\\10\end{matrix}\right]\end{aligned} \]
Once \(\bm c = \bm r\times\bm v\) is known, we often want its part along an axis through \(O\) with the direction \(\bm a\). The projection from the dot product chapter, with the unit vector \(\bm e_a = \bm a/|\bm a|\), splits \(\bm c\) into two perpendicular parts,
\[ \begin{aligned} \bm c_{\parallel} &= (\bm c\cdot\bm e_a)\,\bm e_a, \\ \bm c_{\perp} &= \bm c - \bm c_{\parallel} , \end{aligned} \tag{3.7.4}\]
one along the axis and one across it. Both lie in the plane spanned by \(\bm c\) and \(\bm e_a\). The signed length of the part along the axis,
\(c_a = \bm e_a\cdot(\bm r\times\bm v)\)
is a scalar triple product, 3.7.3, with the unit vector \(\bm e_a\) as its first column. It is the volume of the parallelepiped spanned by \(\bm e_a\), \(\bm r\) and \(\bm v\), and it vanishes when the three lie in one plane, for instance when the line through \(A\) along \(\bm v\) meets the axis.
Split \(\bm c = \bm r_{OA}\times\bm v\) of Example 7 into its parts along and across the axis through \(O\) with the direction \(\bm a = [2, 3, -1]^\mathsf{T}\), Figure 3.7.16.
With \(\bm c = [-4, 12, 10]^\mathsf{T}\) from Example 7 and \(|\bm a|^2 = 14\), 3.7.4 gives
\[ \begin{aligned} \bm c\cdot\bm a &= -8 + 36 - 10 = 18, \\ \bm c_{\parallel} &= \frac{\bm c\cdot\bm a}{|\bm a|^2}\,\bm a = \frac{18}{14}\begin{bmatrix} 2 \\ 3 \\ -1 \end{bmatrix} = \frac{9}{7}\begin{bmatrix} 2 \\ 3 \\ -1 \end{bmatrix}, \\ \bm c_{\perp} &= \bm c - \bm c_{\parallel} = \frac{1}{7}\begin{bmatrix} -46 \\ 57 \\ 79 \end{bmatrix}, \end{aligned} \]
where \((\bm c\cdot\bm e_a)\bm e_a = (\bm c\cdot\bm a)\bm a/|\bm a|^2\) saves the square root. The two parts must be perpendicular, \(\bm c_{\parallel}\cdot\bm c_{\perp} = 0\), and add up to \(\bm c\).
aa = sp.Matrix([2, 3, -1])
ee_a = aa/aa.norm()
c_a = ee_a.dot(rr_OA.cross(vv)) # the scalar triple product e_a . (r x v)
cc_par = c_a*ee_a
cc_perp = cc - cc_parThe two parts, the signed length along the axis and the checks are
\[ \begin{aligned}\bm c_{\parallel} &= \tfrac{9}{7}\left[\begin{matrix}2\\3\\-1\end{matrix}\right],\qquad c_a = \bm e_a\cdot(\bm r\times\bm v) = \dfrac{9 \sqrt{14}}{7}\approx 4.811\\ \bm c_{\perp} &= \tfrac{1}{7}\left[\begin{matrix}-46\\57\\79\end{matrix}\right],\qquad |\bm c_{\perp}| \approx 15.39\\ \bm c_{\parallel}\cdot\bm c_{\perp} &= 0,\qquad \bm c_{\parallel} + \bm c_{\perp} - \bm c = \left[\begin{matrix}0 & 0 & 0\end{matrix}\right]\end{aligned} \]
Of the length \(|\bm c| \approx 16.1\), the part along the axis is \(c_a \approx 4.8\) and the part across it \(|\bm c_{\perp}| \approx 15.4\), Figure 3.7.17. Since \(c_a > 0\), \(\bm c_{\parallel}\) points along \(+\bm a\).