up to Schedule & Notes

Points vs. Vectors

$[ x, y, z ] \in \mathbb{R}^3$ is a point or a vector.

A point has a position but no direction.

A vector has a direction but no position.

Dot Product

$a = [ a_1, a_2, \ldots, a_n ]^T$

$b = [ b_1, b_2, \ldots, b_n ]^T$

$a \cdot b = \langle a, b \rangle = \sum_i a_i b_i$

$(x,y) \cdot e_1 = 1 x + 0 y = x$

$(x,y) \cdot e_2 = 0 x + 1 y = y$

This relies on $|e_1| = |e_2| = 1$.

Axioms of the dot product

The dot product is invariant under rotation

For rotation $R$, let $u' = R u$ and $v' = R v$:

Note that the dot product $a \cdot b$ is the same as the matrix product $a^\mathsf{T} b$.

$\begin{array}[t]{rl} u' \cdot v' & = R u \cdot R v \\ & = (R u)^\mathsf{T} (R v) \\ & = (u^\mathsf{T} R^\mathsf{T}) (R v) \\ & = u^\mathsf{T} (R^\mathsf{T} R) v \\ & = u^\mathsf{T} v \\ & = u \cdot v \end{array}$.

This works because $R$ is a rotation matrix and $R^\mathsf{T} = R^{-1}$.

Geometric interpretation of dot product

  1. $v \cdot \frac{u}{|u|}$ is the length of the projection of $v$ onto the line of $u$.
  2. $(v \cdot \frac{u}{|u|}) \frac{u}{|u|}$ is the vector in the direction of $u$ with length equal to this projection.

    Note that $|u| |u| = u \cdot u$.

    Therefore, ${v \cdot u \over u \cdot u} u$ is the vector that is the projection of $v$ onto the line of $u$, and is the closest we can get to $v$ using only a multiple of $u$.

  3. If $\theta$ is the angle between $u$ and $v$, then

    $\begin{array}{rl} \cos \theta & = {\text{adjacent} \over \text{hypotenuse}} \\ & = {v \cdot \frac{u}{|u|} \over |v|} \end{array}$

    So $u \cdot v = |u| |v| \cos\theta$.

Cross product

$a \times b = \left[ \begin{array}{c} a_y b_z - a_z b_y \\ a_z b_x - a_x b_z \\ a_x b_y - a_y b_x \\ \end{array} \right]$

This is a vector.

Properties of the cross product

Applications in Graphics

Dot product: $u \cdot v$ is the perpendicular projection of $u$ onto $v$ if $|v| = 1$.

Cross product: $a \times b$ is perpendicular to both $a$ and $b$.

Use dot to calculate $\cos\theta$ quickly.

Use dot to calculate surface lighting (which uses $\cos\theta$).

Use cross to find a "normal vector" perpendicular to an object's flat face:

up to Schedule & Notes