terican

Last verified · v1.0

Calculator · math

Dot Product Calculator

Compute the dot product of two 2D or 3D vectors by entering their components. Returns the scalar result instantly.

FreeInstantNo signupOpen source

Inputs

Dot Product

Explain my result

0/3 free

Get a plain-English breakdown of your result with practical next steps.

Dot Product

The formula

How the
result is
computed.

What Is the Dot Product?

The dot product (also called the scalar product or inner product) is a fundamental vector operation that takes two vectors and returns a single scalar value. Unlike cross multiplication, which yields another vector, the dot product collapses two vectors into one real number — making it indispensable in physics, engineering, computer graphics, and machine learning.

The Dot Product Formula

For two vectors A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃) in three-dimensional space, the algebraic definition is:

A · B = a₁b₁ + a₂b₂ + a₃b₃

For two-dimensional vectors A = (a₁, a₂) and B = (b₁, b₂), the formula simplifies to:

A · B = a₁b₁ + a₂b₂

According to Whitman College Calculus Online, Section 12.3, this algebraic definition is equivalent to the geometric formula A · B = |A||B|cos(θ), where |A| and |B| are the magnitudes of each vector and θ is the angle between them. Both definitions are provably equivalent and together give the dot product its full power.

Derivation and Geometric Meaning

The algebraic definition emerges from expanding the geometric formula using the law of cosines. For a third vector C = A − B, the squared magnitude |C|² = |A|² + |B|² − 2|A||B|cos(θ). Expanding each magnitude in component form and simplifying yields the multiply-and-sum rule directly.

As demonstrated in MIT OpenCourseWare Multivariable Calculus, Lecture 1, this equivalence is essential: it means the dot product simultaneously encodes algebraic structure and angular geometry, enabling engineers and scientists to extract angle information from pure component arithmetic.

Variables Explained

  • a₁, a₂, a₃ — The x, y, and z components of Vector A. These accept any real numbers: positive, negative, or zero.
  • b₁, b₂, b₃ — The x, y, and z components of Vector B, aligned to the same coordinate axes.
  • Result (scalar) — The dot product output is always a single real number, never a vector.
  • θ (theta) — The angle between the vectors, recoverable via θ = arccos(A · B / (|A||B|)).

Key Algebraic Properties

  • Commutative: A · B = B · A
  • Distributive: A · (B + C) = A · B + A · C
  • Scalar associativity: (kA) · B = k(A · B) for any scalar k
  • Self dot product: A · A = |A|², the square of the vector magnitude

Geometric Interpretation of the Result

The sign of the dot product directly encodes the angle between the two vectors. A positive result means θ < 90° — the vectors lean toward each other. A zero result means θ = 90° — the vectors are perpendicular (orthogonal). A negative result means θ > 90° — the vectors point in broadly opposing directions. This sign test is the standard method for verifying orthogonality in linear algebra.

Worked Examples

Example 1 — 3D Dot Product

Let A = (3, −2, 5) and B = (1, 4, −1). Then: A · B = (3)(1) + (−2)(4) + (5)(−1) = 3 − 8 − 5 = −10. The negative result confirms the vectors form an obtuse angle greater than 90°.

Example 2 — Physics: Work Calculation

A force F = (6, 4) N pushes an object along displacement d = (3, 0) m. Work W = F · d = (6)(3) + (4)(0) = 18 joules. Only the force component aligned with displacement contributes energy — the perpendicular component does zero work.

Example 3 — Orthogonality Check

Are A = (2, 3) and B = (−3, 2) perpendicular? A · B = (2)(−3) + (3)(2) = −6 + 6 = 0. The zero result confirms orthogonality.

Real-World Applications

  • Physics: Work equals the dot product of force and displacement (W = F · d); power equals force dotted with velocity.
  • Computer graphics: Lambertian shading models compute brightness as the dot product of the surface normal and incoming light direction vector.
  • Machine learning: Fully connected neural network layers perform dot products between weight vectors and input activations at every node.
  • Search and NLP: Cosine similarity — used in search engines, recommendation systems, and embedding comparisons — is derived directly from the dot product formula.

Reference

Frequently asked questions

What does the dot product calculator compute?
The dot product calculator multiplies corresponding components of two vectors and sums all the products, returning one scalar number. For 3D vectors A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃), it evaluates a₁b₁ + a₂b₂ + a₃b₃. For 2D mode, the z-component terms are omitted. The scalar result encodes the angular relationship between the vectors and underpins applications in physics, computer graphics, and machine learning.
What is the difference between the dot product and the cross product?
The dot product of two vectors returns a scalar — a single real number — while the cross product returns a new vector perpendicular to both inputs. For example, A · B = −10 is a scalar, whereas A × B yields a directional vector. The dot product measures how much two vectors align and is used for angle detection, projection, and work calculations; the cross product measures perpendicularity and is used for surface normals and torque.
How do you find the angle between two vectors using the dot product?
Rearrange the geometric dot product formula to isolate the angle: θ = arccos(A · B / (|A| × |B|)), where |A| and |B| are the magnitudes of each vector. For example, with A = (1, 0) and B = (1, 1), the dot product equals 1, |A| = 1, |B| = √2, giving θ = arccos(1/√2) = 45°. This technique is the standard method in robotics, computer graphics, and physics for determining angular separation between direction vectors.
When is the dot product equal to zero?
The dot product equals zero precisely when the two vectors are perpendicular (orthogonal) — that is, when the angle between them is exactly 90°. For instance, A = (1, 0) and B = (0, 1) give A · B = (1)(0) + (0)(1) = 0, confirming a right angle. This zero-test is the fastest algebraic method for verifying orthogonality in linear algebra, structural engineering, and 3D modeling without computing any trigonometric functions.
Can the dot product result be negative?
Yes, the dot product can be negative. A negative result occurs when the angle between the two vectors exceeds 90°, meaning they point in broadly opposing directions. For example, A = (3, 0) and B = (−2, 0) yield A · B = −6. The geometric definition A · B = |A||B|cos(θ) makes this clear: cos(θ) is negative for any angle between 90° and 270°, so the entire product is negative. Magnitudes are always non-negative, so only the cosine term determines the sign.
What are real-world applications of the dot product?
The dot product drives calculations across many disciplines. In physics, work equals force dotted with displacement (W = F · d). In computer graphics, lighting engines dot surface-normal vectors with light-direction vectors to determine per-pixel brightness (Lambertian shading). In machine learning, every dense neural network layer computes dot products between weight and input vectors. In information retrieval and NLP, cosine similarity — the normalized dot product — measures how closely two text embeddings match in semantic meaning.