Skip to main content
Logo image

Section 3.1 Inner Products and Cross Products

Inner products (also known as dot products) and cross products are two important examples of “vector multiplication”. The inner product is a scalar product meaning that the resulting quantity is a scalar value. Likewise, the cross product is a vector product and the resulting quantity is a vector. Both products are extremely important in describing vector geometry.

Subsection Inner Products

Recall from Definition 2.3.1 that the inner product of two vectors \(\xx\) and \(\yy\) in \(\RR^n\) is the scalar quantity
\begin{equation*} \dotprod{\xx,\yy} = \yy^{T}\xx\text{.} \end{equation*}
This product has several nice properties (see Theorem 2.3.2), but for now we'll consider the property
\begin{equation*} \dotprod{\xx,\yy} = \norm{\xx}\norm{\yy}\cos\theta \end{equation*}
where \(\theta\) denotes the angle between the vectors \(\xx\) and \(\yy\) satisfying \(0\leq\theta\leq\pi\text{.}\) An important interpretation of this property is that the inner product, and particularly \(\frac{\dotprod{\xx,\yy}}{\norm{\xx}\norm{\yy}}\text{,}\) is a measure of the correlation between \(\xx\) and \(\yy\text{.}\)

Example 3.1.1. Computing an Inner Product.

Let \(\xx = \mqty[3 & -4]^{T}\) and \(\yy = \mqty[12 & -5]^{T}\text{.}\) Are these vectors pointed in the same direction?
Solution.
We can approach this problem as a correlation problem. We'll estimate the correlation between \(\xx\) and \(\yy\) as follows:
\begin{equation*} \frac{\dotprod{\xx,\yy}}{\norm{\xx}\norm{\yy}} = \frac{56}{5\cdot13} = \frac{56}{65}\text{.} \end{equation*}
Since this quantity is close to \(1\text{,}\) these vectors appear to be correlated and therefore point in roughly the same direction.
Inner products are also useful when computing vector projections. Intuitively, the projection of one vector \(\xx\) onto another vector \(\yy\) represents the vector parallel to \(\yy\) that is as close as possible to \(\xx\text{.}\) Equivalently, the projection should be the point in \(\spn{\yy}\) that is as close as possible to \(\xx\text{.}\)
The projection should be the point in \(\spn{\yy}\) that is as close as possible to \(\xx\text{.}\) Therefore we need to minimize \(\norm{\xx-\alpha\yy}\) over \(\alpha\text{,}\) which is equivalent to minimizing \(\dotprod{\xx-\alpha\yy,\xx-\alpha\yy}\text{.}\) If we expand this inner product, we get
\begin{equation*} \dotprod{\xx-\alpha\yy,\xx-\alpha\yy} = \norm{\xx}^2 - 2\alpha\dotprod{\xx,\yy} + \alpha^2\norm{\yy}^2\text{.} \end{equation*}
This expression is quadratic in \(\alpha\) and can be simplified by completing the square in \(\alpha\text{:}\)
\begin{align*} \norm{\xx}^2 - 2\alpha\dotprod{\xx,\yy} + \alpha^2\norm{\yy}^2 & = \norm{\yy}^2\left(\alpha^2 - \frac{2\alpha}{\norm{\yy}^2}\dotprod{\xx,\yy}\right) + \norm{\xx}^2 \\ & = \norm{\yy}^2\left(\alpha - \frac{\dotprod{\xx,\yy}}{\norm{\yy}^2}\right)^2 - \frac{\dotprod{\xx,\yy}^2}{\norm{\yy}^2} + \norm{\xx}^2 \end{align*}
Therefore the value of \(\alpha\) that makes this quantity as small as possible must be \(\alpha = \frac{\dotprod{\xx,\yy}}{\norm{\yy}^2}\text{,}\) which means that
\begin{equation*} \proj{\yy}{\xx} = \alpha\yy = \frac{\dotprod{\xx,\yy}}{\dotprod{\yy,\yy}}\yy\text{.} \end{equation*}

Example 3.1.3. Projecting onto a Line.

Let \(\vv = \mqty[3 & -2]^{T}\) let \(\uu = \mqty[-2 & 2]\text{.}\) Find the projection of \(\vv\) onto \(\uu\text{.}\)
Solution.
The projection is given by
\begin{equation*} \frac{-10}{8}\mqty[-2 \\ 2] = -\frac{5}{2}\mqty[-1 \\ 1]\text{.} \end{equation*}
The formula in Theorem 3.1.2 can be generalized to subspaces of \(\RR^n\text{.}\) In particular, if \(S\) is a subspace of \(\RR^n\) with a basis given by columns of a matrix \(A\text{,}\) then the projection of \(\xx\) onto \(S\text{,}\) \(\proj{\xx}{S}\text{,}\) is the vector
\begin{equation*} \proj{S}{\xx} = A(A^{T}A)^{-1}A^{T}\xx\text{.} \end{equation*}
Note that this formula reduces to the formula in Theorem 3.1.2 in the case that \(A = [\yy]\text{.}\)
Inner products are also connected to the physical concept of work. In particular, if a force \(\mathbf{F}\) acts on a particle over a displacement \(\mathbf{d}\text{,}\) then the work done is given by \(W = \langle\mathbf{F},\mathbf{d}\rangle\text{.}\)

Subsection Cross Products

Now we move to the other important example of vector multiplication in this course, the cross product.

Definition 3.1.4. Cross Product.

Let \(\uu,\vv\in\RR^3\text{.}\) The cross product of \(\uu\) and \(\vv\) is the unique vector \(\uu\times\vv\) satisfying
  1. \(\uu\times\vv\) is perpendicular to both \(\uu\) and \(\vv\) and has its direction determined by the right-hand rule.
  2. The magnitude of \(\uu\times\vv\) is given by \(\norm{\uu\times\vv} = \norm{\uu}\norm{\vv}\sin(\theta)\) where \(\theta\) is the angle between \(\uu\) and \(\vv\text{.}\)
Definition 3.1.4 is useful for understanding what the cross product gives, but is less useful for actually determining cross products. To compute cross products, we use the following computational formula.

Subsection Computing Inner and Cross Products Using Technology

Both Octave and Sage allow for quick computations of inner and cross products. In Octave, these computations are done using the dot and cross commands:
Since we will also be considering inner and cross products of vectors with symbolic components, it's also useful to use Sage for computations involving inner products and cross products. This is accomplished using the dot_product and cross_product methods.
Sage and Octave cells are provided below for further computations.