Dot Product Calculator
The universal vector dot product calculator for calculating scalar products in 2D and 3D space, finding the exact angle (θ) between vectors, testing perpendicular orthogonality, and computing vector projections.
2D Plane Vector & Angle Projection
(xy-plane projection)Step-by-Step Mathematical Derivation Algebraic & Geometric Steps
How to Calculate the Vector Dot Product
To calculate the dot product of two vectors a and b, multiply their matching coordinates and sum the resulting products: a · b = (a_x * b_x) + (a_y * b_y) in 2D, or (a_x * b_x) + (a_y * b_y) + (a_z * b_z) in 3D. The result is always a single real scalar number. Geometrically, the dot product equals the product of their Euclidean lengths multiplied by the cosine of the angle between them: a · b = ||a|| ||b|| cos(θ). If the dot product is positive, the angle is acute (< 90°); if zero, the vectors are exactly orthogonal (90°); and if negative, the angle is obtuse (> 90°).
Anatomy of the Dot Product: Algebraic vs Geometric Forms
The dot product (frequently termed the scalar product or inner product) is one of the foundational algebraic operations in vector mathematics and physics. While vector addition and subtraction produce new vectors pointing in new directions, and the Cross Product Calculator computes a perpendicular vector in three dimensions, the dot product condenses two vectors into a single real scalar number.
The dot product can be defined through two equivalent perspectives that bridge analytic coordinate geometry with pure trigonometric intuition:
In Cartesian coordinates, multiply corresponding components and sum the products:
Effortless to evaluate numerically across any number of dimensions.
Multiply the Euclidean lengths of both vectors by the cosine of the angle between them:
Provides geometric meaning: directional alignment and physical work.
Because both equations yield identical scalar results, equating them creates an indispensable mathematical bridge that allows you to calculate the physical angle between vectors without measuring tools.
Angle Between Vectors & The Orthogonality Test
Solving the geometric formulation for cos(θ) produces the universal angle formula between two vectors, bridging vector geometry with classical trigonometry (compare with our Angle from Sides Calculator and Coterminal Angles Explorer):
where θ is restricted to the principal range 0° ≤ θ ≤ 180° (0 to π radians).
Because the magnitudes ||a|| and ||b|| are always positive for non-zero vectors, the arithmetic sign of a · b depends entirely on cos(θ), categorizing the relationship into three distinct angular regimes:
Acute Angle (θ < 90°)
Both vectors point generally in the same direction. The cosine of an acute angle is positive.
Orthogonal (θ = 90°)
The vectors are strictly perpendicular. Because cos(90°) = 0, their scalar product vanishes completely.
Obtuse Angle (θ > 90°)
The vectors point in opposing directions. The cosine of an obtuse angle is negative.
The Cauchy-Schwarz Inequality & Fundamental Properties
The dot product satisfies several vital algebraic laws that make vector spaces mathematically rigorous:
Connecting these properties leads to one of the most celebrated theorems in all of mathematics: the Cauchy-Schwarz Inequality:
Equality holds if and only if vectors a and b are linearly dependent (parallel or anti-parallel).
Scalar & Vector Projections in Physics and 3D Space
A fundamental application of the dot product is computing the "shadow" or component of one vector cast onto another (for dedicated step-by-step orthogonal decompositions, explore our Vector Projection Calculator):
The signed length of vector a in the direction of vector b:
Outputs a scalar number representing magnitude along line b.
The actual vector pointing along b with length equal to the scalar projection:
Outputs a vector collinear with vector b.
Cosine Similarity in Machine Learning & Embeddings
In contemporary artificial intelligence, large language models (LLMs) and neural networks map words, code, and documents into high-dimensional vector spaces (frequently 768 to 3,072 dimensions).
To determine whether two passages of text share similar semantic meaning, engineers evaluate the Cosine Similarity between their embedding vectors using the normalized dot product:
Returns +1 for identical direction (identical meaning), 0 for orthogonal (unrelated), and -1 for opposing direction.
Because modern AI vector databases (such as Vectorize or Pinecone) store unit-normalized vectors (||u|| = 1), calculating cosine similarity reduces to a pure hardware-accelerated dot product: Similarity = u · v. When computing similarity across thousands of candidate document vectors simultaneously, this operation corresponds directly to row-column inner products implemented in our Matrix Multiplication Calculator and general Matrix Calculator.
Engineering Applications: Lighting, Mechanics & Graphics
3D Computer Graphics
Lambertian diffuse shading computes N · L (surface normal dot light direction) for billions of pixels every second in video games to shade 3D polygons realistically.
Classical Physics
Mechanical work is defined as W = F · d. If force is exerted perpendicular to motion (such as centripetal force in planetary orbits), no mechanical work is performed.
Aerospace Navigation
Inertial navigation platforms and flight guidance systems take dot products between attitude sensors and Earth's gravitational vector to calculate pitch, roll, and course deviation.
Step-by-Step Worked Examples in 2D and 3D
Calculate the dot product of a = 〈3, 4〉 and b = 〈-4, 3〉.
Given a = 〈1, 2, 3〉 and b = 〈4, -1, 2〉, find a · b and the angle θ.
Common Calculation Pitfalls & Cross Product Confusion
Expecting a Vector Output
The dot product is a scalar, not a vector. The answer is a single number (e.g. 5), never a tuple like 〈3, -8, 10〉. For a vector output perpendicular to both 3D vectors, use our Cross Product Calculator.
Dimensional Incompatibility
You cannot take the dot product of a 2D vector with a 3D vector directly. Either embed the 2D vector into 3D by setting z = 0 or restrict computation to 2 dimensions.
Orthogonal Eigenspaces
In linear algebra and spectral analysis, symmetric transformation matrices produce mutually orthogonal eigenvectors (v_1 · v_2 = 0). To explore these bases, visit our comprehensive Eigenvalue & Eigenvector Calculator.
Assuming Scalar Associativity
Writing (a · b) · c is mathematically meaningless because a · b is a scalar, and you cannot take the dot product of a scalar with a vector c.
Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.
Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.