girgit.org

Vector Algebra

The dot product: multiply two vectors, get a number

The big ideaThe dot product \( \vec{a}\cdot\vec{b} = |\vec{a}|\,|\vec{b}|\cos\theta \) turns two vectors into one number that tells how much they point the same way; it is zero exactly when they are at right angles.

In simple words

Two people pull a cart with ropes. If both pull the same way, their pulls help each other a lot. If one pulls at a right angle to the other, neither helps the other's direction at all. If they pull in opposite ways, they fight. The dot product is a single number that measures this "helping": big and positive, zero, or negative.

Two ways to multiply vectors

Multiplying two numbers gives a number, and two matrices give a matrix. Vectors can be multiplied in two different ways: the scalar product (or dot product), whose answer is a scalar, and the vector product (or cross product), whose answer is a vector. This concept is about the first one. Both are used all over geometry, mechanics and engineering; in physics, work done is a dot product: \( W = \vec{F}\cdot\vec{d} \).

The definition

For two non-zero vectors \( \vec{a} \) and \( \vec{b} \), with θ the angle between them (0 ≤ θ ≤ π), placed tail to tail:

\[ \vec{a}\cdot\vec{b} = |\vec{a}|\,|\vec{b}|\cos\theta. \]

If either vector is \( \vec{0} \), θ is not defined, and we simply set \( \vec{a}\cdot\vec{b} = 0 \).

What the sign tells you

  • θ acute (0 ≤ θ < 90°): cos θ > 0, so \( \vec{a}\cdot\vec{b} > 0 \).
  • θ = 90°: \( \vec{a}\cdot\vec{b} = 0 \). For non-zero vectors, \( \vec{a}\cdot\vec{b} = 0 \iff \vec{a} \perp \vec{b} \).
  • θ obtuse (90° < θ ≤ 180°): \( \vec{a}\cdot\vec{b} < 0 \).
  • θ = 0: \( \vec{a}\cdot\vec{b} = |\vec{a}|\,|\vec{b}| \); in particular \( \vec{a}\cdot\vec{a} = |\vec{a}|^2 \).
  • θ = π: \( \vec{a}\cdot\vec{b} = -|\vec{a}|\,|\vec{b}| \); in particular \( \vec{a}\cdot(-\vec{a}) = -|\vec{a}|^2 \).

The unit vectors \( \hat{i}, \hat{j}, \hat{k} \) have length 1 and are at right angles to each other, so

\[ \hat{i}\cdot\hat{i} = \hat{j}\cdot\hat{j} = \hat{k}\cdot\hat{k} = 1, \qquad \hat{i}\cdot\hat{j} = \hat{j}\cdot\hat{k} = \hat{k}\cdot\hat{i} = 0. \]

Try it: drag the arrows round each other. The sign of the dot product changes exactly as a crosses the dashed line at right angles to b.

Rules of the dot product

  • Commutative: \( \vec{a}\cdot\vec{b} = \vec{b}\cdot\vec{a} \) (the angle and lengths are the same either way).
  • Distributive over addition: \( \vec{a}\cdot(\vec{b} + \vec{c}) = \vec{a}\cdot\vec{b} + \vec{a}\cdot\vec{c} \).
  • Scalars come out: \( (\lambda\vec{a})\cdot\vec{b} = \lambda(\vec{a}\cdot\vec{b}) = \vec{a}\cdot(\lambda\vec{b}) \).

The dot product from components

Take \( \vec{a} = a_1\hat{i} + a_2\hat{j} + a_3\hat{k} \) and \( \vec{b} = b_1\hat{i} + b_2\hat{j} + b_3\hat{k} \). Multiply out using the rules: there are nine terms like \( a_1b_2(\hat{i}\cdot\hat{j}) \). The six mixed ones vanish because \( \hat{i}\cdot\hat{j} = 0 \) and so on, and the three matching ones have \( \hat{i}\cdot\hat{i} = 1 \). What is left is

\[ \vec{a}\cdot\vec{b} = a_1b_1 + a_2b_2 + a_3b_3. \]

Put this together with the definition and you can find the angle between any two non-zero vectors:

\[ \cos\theta = \frac{\vec{a}\cdot\vec{b}}{|\vec{a}|\,|\vec{b}|}, \quad\text{that is,} \] \[ \theta = \cos^{-1}\!\left(\frac{a_1b_1 + a_2b_2 + a_3b_3}{\sqrt{a_1^2 + a_2^2 + a_3^2}\,\sqrt{b_1^2 + b_2^2 + b_3^2}}\right). \]

Worked examples

  1. Angle from lengths. \( |\vec{a}| = 4,\ |\vec{b}| = 3,\ \vec{a}\cdot\vec{b} = -6 \). Then \( \cos\theta = \frac{-6}{12} = -\frac{1}{2} \), so θ = \( \frac{2\pi}{3} \) (120°). The negative dot product told us at once the angle was obtuse.
  2. Angle from components. \( \vec{a} = \hat{i} + \hat{j} \), \( \vec{b} = \hat{j} + \hat{k} \). \( \vec{a}\cdot\vec{b} = 0 + 1 + 0 = 1 \), \( |\vec{a}| = |\vec{b}| = \sqrt{2} \). So \( \cos\theta = \frac{1}{2} \) and θ = \( \frac{\pi}{3} \).
  3. Not a nice angle. \( \vec{a} = \hat{i} - \hat{j} + 2\hat{k} \), \( \vec{b} = 2\hat{i} + \hat{j} - \hat{k} \). \( \vec{a}\cdot\vec{b} = 2 - 1 - 2 = -1 \) and both lengths are \( \sqrt{6} \). So \( \theta = \cos^{-1}\left(-\frac{1}{6}\right) \), a little over 90°.
  4. Finding λ. For which λ is \( 2\hat{i} + \lambda\hat{j} + \hat{k} \) perpendicular to \( \hat{i} - 2\hat{j} + 3\hat{k} \)? Set the dot product to zero: \( 2 - 2\lambda + 3 = 0 \), so \( \lambda = \frac{5}{2} \).

The perpendicular test: do they cast a shadow?

Shine a light straight down onto the line of \( \vec{b} \). The shadow \( \vec{a} \) throws on it has length \( |\vec{a}|\cos\theta \), and the dot product is that shadow times \( |\vec{b}| \). When \( \vec{a} \) stands at a right angle to \( \vec{b} \), it casts no shadow at all, so the dot product is 0. (The next concept, projection, makes this shadow exact.)

Guess first: \( \vec{a} = \hat{i} + 2\hat{j} + 2\hat{k} \) and \( \vec{b} = 2\hat{i} - 2\hat{j} + \hat{k} \). Neither is the zero vector; both have length 3. Can their product be 0?

See what happens
\( \vec{a}\cdot\vec{b} = 2 - 4 + 2 = 0 \). Yes. With ordinary numbers, xy = 0 forces x = 0 or y = 0. With the dot product, \( \vec{a}\cdot\vec{b} = 0 \) does not mean one of them is zero: it can also mean they are perpendicular. That is exactly what makes the dot product a right-angle detector. If \( \vec{a} = \vec{0} \) or \( \vec{b} = \vec{0} \), the product is 0; the reverse is not true.

A related trap: from \( \vec{a}\cdot\vec{b} = \vec{a}\cdot\vec{c} \) you cannot cancel \( \vec{a} \). For \( \vec{a} = \hat{i} \), \( \vec{b} = 2\hat{i} + 3\hat{j} \) and \( \vec{c} = 2\hat{i} - 5\hat{j} + 7\hat{k} \), both products are 2, but \( \vec{b} \ne \vec{c} \). All it says is \( \vec{a}\cdot(\vec{b} - \vec{c}) = 0 \): \( \vec{a} \) is perpendicular to \( \vec{b} - \vec{c} \).

A useful identity. \( (\vec{a} + \vec{b})\cdot(\vec{a} - \vec{b}) = |\vec{a}|^2 - |\vec{b}|^2 \) (the cross terms \( \vec{a}\cdot\vec{b} \) and \( -\vec{b}\cdot\vec{a} \) cancel). So \( \vec{a} + \vec{b} \) and \( \vec{a} - \vec{b} \) are perpendicular exactly when \( |\vec{a}| = |\vec{b}| \). In pictures: the diagonals of a rhombus cross at right angles.

Don't mix these up

  • \( \vec{a}\cdot\vec{b} \) is a number, not a vector.
  • \( \vec{a}\cdot\vec{a} = |\vec{a}|^2 \), not \( |\vec{a}| \).
  • \( \vec{a}\cdot\vec{b} = 0 \) means \( \vec{a} = \vec{0} \), or \( \vec{b} = \vec{0} \), or \( \vec{a} \perp \vec{b} \).

Words to know

Scalar (dot) product
\( \vec{a}\cdot\vec{b} = |\vec{a}|\,|\vec{b}|\cos\theta \), a number.
Angle between vectors
The angle θ (0 to π) between them when placed tail to tail.
Perpendicular vectors
Vectors at 90°; their dot product is 0.
Commutative
Order does not matter: \( \vec{a}\cdot\vec{b} = \vec{b}\cdot\vec{a} \).
Distributive
\( \vec{a}\cdot(\vec{b} + \vec{c}) = \vec{a}\cdot\vec{b} + \vec{a}\cdot\vec{c} \).

What is \( (2\hat{i} - \hat{j} + 3\hat{k})\cdot(\hat{i} + 4\hat{j} - \hat{k}) \)?

  1. −5
  2. \( 2\hat{i} - 4\hat{j} - 3\hat{k} \)
  3. 1

\( \vec{a} \) and \( \vec{b} \) are non-zero and \( \vec{a}\cdot\vec{b} < 0 \). What is the angle between them?

  1. Acute
  2. 90°
  3. Obtuse (or 180°)

\( \vec{a}\cdot\vec{b} = 0 \) for two vectors. What must be true?

  1. One of them is the zero vector
  2. They are perpendicular, or at least one is \( \vec{0} \)
  3. They are parallel