Reading history

3D Vectors, Dot Product and Cross Product

4 min read 1 views

Work with vectors in 3D: length, unit vectors, direction cosines, the dot product and angles, projections, the cross product and parallelogram area.

The world has three dimensions, so many vectors need three parts: across, back and up. In this lesson we extend vectors to 3D using the unit vectors i, j and k. We then meet two ways to multiply vectors. The dot product gives a number and finds angles. The cross product gives a new vector at right angles to both, and finds areas.

In this lesson you will learn

  • Vectors in the form xi + yj + zk, their length and unit vectors
  • Direction cosines
  • The dot product and the angle between two vectors
  • The projection of one vector on another
  • The cross product, its direction, and the area of a parallelogram

You should know vectors in 2D and determinants.

Vectors in Three Dimensions

We add a third axis, z, at right angles to the x- and y-axes. The unit vectors along the axes are i, j and k. Any vector can be written as a = xi + yj + zk.

a = 2i − j + 3k

Length:  |a| = √(2² + (−1)² + 3²) = √14
Unit vector:  â = a/|a| = (2i − j + 3k)/√14

Points A(1, 2, 3) and B(4, 6, 3):
AB = (4 − 1)i + (6 − 2)j + (3 − 3)k = 3i + 4j
|AB| = √(9 + 16 + 0) = 5

Adding, subtracting and multiplying by a number work part by part, just as in 2D.

Direction Cosines

Let a vector make angles α, β and γ with the x-, y- and z-axes. Their cosines are called the direction cosines, l, m and n.

For a = xi + yj + zk:
l = cos α = x/|a|,  m = cos β = y/|a|,  n = cos γ = z/|a|

They always satisfy  l² + m² + n² = 1

a = 2i + 3j + 6k,  |a| = √49 = 7
l = 2/7,  m = 3/7,  n = 6/7
Check: (4 + 9 + 36)/49 = 1 ✓

The Dot Product

The dot product (or scalar product) of two vectors is a number.

Two forms

a · b = |a||b| cos θ = a₁b₁ + a₂b₂ + a₃b₃

Put the two forms together to find the angle between vectors.

a = i + 2j + 2k,  b = 2i − j + 2k

a · b = 2 − 2 + 4 = 4
|a| = 3,  |b| = 3

cos θ = 4/(3 × 3) = 4/9
θ ≈ 63.6°
  • If a · b = 0, the vectors are perpendicular.
  • i · i = j · j = k · k = 1, and i · j = j · k = k · i = 0.
  • The projection of a on b is a · b / |b|. It is the length of a’s “shadow” along b.

In physics, the work done by a force F over a displacement d is W = F · d.

The Cross Product

The cross product (or vector product) a × b is a vector.

  • Its length is |a||b| sin θ.
  • It is perpendicular to both a and b.
  • Its direction follows the right-hand rule. Point your fingers along a and curl them towards b. Your thumb shows the direction of a × b.
xyzaba × barea = |a × b|at right anglesto a and b

We work it out with a 3 × 3 determinant.

         | i   j   k  |
a × b =  | a₁  a₂  a₃ |
         | b₁  b₂  b₃ |

a = i + 2j + 3k,  b = 2i + j + k

a × b = i(2×1 − 3×1) − j(1×1 − 3×2) + k(1×1 − 2×2)
      = −i + 5j − 3k

Check: (a × b)·a = −1 + 10 − 9 = 0 ✓
       (a × b)·b = −2 + 5 − 3 = 0 ✓
FactMeaning
i × j = k, j × k = i, k × i = jGo round the cycle i → j → k
b × a = −(a × b)Order matters; swapping flips the direction
a × a = 0Parallel vectors give the zero vector

Areas and Volumes

The length |a × b| equals the area of the parallelogram with sides a and b. A triangle is half of that.

For a = i + 2j + 3k and b = 2i + j + k:
|a × b| = √(1 + 25 + 9) = √35

Area of parallelogram = √35 ≈ 5.92 square units
Area of triangle     = ½√35 ≈ 2.96 square units

Going one step further, |a · (b × c)| is the volume of the box (parallelepiped) with edges a, b and c. If it is zero, the three vectors lie in one plane.

Common Mistakes

  1. Forgetting the minus sign on the j term of the determinant.
  2. Treating the dot product as a vector. It is just a number.
  3. Writing a × b = b × a. The order flips the direction.
  4. Using sin θ in the dot product or cos θ in the cross product.

Practice Exercises

Exercise 1. Find |3i − 4j + 12k|.

Show answer

√(9 + 16 + 144) = √169 = 13.

Exercise 2. Find the angle between i + j and j + k.

Show answer

The dot product is 0 + 1 + 0 = 1, and each length is √2. So cos θ = 1/2 and θ = 60°.

Exercise 3. Find i × (i + j).

Show answer

i × i + i × j = 0 + k = k.

Frequently Asked Questions

Why does the cross product only exist in 3D?

In 3D there is exactly one direction at right angles to two given vectors (up to sign). In 2D there is no such direction inside the plane. That is why the cross product is special to three dimensions.

Where is the cross product used?

It gives the turning effect (torque) of a force, the force on a wire in a magnetic field, and the normal to a surface in computer graphics.

Summary

  • A 3D vector is xi + yj + zk, with length √(x² + y² + z²).
  • Direction cosines satisfy l² + m² + n² = 1.
  • a · b = |a||b| cos θ = a₁b₁ + a₂b₂ + a₃b₃; zero means perpendicular.
  • a × b is perpendicular to a and b, with length |a||b| sin θ = area of the parallelogram.

Next: Exponential and Logarithmic Functions.

Lessons are also marked complete when you click Next.

Leave a Reply

Your email address will not be published. Required fields are marked *