- Forward


Vector Mathematics in 3D
An Introduction to 3D Vectors


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Some Notation
Back SMYC Forward
  • The Set of Real Numbers:
    • \(\mathbb{R}^{1} \doteq \mathbb{R}\)
  • The Set of Ordered Triples of Real Numbers:
    • \(\mathbb{R}^{3} \doteq \mathbb{R} \times \mathbb{R} \times \mathbb{R}\)
Members of \(\mathbb{R}^{3}\)
Back SMYC Forward
  • The Notation You Are Most Familiar With:
    • \((x, y, z)\)
  • A More Convenient Notation:
    • \(\bs{p} = (p_{x}, p_{y}, p_{z})\)
  • A Still More Convenient Notation:
    • \(\bs{p} = (p_{1}, p_{2}, p_{3})\)
Two Things to be Aware Of
Back SMYC Forward
  • Orientation:
    • It sometimes matters whether we think of the ordered pair as a "row" or a "column", though we won't distinguish for now
    • An example of a "row": \(\bs{p} = [p_1 \quad p_2 \quad p_3]\)
    • An example of a "column": \(\bs{p} = \left[ \begin{array}{c}p_1 \\ p_2 \\ p_3 \end{array} \right]\)
  • Points and Directions:
    • In is sometimes important to distinguish between different kinds of ordered pairs (e.g., points and directions)
    • We won't distinguish for now except in visualizations
Visualization
Back SMYC Forward

Points

point3d
Visualization (cont.)
Back SMYC Forward

Directions

vector3d
Vector Fields
Back SMYC Forward
  • Definition:
    • A vector field is a map \(F: A \subset \mathbb{R}^{3} \rightarrow \mathbb{R}^{3}\) that assigns to each point \(\bs{p} \in A\) a vector \(F(\bs{p})\)
  • Visualization:
    • vectorfield3d
Multiplication by a Scalar
Back SMYC Forward
  • Definition:
    • Given \(\alpha \in \mathbb{R}\) and \(\bs{p} \in \mathbb{R}^{3}\)
    • \(\alpha \bs{p} = (\alpha p_{1}, \alpha p_{2}, \alpha p_{3})\)
  • Visualization:
    • scalarmultiplication3d
Addition
Back SMYC Forward
  • Definition:
    • Given \(\bs{q} \in \mathbb{R}^{3}\) and \(\bs{r} \in \mathbb{R}^{3}\)
    • \(\bs{q} + \bs{r} = (q_{1}+r_{1}, q_{2}+r_{2}, q_{3}+r_{3})\)
  • Visualization:
    • addition3d
Subtraction
Back SMYC Forward
  • Definition:
    • Given \(\bs{q} \in \mathbb{R}^{3}\) and \(\bs{r} \in \mathbb{R}^{3}\)
    • \(\bs{q} - \bs{r} = (q_{1}-r_{1}, q_{2}-r_{2}, q_{3}-r_{3})\)
  • Visualization:
    • subtraction3d
The Standard Basis
Back SMYC Forward
  • Three Important Vectors:
    • \(\bs{i} = (1, 0, 0)\)
    • \(\bs{j} = (0, 1, 0)\)
    • \(\bs{k} = (0, 0, 1)\)
  • A General Representation of Vectors in \(\mathbb{R}^3\):
    • Suppose \(\bs{q} = (q_{1}, q_{2}, q_{3})\), then
    • \(\bs{q} = q_{1} \bs{i} + q_{2} \bs{j} + q_{3} \bs{k}\)
The Standard Basis (cont.)
Back SMYC Forward

Visualization

standardbasis3d
The Standard Basis (cont.)
Back SMYC Forward
  • An Important Observation:
    • Every vector \(\bs{p}\) can be written as \(\bs{p} = \alpha \bs{i} + \beta \bs{j} + \gamma \bs{k}\) when \(\alpha\), \(\beta\) and \(\gamma\) are chosen appropriately
  • As in Two Dimensions:
    • \(\bs{p}\) is then said to be a linear combination of \(\bs{i}\), \(\bs{j}\), and \(\bs{k}\)
    • \(\bs{i}\), \(\bs{j}\), and \(\bs{k}\) are said to be linearly independent
The Inner (Dot) Product
Back SMYC Forward
  • Two Notations:
    • \(\bs{p} \cdot \bs{q}\)
    • \(\lt \bs{p}, \bs{q} \gt\)
  • Definition:
    • Given \(\bs{p} \in \mathbb{R}^{3}\) and \(\bs{q} \in \mathbb{R}^{3}\)
    • \(\bs{p} \cdot \bs{q} = \sum_{i=1}^{3} p_{i} q_{i} = p_{1} q_{1} + p_{2} q_{2} + p_{3} q_{3} \)
The Euclidean Norm (Length) of a Vector
Back SMYC Forward
  • The (Euclidean) Length of a Vector:
    • \(||\bs{p}|| = \sqrt{\sum_{i=1}^{3} p_{i}^{2}} = \sqrt{p_{1}^{2} + p_{2}^2 + p_{2}^2}\)
  • An Observation:
    • \(\bs{p} \cdot \bs{p} = p_{1}^{2} + p_{2}^2 + p_{3}^2\)
  • Substituting:
    • \(||\bs{p}|| = (\bs{p} \cdot \bs{p})^{\frac{1}{2}}\)
Unit Vector
Back SMYC Forward
  • Definition:
    • A vector with a norm (i.e., length) of 1
  • Three Examples Revisited:
    • \(\bs{i} = (1, 0, 0)\)
    • \(\bs{j} = (0, 1, 0)\)
    • \(\bs{k} = (0, 0, 1)\)
Normalization
Back SMYC Forward
  • Definition:
    • The normalization of a vector \(\bs{p}\) is \(\frac{\bs{p}}{||\bs{p}||}\) (i.e., the vector divided by its norm)
  • An Observation:
    • \(||\bs{p}||\) is a scalar so normalization involves multiplication by a scalar
  • Relationship to Unit Vectors:
    • \( \left\| \frac{\bs{p}}{||\bs{p}||} \right\| = 1 \)
The Angle Formed by Vectors
Back SMYC Forward
  • Getting Started:
    • angle-vector3d
  • The Plane Formed by the Vectors:
    • \(\bs{p}\) and \(\bs{q}\) define a plane
    • So, what we learned about 2D vectors applies here
  • From the Law of Cosines:
    • \(\theta = \cos^{-1} \frac{\bs{p} \cdot \bs{q}}{||\bs{p}|| \enspace||\bs{q}||}\)
Cross Product
Back SMYC Forward
  • Definition:
    • Given two vectors \(\bs{v}, \bs{w} \in \mathbb{R}^{3}\), the vector \(\bs{u} \in \mathbb{R}^{3}\) defined as:
    • \(\bs{u} = (v_{2}w_{3} - w_{2}v_{3}, v_{3}w_{1} - w_{3}v_{1}, v_{1}w_{2} - w_{1}v_{2})\)
    • is called the cross product of \(\bs{v}\) and \(\bs{w}\)
  • An Example:
    • Let \(\bs{v} = \left[ \begin{array}{c}1 \\ 0 \\ 2\end{array}\right]\) and \(\bs{w} = \left[ \begin{array}{c}5 \\ 3 \\ 4\end{array}\right]\). Then:
    • \(\bs{u} = \bs{v} \times \bs{w} = \left[ \begin{array}{c}0 \cdot 4 - 3 \cdot 2 \\ 2 \cdot 5 - 4 \cdot 1 \\ 1 \cdot 3 - 5 \cdot 0\end{array}\right] = \left[ \begin{array}{c}-6 \\ 6 \\ 3\end{array}\right]\)
  • Be Careful:
    • Unlike the inner (or dot) product, the cross product is a vector
    • Don't confuse this with the cross product of two sets
    • Don't confuse the different uses of the symbol \(\times\)
Cross Product (cont.)
Back SMYC Forward
  • A Simple Case:
    • Suppose both vectors are in the \(xy\)-plane so that:
    • \(\bs{v} = a \bs{i} + b \bs{j} = \left[ \begin{array}{c}a \\ b \\ 0\end{array}\right]\) and \(\bs{w} = d \bs{i} + e \bs{j} = \left[ \begin{array}{c}d \\ e \\ 0\end{array}\right]\)
    • Hence:
    • \(u = \bs{v} \times \bs{w} = \left[ \begin{array}{c}0 \\ 0 \\ ae - bd\end{array}\right]\)
  • Visualization:
    • crossproduct1-vector3d
    • \(a = ||\bs{v}|| \cos \gamma\)
    • \(b = ||\bs{v}|| \sin \gamma\)
    • \(d = ||\bs{w}|| \cos \beta\)
    • \(e = ||\bs{w}|| \sin \beta\)
  • A Simple Derivation:
    • (1) \(|| \bs{v} \times \bs{w} || = | ae - bd |\)
    • (2) \(|| \bs{v} \times \bs{w} || = | \enspace ||\bs{v}|| \cos \gamma \cdot ||\bs{w}|| \sin \beta - ||\bs{v}|| \sin \gamma \cdot ||\bs{w}|| \cos \beta \enspace | \)
    • Since \(\sin (\beta - \gamma) = (\sin \beta \cos \gamma - \cos \beta \sin \gamma)\) it follows that:
    • (3) \(|| \bs{v} \times \bs{w} || = ||\bs{v}|| \enspace ||\bs{w}|| \sin(\beta - \gamma) = ||\bs{v}|| \enspace ||\bs{w}|| \sin \theta\)
Cross Product (cont.)
Back SMYC Forward
  • The Visualization Revisited:
    • crossproduct2-vector3d
  • An Interpretation:
    • \(|| \bs{v} \times \bs{w} || = ||\bs{v}|| \enspace ||\bs{w}|| \sin \theta\) which is the (unsigned) area of the parallelogram formed by \(\bs{v}\), \(\bs{w}\), and \((\bs{v}+\bs{w})\)
Cross Products (cont.)
Back SMYC Forward
  • An Important Property:
    • \(\bs{v} \times \bs{w}\) is orthogonal to both \(\bs{v}\) and \(\bs{w}\) (and, hence, all vectors in the plane they form)
  • Proof:
    • \((\bs{v} \times \bs{w}) \cdot \bs{v} = (v_1 v_2 w_3 - v_1 w_2 v_3) + (w_1 v_2 v_3 - v_1 v_2 w_3) + (v_1 w_2 v_3 - w_1 v_2 v_3) = 0\)
    • \((\bs{v} \times \bs{w}) \cdot \bs{w} = (w_1 v_2 w_3 - w_1 w_2 v_3) + (w_1 w_2 v_3 - v_1 w_2 w_3) + (v_1 w_2 w_3 - w_1 v_2 w_3) = 0\)
  • An Observation:
    • This property is sometimes used as the defition of the cross product
Normal Vectors
Back SMYC Forward
  • Definition:
    • A vector that is perpendicular to a surface
  • An Observation:
    • In three dimensions a normal can point either "inward" or "outward"
  • The Right Hand Rule for Cross Products:
    • Point the fingers of your right hand in the direction of the first vector and curl them around to the second vector. Your thumb will point in the positive direction.
    • crossproduct4-vector3d
  • An Alternative Definition of the Cross Product:
    • \(\bs{v} \times \bs{w} = ||\bs{v}|| \cdot ||\bs{w}|| \cdot \sin(\theta) \cdot \bs{n}\) where \(\bs{n}\) is the unit normal to the plane
Scalar Triple Product
Back SMYC Forward
  • Definition:
    • Given \(\bs{v}, \bs{w}, \bs{u} \in \mathbb{R}^{3}\), the scalar triple product is defined as:
    • \(\bs{u} \cdot (\bs{v} \times \bs{w})\)
  • Visualization:
    • scalartripleproduct-vector3d
    • The area of the parallelogram formed by \(v\) and \(\bs{w}\) is \(||\bs{v} \times \bs{w}||\)
    • The volume of the parallelepiped is \(||\bs{u}|| \cos \alpha ||\bs{v} \times \bs{w}||\)
    • From the Law of Cosines: \(||\bs{a}|| \cos \alpha ||\bs{b}|| = \bs{a} \cdot \bs{b}\)
    • So, the volume of the parallelepiped is \(\bs{u} \cdot (\bs{v} \times \bs{w})\)
The Cross Product Revisited
Back SMYC Forward
  • A Special Case:
    • Replace \(\bs{u}\) with the unit normal \(n\)
  • Visualization:
    • crossproduct3-vector3d
  • Interpretation:
    • Given the definition of \(\bs{n}\) we know that \(||\bs{n}|| = 1\)
    • So, ignoring units, the volume of this parallelepiped is the same as the area of the parallelogram
    • We can use \(||\bs{n}|| \cos \alpha ||\bs{v} \times \bs{w}|| = \bs{n} \cdot (\bs{v} \times \bs{w})\) as the signed area of the parallelogram
There's Always More to Learn
Back -