The Dot Product

Match the components, multiply, and add.

Multiply matching components, then add

The dot product of two vectors is written a · b and read “a dot b”. To work it out, multiply the matching components, the first with the first and the second with the second, and add the two products: (a₁, a₂) · (b₁, b₂) = a₁b₁ + a₂b₂.

For (3, 1) and (2, 4), the first components give 3 × 2 = 6 and the second components give 1 × 4 = 4, so (3, 1) · (2, 4) = 6 + 4 = 10.

The answer is a single number, not a vector. A number like this is a scalar, so the dot product is also called the scalar product.

What the number measures

Drop a perpendicular from the head of b onto the line of a. The piece of a’s line between the tail and the foot of that perpendicular is the part of b lying along a, called the projection of b on a. The dot product is the length of a times that projection.

In a right triangle with hypotenuse |b| and the angle θ between a and b, the projection is the side next to θ, which is |b| cos θ. So the same number can be written a · b = |a| |b| cos θ.

In the lesson’s second figure, a = (4, 3) and b = (1, 4). The components give a · b = 4 × 1 + 3 × 4 = 4 + 12 = 16. The length of a is √(4² + 3²) = 5, so the projection of b on a is 16 ÷ 5 = 3.2.

b along aab

a = (3, 1) and b = (2, 4). The gold projection of b along a is 10 ÷ √10 = √10, which is 3.16 to 2 decimal places, and the length of a is also √10, so a · b = √10 × √10 = 10, the number the components gave.

Why the two give the same number

Draw a and b from one point, and join their heads. The third side is the vector b − a, and the angle between a and b is θ. The cosine rule on this triangle gives |b − a|² = |a|² + |b|² − 2|a| |b| cos θ.

Now work out the left side from the components. |b − a|² = (b₁ − a₁)² + (b₂ − a₂)², which multiplies out to a₁² + a₂² + b₁² + b₂² − 2(a₁b₁ + a₂b₂), and that is |a|² + |b|² − 2(a₁b₁ + a₂b₂).

The two right-hand sides are equal, and the squared lengths cancel, so a₁b₁ + a₂b₂ = |a| |b| cos θ. The rule with components and the length times the projection are the same number.

Check it with a = (3, 1) and b = (2, 4). Then |a|² = 10, |b|² = 20 and b − a = (−1, 3), so |b − a|² = 1 + 9 = 10. The cosine rule gives 10 = 10 + 20 − 2|a| |b| cos θ, so |a| |b| cos θ = 10, the same as the components gave.

xyabb − a

a = (3, 1), b = (2, 4), and the third side b − a = (−1, 3), from the head of a to the head of b.

Biggest when the two line up

For two vectors of fixed lengths, only cos θ can change, and cos θ is largest, 1, when θ = 0°. So the dot product is biggest when the two vectors point the same way, and then it is |a| |b|.

The sign tells you about the angle. For an acute angle cos θ is positive, so the dot product is positive. For an obtuse angle cos θ is negative, the projection points backward along a, and the dot product is negative: (2, 1) · (−3, 1) = −6 + 1 = −5, so those two vectors meet at an obtuse angle.

abθ = 60°shadow |b| cos θ 1.5

the shadow lies along a, so a · b = |a| × shadow is positive: 6

Swing b until a · b = 0

a has length 4 and b has length 3. At θ = 60°, the projection of b on a’s line is 3 cos 60° = 1.5, so a · b = 4 × 1.5 = 6. Swing b round: at 0° the dot product is 12, its largest; at 90° the projection shrinks to nothing; past 90° it points against a and the dot product is negative, down to −12 at 180°.

Zero at a right angle

When the two vectors are perpendicular, the perpendicular from the head of b lands at the tail of a, so the projection has length 0 and a · b = 0. In the other form, cos 90° = 0. Two vectors that are not zero are perpendicular exactly when their dot product is 0.

For a = (4, 1) and b = (−1, 4): a · b = 4 × (−1) + 1 × 4 = −4 + 4 = 0, so they meet at a right angle.

That pair shows a quick way to find a perpendicular vector: swap the two components and change the sign of one. Turning (p, q) a quarter turn gives (−q, p), and (p, q) · (−q, p) = −pq + qp = 0 for every p and q.

ab

a = (4, 1) and b = (−1, 4) meet at a right angle, and a · b = −4 + 4 = 0.

A vector with itself, and two rules

A vector dotted with itself gives its length squared, because the angle is 0° and cos 0° = 1: (3, 4) · (3, 4) = 9 + 16 = 25 = 5².

The order does not matter, a · b = b · a, because 3 × 2 + 1 × 4 is the same sum as 2 × 3 + 4 × 1. And the dot product distributes over addition: a · (b + c) = a · b + a · c. With a = (3, 1), b = (2, 4) and c = (1, −1), b + c = (3, 3) and a · (b + c) = 9 + 3 = 12; separately, a · b = 10 and a · c = 3 − 1 = 2, which also add to 12.

With three components, each matching pair is multiplied in the same way and all three products are added.

The usual mistakes

Leaving the answer as a pair. (3, 1) · (2, 4) is not (6, 4): the two products are added, and the dot product is the single number 10.

Pairing across with up. 3 × 4 + 1 × 2 = 14 multiplies components in different places; only matching places are multiplied.

Swapping the components without changing a sign. (1, 4) is not perpendicular to (4, 1): their dot product is 4 + 4 = 8. The quarter turn is (−1, 4).

Reversing the vector to make it perpendicular. (−4, −1) points the opposite way to (4, 1), and their dot product is −16 − 1 = −17, as negative as two vectors of those lengths can give, not zero.

Work done by a force

In mechanics, the work done by a force F that moves an object through a displacement d is the dot product F · d. Only the part of the force along the motion does work, and that is exactly what the dot product counts. A force pointing partly against the motion gives a negative dot product: it does negative work. The application below works out both for a trolley pulled up a ramp.

Worked example: The Work Done Pulling a Trolley Up a Loading Ramp

Question A trolley is pulled 10 m up a straight loading ramp. With components along the ground and straight up, in meters, its displacement is d = 86. The rope pulls with a force F = 4060 N, and the trolley's weight is W = 0−100 N. The work done by a force, in joules, is the dot product of the force and the displacement. (a) Find the work done by the rope. (b) Find the work done by the weight, and say what its sign means.

  1. 1.The dot product multiplies matching components and adds the products: F · d = 40 × 8 + 60 × 6.

    246246810meters along the groundmeters updFWF · d = 40 × 8 + 60 × 6
    246246810meters along the groundmeters updFWF · d = 40 × 8 + 60 × 6
    The forces are drawn at 1 m for every 50 N. The dot product multiplies matching components and adds: F · d = 40 × 8 + 60 × 6.
  2. 2.(a) F · d = 320 + 360 = 680, so the rope does 680 J of work.

    246246810meters along the groundmeters updFWF · d = 320 + 360 = 680the rope does 680 J
    246246810meters along the groundmeters updFWF · d = 320 + 360 = 680the rope does 680 J
    (a) F · d = 320 + 360 = 680, so the rope does 680 J of work.
  3. 3.For the weight: W · d = 0 × 8 + (−100) × 6 = −600.

    246246810meters along the groundmeters upd6 mFWW · d = 0 × 8 + (−100) × 6 = −600
    246246810meters along the groundmeters upd6 mFWW · d = 0 × 8 + (−100) × 6 = −600
    For the weight, only the rise counts: W · d = 0 × 8 + (−100) × 6 = −600.
  4. 4.(b) The weight does −600 J of work. The sign is negative because the weight points down while the trolley rises: the weight acts against the motion. Only the rise of 6 m counts, and 100 × 6 = 600.

    246246810meters along the groundmeters upd6 mFWthe weight does −600 Jit points down while the trolley rises
    246246810meters along the groundmeters upd6 mFWthe weight does −600 Jit points down while the trolley rises
    (b) The weight does −600 J of work: it points down while the trolley rises, so it acts against the motion.
  5. 5.Check: √82 + 62 = 10 m, the length of the ramp. The part of the pull along the ramp is 68010 = 68 N, less than the full pull √402 + 602 ≈ 72.1 N, because the rope is angled above the ramp.

    246246810meters along the groundmeters upd, 10 m6 mFW82+ 62= 100, and√100 = 10 m of ramp680 J over 10 m: 68 N of the pull is along the ramp
    246246810meters along the groundmeters upd, 10 m6 mFW82+ 62= 100, and√100 = 10 m of ramp680 J over 10 m: 68 N of the pull is along the ramp
    Check: the ramp is √82 + 62 = 10 m long, and 68010 = 68 N of the pull is along it, less than the whole 72.1 N, because the rope is angled above the ramp.

Answer: (a) 680 J; (b) −600 J: the weight acts against the motion

Common mistakes

  • Multiplying the magnitudes, 72.1 × 10 = 721 J. That counts the whole pull as if the rope were in line with the ramp; the dot product counts only the part along the motion.
  • Dropping the minus sign and giving 600 J for the weight. The weight acts against the motion up the ramp, and the negative sign is how the dot product says so.

More vectors in the plane problems, worked step by step →

Practice The Dot Product in the app