Report

Help us improve this tool

Dot Product Calculator

Calculate the dot product of two or more vectors instantly. Free online dot product calculator with step-by-step solutions for vectors in 2D, 3D and n-dimensional space.

O M T

What is a Dot Product?

The dot product (also called the scalar product or inner product) is an algebraic operation that takes two equal-length sequences of numbers (vectors) and returns a single number. For vectors a and b, the dot product is calculated by multiplying corresponding components and summing the results:

a · b = a₁b₁ + a₂b₂ + ... + aₙbₙ

The dot product is named after the dot symbol (·) used to denote it. It is one of the most important operations in vector algebra and has widespread applications in physics, engineering, computer graphics, and machine learning.

Geometric Interpretation

Geometrically, the dot product of two vectors can also be expressed as:

a · b = |a| × |b| × cos(θ)

Where |a| and |b| are the magnitudes (lengths) of the vectors, and θ (theta) is the angle between them. This relationship between the dot product and the cosine of the angle makes it invaluable for calculating angles between vectors.

Key Properties of the Dot Product

Commutative

a · b = b · a

Distributive

a · (b + c) = a · b + a · c

Scalar Multiplication

(ka) · b = k(a · b)

Self Dot Product

a · a = |a|²

Applications of Dot Product

The dot product is a fundamental tool used across numerous fields:

  • Computer Graphics: Calculating lighting, shading, and reflections using surface normals
  • Machine Learning: Computing similarity between feature vectors and neural network operations
  • Physics: Calculating work done by a force (W = F · d) and power (P = F · v)
  • Physics: Finding the component of a vector in a given direction
  • Game Development: Determining if objects are in front of or behind a character using matrix operations
  • Mathematics: Checking orthogonality (perpendicular vectors have dot product = 0) — see also cross product
  • Engineering: Analyzing forces, moments, and structural loads

How to Calculate the Dot Product

  1. Align components: Write the vectors with their corresponding components aligned
  2. Multiply: Multiply each pair of corresponding components
  3. Sum: Add all the products together
  4. Optional: Compute magnitudes and angle between vectors

Common Examples

Example 1: 2D Vectors

a = ⟨3, 4⟩, b = ⟨2, 1⟩

a · b = (3)(2) + (4)(1) = 6 + 4 = 10

Example 2: 3D Vectors

a = ⟨3, 5, 8⟩, b = ⟨2, 7, 1⟩

a · b = (3)(2) + (5)(7) + (8)(1) = 6 + 35 + 8 = 49

Example 3: Perpendicular Vectors

a = ⟨1, 0⟩, b = ⟨0, 1⟩

a · b = (1)(0) + (0)(1) = 0 (cos 90° = 0, so the angle is 90°)

Tips for Using the Dot Product Calculator

  • Enter vectors as comma-separated numbers (e.g., 3, 5, 8)
  • All vectors must have the same number of components (dimensions)
  • You can compute dot products of 2 or 3 vectors simultaneously
  • The calculator automatically shows the angle between two vectors
  • Review the step-by-step calculation to understand the process
  • Use the sample button to load the default example

Frequently Asked Questions

What is the difference between dot product and cross product?

The dot product takes two vectors and produces a scalar (a single number), while the cross product takes two vectors and produces a third vector perpendicular to both. The dot product measures similarity or alignment, while the cross product measures perpendicularity and area.

What does a dot product of zero mean?

A dot product of zero means the vectors are perpendicular (orthogonal) to each other. This is because cos(90°) = 0, so a · b = |a||b|cos(90°) = 0. This property is widely used in computer graphics and physics to detect right angles.

Can I compute the dot product of more than two vectors?

Yes, the dot product can be extended to multiple vectors. For three vectors a, b, and c, you compute a₁b₁c₁ + a₂b₂c₂ + ... + aₙbₙcₙ. Our calculator supports up to 3 vectors simultaneously for your convenience.

What is the relationship between dot product and vector magnitude?

The magnitude (length) of a vector is related to the dot product by |a| = √(a · a). This means the dot product of a vector with itself equals the square of its magnitude. This relationship is used to calculate vector lengths in any number of dimensions.

How is dot product used in machine learning?

In machine learning, dot products are fundamental to neural network operations. Each neuron computes a dot product between its input vector and weight vector, then applies an activation function. Dot products are also used in attention mechanisms, similarity measures (cosine similarity), and support vector machines (SVMs).

Can I use negative numbers in my vectors?

Yes, vectors can contain both positive and negative numbers. The dot product handles negative components naturally - the product of two negative numbers is positive, and the sign of the final result depends on all component products combined.