Week 2 Discussion Notes

Table of Contents

Dot Product

The dot product of two vectors v=v1,v2,v3\vec{v} = \ang{v_1, v_2, v_3} and w=w1,w2,w3\vec{w} = \ang{w_1, w_2, w_3} is defined by

vw=v1w1+v2w2+v3w3.\vec{v} \cdot \vec{w} = v_1w_1 + v_2w_2 + v_3w_3.

Properties

Commutativity

Notice that multiplication is commutative (i.e., ab=baab = ba), so

vw=v1w1+v2w2+v3w3=w1v1+w2v2+w3v3=wv.\begin{aligned} \vec{v} \cdot \vec{w} &= v_1w_1 + v_2w_2 + v_3w_3 \\ &= w_1v_1 + w_2v_2 + w_3v_3 \\ &= \vec{w} \cdot \vec{v}. \end{aligned}

This means the dot product is commutative or in other words, the order does not matter when you compute it.

Relationship to vector lengths

vv=v12+v22+v32=v2,\vec{v} \cdot \vec{v} = v_1^2 + v_2^2 + v_3^2 = \norm{\vec{v}}^2,

which looks almost like xx=x2x \cdot x = x^2 for scalars.

Linearity

If u,v,w\vec{u}, \vec{v}, \vec{w} are vectors and a,ba, b are scalars, then

u(av+bw)=auv+buw,\vec{u} \cdot \p{a\vec{v} + b\vec{w}} = a\vec{u} \cdot \vec{v} + b\vec{u} \cdot \vec{w},

so you can distribute similar to regular addition and multiplication. Because the dot product is commutative, this is also true in the first slot of the dot product:

(av+bw)u=avu+bwu.\p{a\vec{v} + b\vec{w}} \cdot \vec{u} = a\vec{v} \cdot \vec{u} + b\vec{w} \cdot \vec{u}.

Cosine formula

If θ\theta is in the angle (chosen to be between 00 and π\pi) between the vectors v\vec{v} and w\vec{w}, then

vw=vwcosθ.\vec{v} \cdot \vec{w} = \norm{\vec{v}} \norm{\vec{w}} \cos\theta.

You can derive this using the law of cosines (you can ignore Case 2).

Relationship to orthogonality

We say that v\vec{v} and w\vec{w} are orthogonal (or perpendicular) if the angle between them is π2\frac{\pi}{2} (i.e., they make a right angle to each other). We can use the dot product to test for orthogonality, since if v\vec{v} and w\vec{w} are non-zero, then by the cosine formula,

vw=vwcosθ=0    cosθ=0.\vec{v} \cdot \vec{w} = \norm{\vec{v}} \norm{\vec{w}} \cos\theta = 0 \implies \cos\theta = 0.

Since θ\theta is between 00 and π\pi, this means that if vw=0\vec{v} \cdot \vec{w} = 0, then θ=π2\theta = \frac{\pi}{2}. This means that if the dot product of two non-zero vectors is 00, then they are orthogonal to each other.

Projections

Given vectors u\vec{u} and v\vec{v}, we can draw this picture:

The green vector is the projection of u\vec{u} along v\vec{v} and is parallel to v\vec{v}, so there exists a scalar λ\lambda such that

uv=λvv.\vec{u}_{\parallel\vec{v}} = \lambda \frac{\vec{v}}{\norm{\vec{v}}}.

I'm using a unit vector here because I care about the direction of v\vec{v} (which is encapsulated in its unit vector) but I don't care about the length.

The red vector is perpendicular to v\vec{v}, meaning uvv=0\vec{u}_{\perp\vec{v}} \cdot \vec{v} = 0. From the picture, you can also see that

u=uv+uv=λvv+uv,\vec{u} = \vec{u}_{\parallel\vec{v}} + \vec{u}_{\perp\vec{v}} = \lambda \frac{\vec{v}}{\norm{\vec{v}}} + \vec{u}_{\perp\vec{v}},

so to solve for λ\lambda, we can take the dot product with v\vec{v} on both sides:

uv=(λvv+uv)v=λvvv+uvv=λv    λ=uvv.\begin{aligned} \vec{u} \cdot \vec{v} &= \p{\lambda \frac{\vec{v}}{\norm{\vec{v}}} + \vec{u}_{\perp\vec{v}}} \cdot \vec{v} \\ &= \lambda \frac{\vec{v} \cdot \vec{v}}{\norm{\vec{v}}} + \vec{u}_{\perp\vec{v}} \cdot \vec{v} \\ &= \lambda \norm{\vec{v}} \\ \implies \lambda &= \frac{\vec{u} \cdot \vec{v}}{\norm{\vec{v}}}. \end{aligned}

λ\lambda above is called the scalar component of u\vec{u} along v\vec{v}, and we can use this to write down the formula for the projection of u\vec{u} along v\vec{v}:

uv=(uvv)vv\vec{u}_{\parallel\vec{v}} = \p{\frac{\vec{u} \cdot \vec{v}}{\norm{\vec{v}}}} \frac{\vec{v}}{\norm{\vec{v}}}

Cross Product

Unlike the dot product, which gives you a scalar, the cross product of two vectors v\vec{v} and w\vec{w} give you another vector, denoted v×w\vec{v} \times \vec{w}. Geometrically, v×w\vec{v} \times \vec{w} is orthogonal to both v\vec{v} and w\vec{w}, and it follows the right-hand rule:

In the picture, v\vec{v} points to the right, and w\vec{w} points into the webpage. From the picture, you can already see that the cross product is not commutative.

Geometric Interpretation

Calculating the cross product is best understood by specifying its direction and magnitude. The direction is given by the right-hand rule, and the magnitude is given by the formula

v×w=vwsinθ,\norm{\vec{v} \times \vec{w}} = \norm{\vec{v}} \norm{\vec{w}} \abs{\sin\theta},

there θ\theta is the angle between v\vec{v} and w\vec{w}. There's a nice geometric interpretation of this formula:

The area of a parallelogram is base×height\mathrm{base} \times \mathrm{height}. In the picture above, the base is v\norm{\vec{v}}, the length of v\vec{v}, and the height is wsinθ\norm{\vec{w}} \sin\theta, so v×w\norm{\vec{v} \times \vec{w}} is the area of the parallelogram spanned by v\vec{v} and w\vec{w}.

Determinant Formula

If you want to calculate v×w\vec{v} \times \vec{w} algebraically, then you can use the determinant formula:

v×w=i^j^k^v1v2v3w1w2w3=v2v3w2w3i^v1v3w1w3j^+v1v2w1w2k^=(v2w3v3w2)i^(v1w3v3w1)j^+(v1w2v2w1)k^.\begin{aligned} \vec{v} \times \vec{w} &= \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ v_1 & v_2 & v_3 \\ w_1 & w_2 & w_3 \end{vmatrix} \\ &= \begin{vmatrix} v_2 & v_3 \\ w_2 & w_3 \end{vmatrix} \hat{i} - \begin{vmatrix} v_1 & v_3 \\ w_1 & w_3 \end{vmatrix} \hat{j} + \begin{vmatrix} v_1 & v_2 \\ w_1 & w_2 \end{vmatrix} \hat{k} \\ &= \p{v_2w_3 - v_3w_2} \hat{i} - \p{v_1w_3 - v_3w_1} \hat{j} + \p{v_1w_2 - v_2w_1} \hat{k}. \end{aligned}

Warning: Notice that there's a minus sign on j^\hat{j}.

Properties

Anticommutativity

From the picture above, you should be able to tell that w×v=v×w\vec{w} \times \vec{v} = -\vec{v} \times \vec{w}.

Linearity

Like the dot product, you can distribute the cross product, but you have to make sure you keep things in order:

u×(av+bw)=au×v+bu×w.\vec{u} \times \p{a\vec{v} + b\vec{w}} = a\vec{u} \times \vec{v} + b\vec{u} \times \vec{w}.

This works in the first slot too:

(av+bw)×u=av×u+bw×u.\p{a\vec{v} + b\vec{w}} \times \vec{u} = a\vec{v} \times \vec{u} + b\vec{w} \times \vec{u}.

Relationship with parallel vectors

From either the formula for v×w\norm{\vec{v} \times \vec{w}} or the determinant formula, you can show that

v×v=0.\vec{v} \times \vec{v} = \vec{0}.

In fact, because the cross product is linear, given any scalar λ\lambda, you also get

v×λv=λ(v×v)=0.\vec{v} \times \lambda\vec{v} = \lambda\p{\vec{v} \times \vec{v}} = \vec{0}.

This means that the cross product of two parallel vectors is always the zero vector 0\vec{0}.