Calculate the dot product (scalar product) of two vectors in 3D space.
Last updated: April 2026 | By Patchworkr Team
The dot product (also called scalar product or inner product) is a fundamental operation in linear algebra and vector mathematics that combines two vectors to produce a single scalar value. Mathematically, for vectors A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃), the dot product is calculated as A · B = a₁b₁ + a₂b₂ + a₃b₃. This operation reveals deep geometric and physical meaning: it simultaneously measures how much the vectors align in direction and scales based on their magnitudes. The dot product is commutative (A · B = B · A) and distributive over addition, making it algebraically elegant. It appears in countless real-world computations, from calculating work in physics to determining orthogonality in computer graphics to measuring similarity in machine learning algorithms. When the dot product equals zero, the vectors are perpendicular—a property used extensively in 3D graphics, structural engineering, and orthogonal decomposition problems.
The geometric interpretation of the dot product is equally powerful: A · B = |A| × |B| × cos(θ), where θ is the angle between the two vectors and |A|, |B| are their magnitudes. This formula explains why the dot product is maximum when vectors point in the same direction (θ = 0°, cos = 1) and minimum when they oppose (θ = 180°, cos = -1). A positive dot product indicates that the vectors share a common directional component, a negative result shows opposition, and zero indicates perpendicularity. This relationship makes the dot product invaluable for computing projections: the magnitude of the projection of vector A onto vector B is (A · B) / |B|. In physics, this translates directly to real applications—calculating the work done by a force (work = force · displacement) or power (power = force · velocity). In computer graphics, dot products determine lighting (normal · lightDirection) and visibility. The dot product also appears in statistics for covariance and correlation calculations, binding together diverse fields through a single elegant mathematical operation.
Identify your two vectors and their components
You need exactly 3 components (i, j, k) for each vector in 3D space. In 2D, you'd use just i and j. Make sure you clearly label which component is which to avoid errors.
Multiply corresponding components together
Multiply the first components (both i values), then multiply the second components (both j values), then the third (both k values). This step extracts the aligned components of each vector pair.
Add all three products together
Sum the results from step 2: (a₁×b₁) + (a₂×b₂) + (a₃×b₃). This accumulation combines the directional agreement across all dimensions into a single scalar value.
Interpret the result to understand vector relationship
Positive result = vectors point generally the same way; Zero = perpendicular; Negative = vectors point generally opposite ways. This interpretation is key for applications like determining lighting angle or force alignment.
Optional: Calculate the angle between the vectors
Use the formula cos(θ) = (A · B) / (|A| × |B|) to find the exact angle. First compute magnitudes: |A| = √(a₁² + a₂² + a₃²), then use inverse cosine on the result to get θ in degrees or radians.
Force and Displacement Work Calculation
Dot product returns a scalar (single number), while cross product returns a vector. Dot product measures parallel component, cross product measures perpendicular component.
When the vectors are perpendicular (at 90° angle) or when one vector is a zero vector.
Yes. A negative dot product indicates the vectors point in generally opposite directions (angle > 90°).
It measures the similarity of direction. It's the product of magnitudes and the cosine of the angle between them.
It calculates work (force · displacement), power (force · velocity), and determines if forces are aligned.
The concept is the same, but 2D has two components while 3D has three. The formula extends naturally.
The formula generalizes: multiply corresponding components and sum them all, regardless of dimension.
Yes, with complex conjugate: A · B = Σ(aᵢ × conj(bᵢ)). Real vectors don't need conjugates.
Related Tools
Calculate centroid.
Calculate cross-sectional area.
Calculate cylindrical coordinates.
Calculate direction vector.
Calculate distance between points.
Calculate point-to-plane distance.