Uni-Sine
MathematicsVectors and matrices

Dot product calculator

A dot product calculator multiplies two vectors to give a single number: multiply the matching components and add them. For a = (a₁, a₂) and b = (b₁, b₂), a · b = a₁b₁ + a₂b₂. Our Vector Calculator gives the dot product in 2D and 3D, and the angle between the vectors, which is what the dot product is mostly used for.

Choose Two Vectors mode for 2D, or 3D mode for vectors with a z component. It opens in Single mode, which has only one vector, so switching mode is the first step. The dot product is also called the scalar product.

Try it

Vectors Calculator

Visualise magnitude, direction and operations

Go to its page

How to use the dot product calculator

  1. Under Mode, choose Two Vectors for 2D or 3D.
  2. In Vectors, type the components of a and b, or drag the arrows on the grid.
  3. Read the dot product, a · b, and the angle θ between the vectors in Results.
  4. Open Formulas to see the dot product and the angle formula with your numbers in.

Angles are in degrees unless you switch Degrees off under Display. 3D mode also gives each vector's magnitude and the cross product.

The dot product formula

In components, add the products of matching components:

\vec{a} \cdot \vec{b} = a_1b_1 + a_2b_2 + a_3b_3Leave out the third term for 2D vectors

Geometrically, the dot product is the product of the lengths and the cosine of the angle between them, which rearranges to give the angle:

\vec{a} \cdot \vec{b} = |\vec{a}||\vec{b}|\cos\theta \Rightarrow \cos\theta = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}||\vec{b}|}

Worked examples you can check in the calculator

Example 1: dot product and angle in 2D

Find a · b and the angle between a = (4, 1) and b = (2, 5).

\vec{a} \cdot \vec{b} = 4 \times 2 + 1 \times 5 = 13

The magnitudes are |a| = √17 and |b| = √29, so cos θ = 13 ÷ √(17 × 29) = 0.5855 and θ = 54.16°. In Two Vectors mode, type both vectors: Results shows a · b = 13 and θ = 54.16°.

0123412345abθABO
The dot product gives the angle θ between the two vectors

Example 2: perpendicular vectors

For a = (3, −2) and b = (4, 6), a · b = 12 − 12 = 0. A dot product of 0 means the vectors are perpendicular, and the calculator shows θ = 90°. This is the quickest test for right angles between vectors.

Example 3: an obtuse angle

For a = (1, 2) and b = (−3, −1), a · b = −3 − 2 = −5. A negative dot product means the angle is obtuse, more than 90°: here it is 135°.

Example 4: 3D vectors

Find the angle between a = (2, −1, 3) and b = (4, 2, 1).

\vec{a} \cdot \vec{b} = 8 - 2 + 3 = 9

|a| = √14 and |b| = √21, so cos θ = 9 ÷ √294 = 0.5249 and θ = 58.34°. In 3D mode the calculator shows a · b = 9 and θ = 58.34°.

Check you have the formula:

practice
Pick an answer, then check it.
What is the dot product of (2, −3, 1) and (4, 1, −5)?

What the sign of the dot product tells you

Dot productAngle between the vectors
PositiveAcute, less than 90°
ZeroExactly 90°: perpendicular
NegativeObtuse, more than 90°

Where the dot product is used

  • Work done in physics: W = F · d. A force of (3, 4) N moving an object (5, 0) m does 3 × 5 + 4 × 0 = 15 J of work.
  • Projection: the length of a in the direction of b is a · b ÷ |b|. For Example 1 that is 13 ÷ √29 = 2.41.
  • Checking perpendicular lines and planes in geometry and mechanics.

For a vector at right angles to both a and b, use the cross product instead: see our cross product calculator guide. The vector calculator guide covers the rest of the tool.

Common mistakes

  • Writing the answer as a vector. The dot product is a scalar, a single number.
  • Multiplying the wrong components. Multiply x with x, y with y and z with z, then add.
  • Dropping negative signs. (−3) × 4 is −12. Use brackets.
  • Forgetting to divide by the magnitudes. cos θ = a · b ÷ (|a||b|), not just a · b.
  • Calculator in radians. cos⁻¹ gives radians unless your calculator is in degree mode.

Practise vectors in a short timed paper

Dot products come up in College Linear Algebra and AP Physics C: Mechanics practice, and in A-level Maths: Mechanics and A-level Further Maths in the UK. Each daily paper is a short timed paper of 8 questions worth 25 to 35 marks, and the papers mix topics.

Common questions

How do you calculate the dot product?
Multiply the matching components of the two vectors and add the results. For (4, 1) and (2, 5): 4 × 2 + 1 × 5 = 13.
How do you find the angle between two vectors?
Divide the dot product by the product of the magnitudes to get cos θ, then take the inverse cosine.
What does a dot product of zero mean?
The vectors are perpendicular, at 90° to each other, as long as neither is the zero vector.
Is the dot product the same as the scalar product?
Yes. It is called the scalar product because the answer is a scalar, a number.
What is the difference between the dot product and the cross product?
The dot product gives a number and measures how much two vectors point the same way. The cross product, for 3D vectors, gives a vector perpendicular to both.
Can the dot product be negative?
Yes, when the angle between the vectors is more than 90°.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Vectors Calculator

    Visualise magnitude, direction and operations

    Open the tool
  • Test it

    College Linear Algebra

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
  • Test it

    AP Physics C: Mechanics

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · Vectors and matricesAngle between two vectors calculator: 2D and 3DFind the angle between two vectors in 2D or 3D from the dot product, cos θ = a·b ÷ (|a||b|), with the magnitudes, worked examples and a quick check.