The dot product has two formulas, and students often freeze deciding which one to apply — then stumble again on how to turn cosθ into an actual angle. Both hesitations have the same fix.

The short version: the dot product can be computed either from components (a·b = a₁b₁ + a₂b₂) or from the definition (a·b = |a||b|cosθ), and both give the same number. Use the component formula when you have coordinates, and the definition when you know magnitudes and the angle. This article works through both, covers the angle between vectors, and connects the topic to physics.

Two formulas, one result

The dot product a·b is an operation that turns two vectors into a single number — a scalar, not a vector. That is its defining surprise.

Formula Form When to use
Component form a·b = a₁b₁ + a₂b₂ (+ a₃b₃) When components are known; multiply and add
Geometric definition a·b = |a| |b| cosθ When magnitudes and the angle are known

Because both sides agree, rearranging yields the angle formula: cosθ = (a·b) ÷ (|a| |b|). Compute the dot product from components, combine with the magnitudes, and the angle falls out.

The dot product also behaves like ordinary multiplication in useful ways: a·b = b·a, and it distributes over addition, a·(b + c) = a·b + a·c. One caution follows from the scalar result — chained products like (a·b)·c are not defined, since a·b is just a number.

Worked examples

Example 1: 2D — a = (3, 4), b = (4, 3)

The dot product is a straight substitution: a·b = 3 × 4 + 4 × 3 = 24.

Magnitudes come from the Pythagorean theorem:

|a| = √(3² + 4²) = √25 = 5, |b| = √(4² + 3²) = √25 = 5

The angle follows from cosθ = 24 ÷ (5 × 5) = 0.96, and the inverse cosine gives θ ≈ 16.26°.

Example 2: 3D — a = (1, 2, 2), b = (2, 3, 6)

Three dimensions add one term: a·b = 1 × 2 + 2 × 3 + 2 × 6 = 20, with |a| = √9 = 3 and |b| = √49 = 7.

Then cosθ = 20 ÷ (3 × 7) = 20/21 ≈ 0.9524, so θ ≈ 17.75°. Same reasoning as 2D, one extra component.

Example 3: testing perpendicularity

For a = (1, 0) and b = (0, 1): a·b = 1 × 0 + 0 × 1 = 0. A zero dot product forces cosθ = 0, so θ = 90° — the vectors are perpendicular. “a·b = 0 ⇔ perpendicular” is the single most useful test in this topic.

What the sign tells you

Even before computing an angle, the sign of the dot product summarizes how two directions relate:

Dot product Angle Relationship
a·b > 0 0° to 90° (acute) Pointing in similar directions
a·b = 0 90° Perpendicular
a·b < 0 90° to 180° (obtuse) Pointing in opposing directions

For instance a = (−1, 2), b = (3, 1): a·b = −3 + 2 = −1 < 0, so the angle is obtuse (about 98.1°) — visible before any angle computation.

When components are unknown but magnitudes and the angle are given, the definition applies directly: with |a| = 4, |b| = 2 and θ = 60°, the dot product is 4 × 2 × cos60° = 4.

Three common mistakes: drawing an arrow over the answer — the dot product is a number, not a vector (scalar multiples and vector sums return vectors); misaligning components, multiplying a₁ by b₂ instead of pairing corresponding components; and attempting the angle against a zero vector, whose direction is undefined. Write the component pairs in columns before multiplying and none of these survive.

The physics payoff: work

Where the dot product shines is work in physics. A force F acting through a displacement s does W = |F| |s| cosθ of work — the dot product itself. A 20 N force applied at 60° across a 5 m displacement does W = 20 × 5 × cos60° = 100 × 0.5 = 50 J. When the force is perpendicular to the motion, the work is zero — which is why carrying a lifted box horizontally involves no work against gravity. The same computation drives lighting in games and computer graphics.

Verify with the tool

Tools Hub’s Vector Calculator computes the dot product, magnitudes and the angle between 2D or 3D vectors with the substituted component formula and cosθ steps shown. Everything runs locally in your browser.

How to use it (3 steps)

1

Pick the dimension

Choose the 2D or 3D tab — the third-component inputs appear or disappear automatically.

2

Enter the components

Fill in a and b. Preset buttons for perpendicular (90°) and parallel (0°) demonstrate the special cases.

3

Read dot product, magnitudes and angle

The result card shows a·b and |a|, |b|; the panels below substitute your numbers into the component formula and cosθ, ending in degrees and radians.

The tool featured in this article

Vector Calculator

Dot product, magnitudes and angle with fully substituted working. 2D and 3D support, perpendicular and parallel tests, free and browser-based.

Try it now

To reproduce the examples, pick the 2D tab and enter a = (3, 4), b = (4, 3) to read 24, 5, 5 and 16.26° with the substitution shown; the 3D tab handles (1, 2, 2) and (2, 3, 6) the same way.

For the trigonometric values behind the angles, see the guide to deriving trig values; for tidying the fractions that appear, see working with fractions.

Summary

  • Two formulas produce the same number: a·b = a₁b₁ + a₂b₂ and a·b = |a| |b| cosθ
  • Magnitudes come from √(a₁² + a₂²); the angle comes from cosθ = (a·b) ÷ (|a| |b|) via inverse cosine
  • The sign classifies instantly: positive acute, zero perpendicular, negative obtuse
  • Physics work W = |F| |s| cosθ is a dot product; perpendicular force does zero work
  • Verify results with a tool that shows its working; the angle against a zero vector is undefined

FAQ

What is the difference between the dot product and scalar multiplication?

Scalar multiplication c·a scales a vector and returns a vector. The dot product a·b returns a number. Because the outputs differ, writing an arrow over a dot product answer is incorrect.

Why does a·b = 0 mean the vectors are perpendicular?

In the definition a·b = |a| |b| cosθ, positive magnitudes with a zero product force cosθ = 0. The angle with zero cosine is 90° — the definition of perpendicular.

Is the angle always between 0° and 180°?

Yes. The angle between two vectors measures how far apart their directions point, from 0° (same direction) to 180° (opposite). No negative angles appear, which is why the inverse cosine result is used as-is.

How does 3D differ from 2D?

One more component in every formula: a·b = a₁b₁ + a₂b₂ + a₃b₃. Magnitudes and angles follow the identical reasoning, and the tool’s dimension tab switches between them with the same workflow.

References

  • OpenStax, Algebra and Trigonometry 2e, Section 10.8 “Vectors” (component form, magnitude, both dot product formulas and the angle): openstax.org