TExcelTAD
Home › Coordinate Geometry: 2D & 3D Cartesian Systems › The Dot Product in R³: Angle Between Vectors, Direction Cosines, and Orthogonality

The Dot Product in R3\mathbb{R}^3: Angle Between Vectors, Direction Cosines, and Orthogonality

In three-dimensional space, determining whether two vectors are perpendicular, finding the angle between two spatial trajectories, or calculating how much of a force vector acts along a specific structural beam are daily tasks in physics and engineering.

The mathematical tool that unlocks all of these is the dot product (also known as the scalar product or inner product). Unlike standard vector addition, the dot product takes two spatial vectors and produces a single real number (a scalar).


1. Geometric and Algebraic Definitions

There are two equivalent ways to compute the dot product: algebraically via coordinates, and geometrically via lengths and angles.

Algebraic Definition (Component Form)

For any two vectors u⃗=⟨u1,u2,u3⟩\vec{u} = \langle u_1, u_2, u_3 \rangle and v⃗=⟨v1,v2,v3⟩\vec{v} = \langle v_1, v_2, v_3 \rangle in R3\mathbb{R}^3:

u⃗⋅v⃗=u1v1+u2v2+u3v3\vec{u} \cdot \vec{v} = u_1 v_1 + u_2 v_2 + u_3 v_3

Geometric Definition

If θ\theta is the spatial angle between u⃗\vec{u} and v⃗\vec{v} with 0≤θ≤π0 \le \theta \le \pi (0∘≤θ≤180∘0^\circ \le \theta \le 180^\circ):

u⃗⋅v⃗=∥u⃗∥∥v⃗∥cos⁡θ\vec{u} \cdot \vec{v} = \|\vec{u}\| \|\vec{v}\| \cos\theta

Angle Between Two Spatial Vectors

Equating the two definitions gives the fundamental formula for the spatial angle:

cos⁡θ=u⃗⋅v⃗∥u⃗∥∥v⃗∥=u1v1+u2v2+u3v3u12+u22+u32v12+v22+v32\cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\| \|\vec{v}\|} = \frac{u_1 v_1 + u_2 v_2 + u_3 v_3}{\sqrt{u_1^2 + u_2^2 + u_3^2}\sqrt{v_1^2 + v_2^2 + v_3^2}}

The sign of the dot product immediately reveals the nature of the angle θ\theta:

  • If u⃗⋅v⃗>0  ⟹  cos⁡θ>0  ⟹  θ\vec{u} \cdot \vec{v} > 0 \implies \cos\theta > 0 \implies \theta is acute (0∘≤θ<90∘0^\circ \le \theta < 90^\circ).
  • If u⃗⋅v⃗=0  ⟹  cos⁡θ=0  ⟹  θ=90∘\vec{u} \cdot \vec{v} = 0 \implies \cos\theta = 0 \implies \theta = 90^\circ (orthogonal / perpendicular).
  • If u⃗⋅v⃗<0  ⟹  cos⁡θ<0  ⟹  θ\vec{u} \cdot \vec{v} < 0 \implies \cos\theta < 0 \implies \theta is obtuse (90∘<θ≤180∘90^\circ < \theta \le 180^\circ).

2. Geometric Diagram: Angle & Orthogonal Projection

O v u u - proj_v(u) proj_v(u) theta

3. Direction Angles and Direction Cosines

Any non-zero vector v⃗=⟨v1,v2,v3⟩\vec{v} = \langle v_1, v_2, v_3 \rangle in R3\mathbb{R}^3 forms three angles with the positive coordinate axes:

  • α\alpha: angle with the positive xx-axis (i⃗=⟨1,0,0⟩\vec{i} = \langle 1, 0, 0 \rangle).
  • β\beta: angle with the positive yy-axis (j⃗=⟨0,1,0⟩\vec{j} = \langle 0, 1, 0 \rangle).
  • γ\gamma: angle with the positive zz-axis (k⃗=⟨0,0,1⟩\vec{k} = \langle 0, 0, 1 \rangle).

Each angle lies in [0,π][0, \pi]. Using the dot product with the standard basis vectors:

cos⁡α=v⃗⋅i⃗∥v⃗∥∥i⃗∥=v1∥v⃗∥,cos⁡β=v⃗⋅j⃗∥v⃗∥∥j⃗∥=v2∥v⃗∥,cos⁡γ=v⃗⋅k⃗∥v⃗∥∥k⃗∥=v3∥v⃗∥\cos\alpha = \frac{\vec{v} \cdot \vec{i}}{\|\vec{v}\|\|\vec{i}\|} = \frac{v_1}{\|\vec{v}\|}, \quad \cos\beta = \frac{\vec{v} \cdot \vec{j}}{\|\vec{v}\|\|\vec{j}\|} = \frac{v_2}{\|\vec{v}\|}, \quad \cos\gamma = \frac{\vec{v} \cdot \vec{k}}{\|\vec{v}\|\|\vec{k}\|} = \frac{v_3}{\|\vec{v}\|}

These values cos⁡α,cos⁡β,cos⁡γ\cos\alpha, \cos\beta, \cos\gamma are called the direction cosines of vector v⃗\vec{v}.

The Direction Cosines Sum-of-Squares Identity

Squaring each cosine and summing them produces a vital mathematical identity:

cos⁡2α+cos⁡2β+cos⁡2γ=v12+v22+v32∥v⃗∥2=∥v⃗∥2∥v⃗∥2=1\cos^2\alpha + \cos^2\beta + \cos^2\gamma = \frac{v_1^2 + v_2^2 + v_3^2}{\|\vec{v}\|^2} = \frac{\|\vec{v}\|^2}{\|\vec{v}\|^2} = 1

Moreover, the unit vector u^\hat{u} in the direction of v⃗\vec{v} is composed directly of its direction cosines:

u^=v⃗∥v⃗∥=⟨cos⁡α,  cos⁡β,  cos⁡γ⟩\hat{u} = \frac{\vec{v}}{\|\vec{v}\|} = \langle \cos\alpha, \; \cos\beta, \; \cos\gamma \rangle

4. Geometric Diagram: Direction Angles in Space

z y x v γ beta alpha

5. Projections: Scalar and Vector

When decomposing a vector u⃗\vec{u} relative to a reference vector v⃗\vec{v}:

  1. Scalar Projection (Component): The signed length of the shadow that u⃗\vec{u} casts onto v⃗\vec{v}:
    compv⃗u⃗=∥u⃗∥cos⁡θ=u⃗⋅v⃗∥v⃗∥\text{comp}_{\vec{v}}\vec{u} = \|\vec{u}\| \cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{v}\|}
  2. Vector Projection: The actual vector lying parallel to v⃗\vec{v} that represents this shadow:
    projv⃗u⃗=(compv⃗u⃗)v⃗∥v⃗∥=(u⃗⋅v⃗∥v⃗∥2)v⃗\text{proj}_{\vec{v}}\vec{u} = \left(\text{comp}_{\vec{v}}\vec{u}\right) \frac{\vec{v}}{\|\vec{v}\|} = \left( \frac{\vec{u} \cdot \vec{v}}{\|\vec{v}\|^2} \right) \vec{v}
  3. Orthogonal Decomposition: Any vector u⃗\vec{u} can be broken down into components parallel and perpendicular to v⃗\vec{v}:
    u⃗=u⃗∥+u⃗⊥=projv⃗u⃗+(u⃗−projv⃗u⃗)\vec{u} = \vec{u}_{\parallel} + \vec{u}_{\perp} = \text{proj}_{\vec{v}}\vec{u} + (\vec{u} - \text{proj}_{\vec{v}}\vec{u})

6. Step-by-Step Paper Notebook Method

Calculating Angle and Projections on Paper

  1. Compute Three Fundamental Scalars:
    • u⃗⋅v⃗=u1v1+u2v2+u3v3\vec{u} \cdot \vec{v} = u_1 v_1 + u_2 v_2 + u_3 v_3
    • ∥u⃗∥2=u12+u22+u32\|\vec{u}\|^2 = u_1^2 + u_2^2 + u_3^2
    • ∥v⃗∥2=v12+v22+v32\|\vec{v}\|^2 = v_1^2 + v_2^2 + v_3^2
  2. Compute the Angle Cosine:
    cos⁡θ=u⃗⋅v⃗∥u⃗∥2∥v⃗∥2\cos\theta = \frac{\vec{u} \cdot \vec{v}}{\sqrt{\|\vec{u}\|^2}\sqrt{\|\vec{v}\|^2}}
    Simplify the fraction completely. If it equals a standard trigonometric value (e.g., 0,±12,±22,±32,±10, \pm\frac{1}{2}, \pm\frac{\sqrt{2}}{2}, \pm\frac{\sqrt{3}}{2}, \pm 1), write the exact angle θ\theta in radians and degrees.
  3. Compute the Vector Projection: Calculate scalar scale factor k=u⃗⋅v⃗∥v⃗∥2k = \frac{\vec{u} \cdot \vec{v}}{\|\vec{v}\|^2} (notice: no square root here!). Then multiply each component of v⃗\vec{v} by kk.
  4. Verification Step: Confirm that (u⃗−projv⃗u⃗)⋅v⃗=0(\vec{u} - \text{proj}_{\vec{v}}\vec{u}) \cdot \vec{v} = 0.

7. Worked Examples

Example 1: Angle Between Spatial Vectors and Orthogonality Check

Problem: Given vectors a⃗=⟨2,−1,2⟩\vec{a} = \langle 2, -1, 2 \rangle and b⃗=⟨3,4,0⟩\vec{b} = \langle 3, 4, 0 \rangle:

  1. Calculate the dot product a⃗⋅b⃗\vec{a} \cdot \vec{b}.
  2. Determine whether the angle between them is acute, right, or obtuse.
  3. Find the exact angle θ\theta between a⃗\vec{a} and b⃗\vec{b}.

Solution

  • Step 1: Dot Product
    a⃗⋅b⃗=(2)(3)+(−1)(4)+(2)(0)=6−4+0=2\vec{a} \cdot \vec{b} = (2)(3) + (-1)(4) + (2)(0) = 6 - 4 + 0 = 2
  • Step 2: Sign Analysis Since a⃗⋅b⃗=2>0\vec{a} \cdot \vec{b} = 2 > 0, the spatial angle θ\theta is acute.
  • Step 3: Magnitudes and Angle Calculation
    ∥a⃗∥=22+(−1)2+22=4+1+4=9=3∥b⃗∥=32+42+02=9+16+0=25=5\begin{aligned} \|\vec{a}\| &= \sqrt{2^2 + (-1)^2 + 2^2} = \sqrt{4 + 1 + 4} = \sqrt{9} = 3 \\ \|\vec{b}\| &= \sqrt{3^2 + 4^2 + 0^2} = \sqrt{9 + 16 + 0} = \sqrt{25} = 5 \end{aligned}
    Substituting into the cosine formula:
    cos⁡θ=a⃗⋅b⃗∥a⃗∥∥b⃗∥=23×5=215\cos\theta = \frac{\vec{a} \cdot \vec{b}}{\|\vec{a}\| \|\vec{b}\|} = \frac{2}{3 \times 5} = \frac{2}{15}
    Therefore:
    θ=arccos⁡(215)≈82.34∘\theta = \arccos\left(\frac{2}{15}\right) \approx 82.34^\circ

Example 2: Direction Angles of a Spatial Vector

Problem: A force vector is given by F⃗=⟨3,−6,2⟩ N\vec{F} = \langle 3, -6, 2 \rangle\text{ N}.

  1. Find the magnitude ∥F⃗∥\|\vec{F}\|.
  2. Find the direction cosines of F⃗\vec{F}.
  3. Verify the sum-of-squares identity cos⁡2α+cos⁡2β+cos⁡2γ=1\cos^2\alpha + \cos^2\beta + \cos^2\gamma = 1.

Solution

  • Step 1: Magnitude
    ∥F⃗∥=32+(−6)2+22=9+36+4=49=7 N\|\vec{F}\| = \sqrt{3^2 + (-6)^2 + 2^2} = \sqrt{9 + 36 + 4} = \sqrt{49} = 7\text{ N}
  • Step 2: Direction Cosines
    cos⁡α=Fx∥F⃗∥=37,cos⁡β=Fy∥F⃗∥=−67,cos⁡γ=Fz∥F⃗∥=27\cos\alpha = \frac{F_x}{\|\vec{F}\|} = \frac{3}{7}, \qquad \cos\beta = \frac{F_y}{\|\vec{F}\|} = -\frac{6}{7}, \qquad \cos\gamma = \frac{F_z}{\|\vec{F}\|} = \frac{2}{7}
  • Step 3: Verification
    cos⁡2α+cos⁡2β+cos⁡2γ=(37)2+(−67)2+(27)2=9+36+449=4949=1\cos^2\alpha + \cos^2\beta + \cos^2\gamma = \left(\frac{3}{7}\right)^2 + \left(-\frac{6}{7}\right)^2 + \left(\frac{2}{7}\right)^2 = \frac{9 + 36 + 4}{49} = \frac{49}{49} = 1
    The identity holds perfectly.

Example 3: Vector Projection and Orthogonal Decomposition

Problem: Let u⃗=⟨4,3,1⟩\vec{u} = \langle 4, 3, 1 \rangle and v⃗=⟨1,2,−2⟩\vec{v} = \langle 1, 2, -2 \rangle.

  1. Compute the scalar projection compv⃗u⃗\text{comp}_{\vec{v}}\vec{u}.
  2. Compute the vector projection projv⃗u⃗\text{proj}_{\vec{v}}\vec{u}.
  3. Decompose u⃗\vec{u} into parallel and perpendicular components relative to v⃗\vec{v}.

Solution

  • Step 1: Scalar Projection

    u⃗⋅v⃗=(4)(1)+(3)(2)+(1)(−2)=4+6−2=8∥v⃗∥=12+22+(−2)2=1+4+4=9=3\begin{aligned} \vec{u} \cdot \vec{v} &= (4)(1) + (3)(2) + (1)(-2) = 4 + 6 - 2 = 8 \\ \|\vec{v}\| &= \sqrt{1^2 + 2^2 + (-2)^2} = \sqrt{1 + 4 + 4} = \sqrt{9} = 3 \end{aligned}
    compv⃗u⃗=u⃗⋅v⃗∥v⃗∥=83\text{comp}_{\vec{v}}\vec{u} = \frac{\vec{u} \cdot \vec{v}}{\|\vec{v}\|} = \frac{8}{3}
  • Step 2: Vector Projection

    projv⃗u⃗=(u⃗⋅v⃗∥v⃗∥2)v⃗=832⟨1,2,−2⟩=89⟨1,2,−2⟩=⟨89,  169,  −169⟩\text{proj}_{\vec{v}}\vec{u} = \left(\frac{\vec{u} \cdot \vec{v}}{\|\vec{v}\|^2}\right)\vec{v} = \frac{8}{3^2} \langle 1, 2, -2 \rangle = \frac{8}{9}\langle 1, 2, -2 \rangle = \left\langle \frac{8}{9}, \; \frac{16}{9}, \; -\frac{16}{9} \right\rangle
  • Step 3: Orthogonal Decomposition

    u⃗∥=⟨89,  169,  −169⟩\vec{u}_{\parallel} = \left\langle \frac{8}{9}, \; \frac{16}{9}, \; -\frac{16}{9} \right\rangle
    u⃗⊥=u⃗−u⃗∥=⟨4,3,1⟩−⟨89,169,−169⟩=⟨36−89,  27−169,  9−(−16)9⟩=⟨289,  119,  259⟩\begin{aligned} \vec{u}_{\perp} &= \vec{u} - \vec{u}_{\parallel} = \langle 4, 3, 1 \rangle - \left\langle \frac{8}{9}, \frac{16}{9}, -\frac{16}{9} \right\rangle \\ &= \left\langle \frac{36 - 8}{9}, \; \frac{27 - 16}{9}, \; \frac{9 - (-16)}{9} \right\rangle = \left\langle \frac{28}{9}, \; \frac{11}{9}, \; \frac{25}{9} \right\rangle \end{aligned}

    Check perpendicularity on paper:

    u⃗⊥⋅v⃗=28(1)+11(2)+25(−2)9=28+22−509=09=0\vec{u}_{\perp} \cdot \vec{v} = \frac{28(1) + 11(2) + 25(-2)}{9} = \frac{28 + 22 - 50}{9} = \frac{0}{9} = 0

    The decomposition is rigorously confirmed.


8. Common Mistakes & Paper Traps

[!WARNING] Trap 1: Dot Product Producing a Vector Instead of a Scalar
Never write u⃗⋅v⃗=⟨6,−4,0⟩\vec{u} \cdot \vec{v} = \langle 6, -4, 0 \rangle. The dot product adds the coordinate products together: 6+(−4)+0=26 + (-4) + 0 = 2. It is always a single real number.

[!WARNING] Trap 2: Projecting onto the Wrong Vector
Remember the subscript rule: in projv⃗u⃗\text{proj}_{\vec{v}}\vec{u}, the vector in the subscript (v⃗\vec{v}) is the track onto which the shadow falls. Hence ∥v⃗∥2\|\vec{v}\|^2 appears in the denominator, and the result is scaled by v⃗\vec{v}.

[!WARNING] Trap 3: Direction Angles Exceeding 180∘180^\circ
Direction angles α,β,γ\alpha, \beta, \gamma are defined strictly in the interval [0,π][0, \pi] ([0∘,180∘][0^\circ, 180^\circ]). They can never be negative or exceed 180∘180^\circ.


9. Pencil & Paper Practice

Try these problems on paper before checking the worked solutions below.

Practice Problems

  1. Determine the value of scalar kk such that vectors p⃗=⟨3,k,−2⟩\vec{p} = \langle 3, k, -2 \rangle and q⃗=⟨2,4,k+1⟩\vec{q} = \langle 2, 4, k+1 \rangle are perpendicular.
  2. A vector w⃗\vec{w} makes angles α=60∘\alpha = 60^\circ and β=45∘\beta = 45^\circ with the positive xx and yy axes, respectively. Find all possible values for its third direction angle γ\gamma.
  3. Compute the work done by constant force F⃗=⟨5,−2,4⟩ N\vec{F} = \langle 5, -2, 4 \rangle\text{ N} in moving an object along the straight displacement vector from A(1,0,3)A(1, 0, 3) to B(4,3,5)B(4, 3, 5) (coordinates in meters).

Worked Solutions

Solution 1: For p⃗\vec{p} and q⃗\vec{q} to be perpendicular, their dot product must equal zero:

p⃗⋅q⃗=0(3)(2)+(k)(4)+(−2)(k+1)=06+4k−2k−2=02k+4=0  ⟹  2k=−4  ⟹  k=−2\begin{aligned} \vec{p} \cdot \vec{q} &= 0 \\ (3)(2) + (k)(4) + (-2)(k + 1) &= 0 \\ 6 + 4k - 2k - 2 &= 0 \\ 2k + 4 &= 0 \implies 2k = -4 \implies k = -2 \end{aligned}

Solution 2: Apply the identity cos⁡2α+cos⁡2β+cos⁡2γ=1\cos^2\alpha + \cos^2\beta + \cos^2\gamma = 1:

cos⁡60∘=12  ⟹  cos⁡260∘=14cos⁡45∘=22  ⟹  cos⁡245∘=24=1214+12+cos⁡2γ=134+cos⁡2γ=1  ⟹  cos⁡2γ=14cos⁡γ=±12\begin{aligned} \cos 60^\circ &= \frac{1}{2} \implies \cos^2 60^\circ = \frac{1}{4} \\ \cos 45^\circ &= \frac{\sqrt{2}}{2} \implies \cos^2 45^\circ = \frac{2}{4} = \frac{1}{2} \\ \frac{1}{4} + \frac{1}{2} + \cos^2\gamma &= 1 \\ \frac{3}{4} + \cos^2\gamma &= 1 \implies \cos^2\gamma = \frac{1}{4} \\ \cos\gamma &= \pm \frac{1}{2} \end{aligned}

Since γ∈[0∘,180∘]\gamma \in [0^\circ, 180^\circ]:

  • If cos⁡γ=12  ⟹  γ=60∘\cos\gamma = \frac{1}{2} \implies \gamma = 60^\circ
  • If cos⁡γ=−12  ⟹  γ=120∘\cos\gamma = -\frac{1}{2} \implies \gamma = 120^\circ

Solution 3: First find displacement vector d⃗=AB⃗\vec{d} = \vec{AB}:

d⃗=⟨4−1,  3−0,  5−3⟩=⟨3,3,2⟩ m\vec{d} = \langle 4 - 1, \; 3 - 0, \; 5 - 3 \rangle = \langle 3, 3, 2 \rangle\text{ m}

Work is the dot product of force and displacement:

W=F⃗⋅d⃗=(5)(3)+(−2)(3)+(4)(2)=15−6+8=17 JoulesW = \vec{F} \cdot \vec{d} = (5)(3) + (-2)(3) + (4)(2) = 15 - 6 + 8 = 17\text{ Joules}

Test yourself

For which value of mm are the vectors u⃗=⟨m,2,−1⟩\vec{u} = \langle m, 2, -1 \rangle and v⃗=⟨4,m,6⟩\vec{v} = \langle 4, m, 6 \rangle orthogonal?

  1. m=1m = 1
  2. m=−1m = -1
  3. m=2m = 2
  4. m=0m = 0

If a⃗=⟨1,−1,0⟩\vec{a} = \langle 1, -1, 0 \rangle and b⃗=⟨0,1,1⟩\vec{b} = \langle 0, 1, 1 \rangle, what is the angle θ\theta between them?

  1. 60∘60^\circ
  2. 90∘90^\circ
  3. 120∘120^\circ
  4. 150∘150^\circ

What is the vector projection of u⃗=⟨0,5,0⟩\vec{u} = \langle 0, 5, 0 \rangle onto v⃗=⟨2,2,1⟩\vec{v} = \langle 2, 2, 1 \rangle?

  1. ⟨209,209,109⟩\langle \frac{20}{9}, \frac{20}{9}, \frac{10}{9} \rangle
  2. ⟨2,2,1⟩\langle 2, 2, 1 \rangle
  3. 103\frac{10}{3}
  4. ⟨0,103,0⟩\langle 0, \frac{10}{3}, 0 \rangle