← M408MWeek 5: Vectors & the Dot Product
M408M • Week 5Stewart §12.1 – 12.3

Vectors & the Geometry of Space

Drag the figure to rotate it

1 Points, planes, and spheres in ℝ³
2 Vectors: add, scale, normalize
3 Dot product: angles & projections
§12.1 • Coordinates in space

Three coordinates locate a point in space

To reach $P(a,b,c)$, walk $a$ along $x$, then $b$ along $y$, then $c$ along $z$.

Right-hand rule

Curl the fingers of your right hand from $+x$ toward $+y$. Your thumb points along $+z$.

Coordinate planes
$xy$: $z=0$ · $yz$: $x=0$ · $xz$: $y=0$
Octants
The three planes cut space into 8 octants. In the first octant, $x,y,z>0$.
Projections of $P$
$(a,b,0)$, $(0,b,c)$, $(a,0,c)$: drop $P$ straight onto each plane.

Drag the figure to rotate it: a flat picture cannot show depth.

§12.1 • Equations and surfaces

In ℝ³, one equation describes a surface

A variable missing from the equation is free. Draw the curve in the other two variables, then slide it along the missing axis.

EquationIn ℝ²In ℝ³
$x=2$lineplane parallel to the $yz$-plane
$y=x$linevertical plane
$x^2+y^2=4$circlecylinder around the $z$-axis
$z=y^2$parabolaparabolic cylinder
Two equations
usually a curve: $x^2+y^2=4,\ z=3$ is a circle at height 3
Inequalities
a solid: $1\le x^2+y^2+z^2\le4$ is a thick spherical shell
Magenta: the circle $x^2+y^2=4$ at $z=0$. $z$ is free, so copy the circle at every height.

Drag the figure to rotate it

§12.1 • Distance & spheres

Distance in space, and the sphere it defines

Distance comes from the Pythagorean theorem, used twice. A sphere is every point at distance $r$ from a center $C$.

$$|P_1P_2|=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$$
1. Floor
diagonal $d$ of the floor: $\ d^2=\Delta x^2+\Delta y^2$
2. Up
$|P_1P_2|^2=d^2+\Delta z^2=\Delta x^2+\Delta y^2+\Delta z^2$
$$(x-h)^2+(y-k)^2+(z-l)^2=r^2$$

This is the sphere with center $C(h,k,l)$ and radius $r$. From the expanded form, complete the square in $x$, $y$, and $z$ to find $C$ and $r$.

Example: find the center and radius
$$x^2+y^2+z^2+4x-6y+2z+6=0$$
$$(x+2)^2+(y-3)^2+(z+1)^2=-6+4+9+1=8$$

Center $(-2,3,-1)$, radius $\sqrt8=2\sqrt2$.

A negative right side means no points; $0$ means only the center.

Legs Δx, Δy, Δz · dashed: floor diagonal $d$ · magenta: $CP$ · drag to rotate

§12.2 • Vectors

A vector is a displacement: add it, subtract it, scale it

A vector has a length and a direction, but no fixed position. Sliding an arrow without turning or stretching it gives the same vector.

$$\overrightarrow{AB}=\langle x_2-x_1,\ y_2-y_1,\ z_2-z_1\rangle\quad(\text{head}-\text{tail})$$
$\mathbf a+\mathbf b$
Add components. Picture: put the tail of $\mathbf b$ at the head of $\mathbf a$.
$\mathbf a-\mathbf b$
$\mathbf a+(-\mathbf b)$: the arrow from the head of $\mathbf b$ to the head of $\mathbf a$.
$c\,\mathbf a$
$|c|$ times as long as $\mathbf a$, and reversed when $c<0$.
Parallel
$\mathbf b$ is parallel to $\mathbf a$ ($\mathbf a\parallel\mathbf b$) if $\mathbf b=c\,\mathbf a$ ($c\ne0$). If $\mathbf b$ starts from a point $P$, then it is $P+c\,\mathbf a$.

Choose an operation to animate it · drag a and b (or point P)

§12.2 • Length & unit vectors

Length and unit vectors

Divide a nonzero vector by its length. The result keeps the direction and has length 1.

$$|\mathbf a|=\sqrt{a_1^2+a_2^2+a_3^2}\qquad\mathbf u=\frac{\mathbf a}{|\mathbf a|}$$
Basis
$\mathbf i=\langle1,0,0\rangle$, $\mathbf j=\langle0,1,0\rangle$, $\mathbf k=\langle0,0,1\rangle$, so $\langle a_1,a_2,a_3\rangle=a_1\mathbf i+a_2\mathbf j+a_3\mathbf k$
Length $L$
$L\,\mathbf u$ points along $\mathbf a$; $\ -\mathbf u$ points the opposite way
Example
$\mathbf a=2\mathbf i-\mathbf j-2\mathbf k$: $\ |\mathbf a|=\sqrt{4+1+4}=3$, $\ \mathbf u=\left\langle\tfrac23,-\tfrac13,-\tfrac23\right\rangle$
$\mathbf i$ and $\mathbf j$ are unit vectors, but $|\mathbf i+\mathbf j|=\sqrt2$. Lengths add only when the vectors point the same way.

Drag the head of a: the head of u always lands on the unit circle (the unit sphere in 3D).

§12.3 • The dot product

The dot product turns two vectors into a number

Multiply matching components and add. The sign of the result tells you whether the angle is acute, right, or obtuse.

$$\mathbf a\cdot\mathbf b=a_1b_1+a_2b_2+a_3b_3=|\mathbf a|\,|\mathbf b|\cos\theta$$
$\mathbf a\cdot\mathbf b>0$$0\le\theta<\pi/2$ — acute
$\mathbf a\cdot\mathbf b=0$$\theta=\pi/2$ — orthogonal
$\mathbf a\cdot\mathbf b<0$$\pi/2<\theta\le\pi$ — obtuse
Rules
$\mathbf a\cdot\mathbf a=|\mathbf a|^2,\quad \mathbf a\cdot\mathbf b=\mathbf b\cdot\mathbf a,$
$\mathbf a\cdot(\mathbf b+\mathbf c)=\mathbf a\cdot\mathbf b+\mathbf a\cdot\mathbf c,\quad (c\mathbf a)\cdot\mathbf b=c(\mathbf a\cdot\mathbf b)$

Dashed violet line: every direction ⊥ a · drag the heads of a and b

§12.3 • Angles & orthogonality

Find the angle between two vectors

Solve $\mathbf a\cdot\mathbf b=|\mathbf a|\,|\mathbf b|\cos\theta$ for $\cos\theta$.

$$\cos\theta=\frac{\mathbf a\cdot\mathbf b}{|\mathbf a|\,|\mathbf b|},\qquad 0\le\theta\le\pi$$

Example

$\mathbf a=\langle2,2,-1\rangle$, $\mathbf b=\langle5,-3,2\rangle$: $\ \mathbf a\cdot\mathbf b=10-6-2=2$, $\ |\mathbf a|=3$, $\ |\mathbf b|=\sqrt{38}$

$\theta=\arccos\dfrac{2}{3\sqrt{38}}\approx84^\circ$

Orthogonal means $\mathbf a\cdot\mathbf b=0$. Example: $\langle2,2,-1\rangle\cdot\langle5,-4,2\rangle=10-8-2=0$.

Why is $\mathbf a\cdot\mathbf b=|\mathbf a|\,|\mathbf b|\cos\theta$?

Compute $|\mathbf a-\mathbf b|^2$ for the triangle on the right in two ways:

$$\text{Law of cosines: }\ |\mathbf a|^2+|\mathbf b|^2-2|\mathbf a||\mathbf b|\cos\theta$$
$$\text{Dot product: }\ (\mathbf a-\mathbf b)\cdot(\mathbf a-\mathbf b)=|\mathbf a|^2+|\mathbf b|^2-2\,\mathbf a\cdot\mathbf b$$

Both equal $|\mathbf a-\mathbf b|^2$, so $\mathbf a\cdot\mathbf b=|\mathbf a||\mathbf b|\cos\theta$.

$\arccos$ returns an angle in $[0,\pi]$, the smaller angle between the vectors. Leave the answer exact unless a decimal is asked for.

Drag the heads of a and b: both ways of computing |a − b|² always agree.

§12.3 • Projections

Projection: the shadow of b on a

Shine light perpendicular to $\mathbf a$. The shadow that $\mathbf b$ casts on the line through $\mathbf a$ is the projection.

Scalar projection (number — signed length)$$\operatorname{comp}_{\mathbf a}\mathbf b=|\mathbf b|\cos\theta=\frac{\mathbf a\cdot\mathbf b}{|\mathbf a|}$$
Vector projection (vector along $\mathbf a$)$$\operatorname{proj}_{\mathbf a}\mathbf b=\left(\operatorname{comp}_{\mathbf a}\mathbf b\right)\frac{\mathbf a}{|\mathbf a|}=\frac{\mathbf a\cdot\mathbf b}{|\mathbf a|^2}\,\mathbf a$$
No cancellation: $\mathbf a\cdot\mathbf b=\mathbf a\cdot\mathbf c$ does not force $\mathbf b=\mathbf c$. Press Play: every $\mathbf b$ ending on the dashed line casts the same shadow.

Magenta: projection · teal: orthogonal part · drag the heads of a and b

Putting it together • Lines & spheres

A line through a point, and where it meets a sphere

Start at a point and add multiples of a direction $\mathbf v$. Each step of 1 in $t$ moves a distance $|\mathbf v|$.

$$\mathbf r(t)=\mathbf r_0+t\,\mathbf v,\qquad t\in\mathbb R$$

$\mathbf r_0$: position vector of a point on the line · $\mathbf v$: its direction. (Preview of §12.5.)

Through the center $C$ of a sphere of radius $r$

$$|\mathbf r(t)-C|=|t|\,|\mathbf v|=r\ \Longrightarrow\ t=\pm\frac{r}{|\mathbf v|}$$

So the line meets the sphere at $C\pm r\,\dfrac{\mathbf v}{|\mathbf v|}$: walk $r$ along the unit vector, in both directions.

Line not through the center? Substitute $x(t),y(t),z(t)$ into the sphere’s equation and solve the quadratic in $t$: 2, 1, or 0 solutions.

$C(2,1,1)$, $r=6$, $\mathbf v=\langle2,-1,2\rangle$. Dots mark whole steps of $t$, each $|\mathbf v|=3$ long, so the line exits at $t=\pm2$.

Exercises

Practice: spheres, lines, and dot products

Try each problem before looking at the solutions on the next slides. Give exact answers.

Exercise 1 · Find the sphere

$$x^2+y^2+z^2-6x+2y-4z-22=0$$
  1. Show that this is a sphere. Find its center $C$ and radius $r$.
  2. Describe where the sphere meets the $xy$-plane.
  3. Is the origin inside, on, or outside the sphere?

Exercise 2 · Line meeting a sphere

Use the sphere $S$ from Exercise 1 and the point $E(9,2,-4)$.

  1. Write a vector equation of the line $L$ through $C$ and $E$.
  2. Find the exact points where $L$ meets $S$.

Exercise 3 · A triangle in space

$A(1,0,2),\ B(3,4,6),\ D(3,-1,4)$

  1. Find the unit vector that points in the direction opposite to $\overrightarrow{AD}$.
  2. Find the exact angle $\angle BAD$.
  3. Find the scalar and vector projections of $\overrightarrow{AD}$ onto $\overrightarrow{AB}$.
  4. Write $\overrightarrow{AD}$ as the sum of a vector parallel to $\overrightarrow{AB}$ and a vector orthogonal to $\overrightarrow{AB}$.
Solution • Exercise 1

Solution 1: complete the square to find the sphere

Group the terms by variable, complete each square, and add the same constants to the right side.

$$x^2+y^2+z^2-6x+2y-4z-22=0$$

(a) Complete the square in $x$, $y$, and $z$:

$$(x^2-6x+9)+(y^2+2y+1)+(z^2-4z+4)=22+9+1+4$$
$$\boxed{(x-3)^2+(y+1)^2+(z-2)^2=36}$$

(b) The $xy$-plane is $z=0$:

$$(x-3)^2+(y+1)^2+4=36\ \Longrightarrow\ (x-3)^2+(y+1)^2=32$$

(c) Compare $|OC|$ with $r$:

$$|OC|=\sqrt{3^2+(-1)^2+2^2}=\sqrt{14}\approx3.74<6$$
Shortcut for (c): the expanded left side equals $|PC|^2-r^2$. At the origin it is $-22<0$, so the origin is inside.
The plane $z=0$ is 2 units below $C$, so the circle's radius is $\sqrt{6^2-2^2}=\sqrt{32}$.
Answers
  • (a) Center $C(3,-1,2)$, radius $r=6$
  • (b) A circle in the $xy$-plane with center $(3,-1,0)$ and radius $\sqrt{32}=4\sqrt2$
  • (c) Inside, because $\sqrt{14}<6$
Solution • Exercise 2

Solution 2: where the line meets the sphere

The line passes through the center, so the parameter $t$ measures distance from $C$ in steps of $|\mathbf v|$.

$$C(3,-1,2),\quad r=6,\quad E(9,2,-4)$$

(a) $\overrightarrow{CE}=\langle6,3,-6\rangle=3\langle2,1,-2\rangle$. Use the simpler direction vector:

$$\mathbf r(t)=\langle3,-1,2\rangle+t\,\langle2,1,-2\rangle$$

(b) $|\mathbf r(t)-C|=|t|\,|\langle2,1,-2\rangle|=3|t|$. Setting $3|t|=6$ gives $t=\pm2$:

$$t=2:\ (7,1,-2)\qquad t=-2:\ (-1,-3,6)$$

Check by substitution: $(2t)^2+t^2+(-2t)^2=9t^2=36$, so $t=\pm2$.

The line through $C$ and $E$ crosses the sphere at $t=\pm2$. Drag to rotate.
Answers
  • (a) $\mathbf r(t)=\langle3,-1,2\rangle+t\langle2,1,-2\rangle$ (any nonzero multiple of the direction works)
  • (b) $(7,1,-2)$ and $(-1,-3,6)$
Solution • Exercise 3

Solution 3: angle and projection in a triangle

Find the two edge vectors from $A$ first. Every part then uses the same dot product.

$$\overrightarrow{AB}=\langle2,4,4\rangle,\ |\overrightarrow{AB}|=6\qquad\overrightarrow{AD}=\langle2,-1,2\rangle,\ |\overrightarrow{AD}|=3$$

(a) $-\dfrac{\overrightarrow{AD}}{|\overrightarrow{AD}|}=\left\langle-\tfrac23,\ \tfrac13,\ -\tfrac23\right\rangle$

(b) $\overrightarrow{AB}\cdot\overrightarrow{AD}=4-4+8=8$, so

$$\cos\theta=\frac{8}{6\cdot3}=\frac49\ \Longrightarrow\ \theta=\arccos\frac49\approx63.6^\circ$$

(c) Divide by the length of $\overrightarrow{AB}$, the vector you are projecting onto:

$$\operatorname{comp}=\frac{8}{6}=\frac43,\qquad\operatorname{proj}=\frac{8}{36}\langle2,4,4\rangle=\left\langle\tfrac49,\tfrac89,\tfrac89\right\rangle$$

(d) Subtract the projection to get the orthogonal part:

$$\overrightarrow{AD}=\left\langle\tfrac49,\tfrac89,\tfrac89\right\rangle+\left\langle\tfrac{14}9,-\tfrac{17}9,\tfrac{10}9\right\rangle$$

Check: $\left\langle\tfrac{14}9,-\tfrac{17}9,\tfrac{10}9\right\rangle\cdot\langle2,4,4\rangle=\tfrac{28-68+40}{9}=0$ ✓

Drawn in the plane of the triangle. Magenta: $\operatorname{proj}_{\overrightarrow{AB}}\overrightarrow{AD}$ (length $\tfrac43$). Teal: the orthogonal part. Violet: $-\overrightarrow{AD}/|\overrightarrow{AD}|$.
Order matters. Projecting $\overrightarrow{AB}$ onto $\overrightarrow{AD}$ gives $\tfrac{8}{9}\langle2,-1,2\rangle$ instead. That vector is parallel to $\overrightarrow{AD}$, not to $\overrightarrow{AB}$.
§12.1 – 12.3 • Summary

Key formulas and what they mean

Learn each formula together with a picture of what it measures.

IdeaFormulaPicture it as
Distance$\sqrt{(\Delta x)^2+(\Delta y)^2+(\Delta z)^2}$The diagonal of a box
Sphere$(x-h)^2+(y-k)^2+(z-l)^2=r^2$All points at distance $r$ from $C$. Complete the square to find $C$ and $r$.
Vector $\overrightarrow{AB}$$\langle x_2-x_1,\ y_2-y_1,\ z_2-z_1\rangle$Head minus tail
Unit vector$\mathbf a/|\mathbf a|$Same direction as $\mathbf a$, length 1
Dot product$a_1b_1+a_2b_2+a_3b_3=|\mathbf a||\mathbf b|\cos\theta$Its sign tells you whether $\theta$ is acute, right, or obtuse
Projection$\operatorname{comp}_{\mathbf a}\mathbf b=\dfrac{\mathbf a\cdot\mathbf b}{|\mathbf a|}$, $\ \operatorname{proj}_{\mathbf a}\mathbf b=\dfrac{\mathbf a\cdot\mathbf b}{|\mathbf a|^2}\mathbf a$The shadow of $\mathbf b$ on the line through $\mathbf a$
Line$\mathbf r(t)=\mathbf r_0+t\mathbf v$Through a sphere's center, it meets the sphere at $t=\pm r/|\mathbf v|$