MathStudio  Blog  Share  Manual  Forums  Support 
Post Format

Dot, Cross, Norm, and Angle for two vectors

The dot and cross products have geometric interpretations that we will not explore here, but computationally they are easily described.  For two vectors a,b\in \mathbb{R}^n, a=(a_1,a_2,\ldots,a_n), b=(b_1,b_2,\ldots,b_n), the dot product is a mapping

{\tt dot}: \mathbb{R}^n\times \mathbb{R}^n \to \mathbb{R},

defined by the formula

dot(a,b) = a\cdot b = \sum_{i=1}^n a_i b_i.

The standard cross product, on the other hand, is defined only for vectors a,b\in\mathbb{R}^3, where a=(a_1,a_2,a_3), b=(b_1,b_2,b_3), and returns a perpendicular vector,

cross: \mathbb{R}^3 \times \mathbb{R}^3 \to \mathbb{R}^3,

cross(a,b) = a\times b = (a_2b_3 - a_3b_2, a_3b_1-a_1b_3, a_1b_2-a_2b_1).

An equivalent definition of cross product, which allows for easier generalization to higher dimensions, is given by

cross(a,b) = det\left(\begin{array}{ccc} e_1 & e_2 & e_3 \\a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3\end{array}\right).

The norm of a vector a\in \mathbb{R}^n is the Euclidean length or ordinary sense of measuring a one-dimensional distance of a line in multiple dimensions, it is given by

{\tt norm}:\mathbb{R}^n \to \mathbb{R},

norm(a) = |a| = \sqrt{a_1^2+\ldots+a_n^2}.

There is a generalization of norms called p-norms (see for example the Wikipedia articles on Norms or Lp Space), but we will n0t go into details here.

The angle \theta between two vectors a,b\in \mathbb{R}^n is given by the formula

{\tt angle}: \mathbb{R}^n \times \mathbb{R}^n\to \mathbb{R},

angle(a,b) = \cos(\theta) = \frac{a\cdot b}{|a||b|}.

The numerator is the dot product between vectors a and b, and the denominator is the product of the norms.

Exercise 1.  Let a= (1,2,3) and b=(2,3,4).  Find the dot and cross products, the norms, and the angle between these two vectors.

Exercise 2.  Using the formula for angle, show that |a\cdot b| \leq |a||b|.

Exercise 3.  For a, b in Exercise 1, compute the two different formulas for dot product and verify that they give the same answer.  (There is a post about how to work with matrices).

Leave a Reply