Dot Product Calculator
Calculate the dot product of two 2D or 3D vectors step by step, find the angle between them, and see whether they are perpendicular.
Try an example
Dot product (a scalar)
Acute angle. A · B > 0, so the angle between the vectors is acute (less than 90°): they point in broadly the same direction.
Component products
| Component | A | B | Product | |
|---|---|---|---|---|
| x | 3 | × | 1 | 3 |
| y | 4 | × | 2 | 8 |
| Sum = A · B | 11 | |||
Angle between the vectors
- |A|
- 5
- |B|
- √5 ≈ 2.2361
- cos θ = (A · B)/(|A||B|)
- ≈ 0.98387
- θ (degrees)
- ≈ 10.3048° (≈ 0.1799 rad)
- Scalar projection of A onto B, (A · B)/|B|
- 11 / √5 ≈ 4.9193
The scalar projection is how much of A lies in the direction of B: the length of A's shadow on B, negative when the angle is obtuse.
Step-by-Step Calculation
Step 1 — Multiply matching components
Pair the x-components, the y-components, and multiply each pair.
x: 3 × 1 = 3
y: 4 × 2 = 8
Step 2 — Add the products
The dot product is the sum of these products: a single number (a scalar), not a vector.
A · B = a₁b₁ + a₂b₂
= (3 × 1) + (4 × 2)
= 3 + 8
= 11
Step 3 — Magnitudes of A and B
|A| = √(3² + 4²) = 5
|B| = √(1² + 2²) = √5 ≈ 2.2361
Step 4 — Angle between the vectors
From A · B = |A||B| cos θ, the angle is θ = cos⁻¹((A · B)/(|A||B|)).
cos θ = 11 / (5 × √5)
≈ 0.98387
θ = cos⁻¹(0.98387) ≈ 10.3048°
Vector diagram
Dot product formula
2D dot product
A · B = a₁b₁ + a₂b₂
A = (a₁, a₂), B = (b₁, b₂)
3D dot product
A · B = a₁b₁ + a₂b₂ + a₃b₃
A = (a₁, a₂, a₃), B = (b₁, b₂, b₃)
Geometric form
A · B = |A||B| cos θ
θ is the angle between A and B, 0° ≤ θ ≤ 180°
Angle between vectors
θ = cos⁻¹((A · B) / (|A||B|))
Undefined if A or B is the zero vector
Scalar projection of A onto B
comp_B A = (A · B) / |B|
How much of A lies in the direction of B
Dot product vs cross product
| Dot product A · B | Cross product A × B | |
|---|---|---|
| Result | A scalar (a number) | A vector |
| Defined for | Vectors of any dimension (2D, 3D, …) | 3D vectors |
| Formula with the angle | |A||B| cos θ | |A × B| = |A||B| sin θ |
| Equals zero when | The vectors are perpendicular (or one is zero) | The vectors are parallel (or one is zero) |
| Order | A · B = B · A | A × B = −(B × A) |
| Typical use | Angles, projections, work W = F · d | Normals, torque, areas |
For a vector perpendicular to two 3D vectors, use the Cross Product Calculator. The Vector Calculator handles addition, subtraction, magnitude and unit vectors, and the Distance Formula Calculator gives the length of the vector between two points. For cos⁻¹ and other trigonometry, use the Scientific Calculator.
This dot product calculator finds the scalar product of two vectors. Enter the components of Vector A and Vector B in 2D (x, y) or 3D (x, y, z), and it shows A · B as the main result, with each pair of components multiplied and added step by step: for A = (3, 4) and B = (1, 2), A · B = (3 × 1) + (4 × 2) = 3 + 8 = 11.
The calculator also uses the dot product to find the angle between the vectors, in degrees or radians, tells you whether that angle is acute, a right angle (perpendicular vectors) or obtuse, and gives the scalar projection of A onto B. For 2D vectors, a diagram draws both vectors, the angle between them and the projection.
Worked Calculation Examples
| Scenario | Result | Calculation Step |
|---|---|---|
| Basic 2D: (3, 4) · (1, 2) | A · B = 11 | x: 3 × 1 = 3. y: 4 × 2 = 8. Sum: 3 + 8 = 11. The angle between them is cos⁻¹(11/(5√5)) ≈ 10.30°. |
| Perpendicular: (1, 2) · (2, −1) | A · B = 0 | 1 × 2 + 2 × (−1) = 2 − 2 = 0. Both vectors are nonzero, so they are perpendicular: θ = 90°. |
| Negative: (1, 0) · (−1, 1) | A · B = −1 | 1 × (−1) + 0 × 1 = −1. The dot product is negative, so the angle is obtuse: cos θ = −1/(1 × √2), θ = 135°. |
| 3D: (1, 2, 3) · (4, −1, 2) | A · B = 8 | 1 × 4 + 2 × (−1) + 3 × 2 = 4 − 2 + 6 = 8. |
What Is the Dot Product?
The dot product, also called the scalar product, combines two vectors of the same dimension into a single number. Multiply the matching components and add the results: (3, 4) · (1, 2) = 3 × 1 + 4 × 2 = 11.
The result is a scalar because every product of two components is a number, and adding numbers gives a number. There is no direction left over, which is the key difference from the cross product. The order does not matter: A · B = B · A.
Geometric Meaning: A · B = |A||B| cos θ
The dot product equals the product of the two lengths and the cosine of the angle between the vectors. Because |A| and |B| are never negative, the sign of A · B comes from cos θ, so for two nonzero vectors: a positive dot product means θ is less than 90° (the vectors point broadly the same way), zero means θ is exactly 90° (perpendicular, or orthogonal), and a negative dot product means θ is more than 90° (broadly opposite).
Rearranging gives the angle: θ = cos⁻¹((A · B)/(|A||B|)). For A = (3, 4) and B = (1, 2), |A| = 5 and |B| = √5, so cos θ = 11/(5√5) ≈ 0.9839 and θ ≈ 10.30°. If either vector is the zero vector, its magnitude is 0 and the angle is undefined, even though A · B = 0.
Projection: How Much of One Vector Lies Along Another
Dividing the dot product by the length of B gives the scalar projection of A onto B: (A · B)/|B| = |A| cos θ. It is the length of the shadow A casts on the line of B, and it is negative when the angle is obtuse. For A = (3, 4) and B = (1, 2), it is 11/√5 ≈ 4.92. This is how the dot product tells you how much of one vector points in the direction of another.
Where the Dot Product Is Used
In physics, the work done by a constant force F moving an object through a displacement d is W = F · d: only the part of the force along the direction of motion does work, so a force perpendicular to the motion does none.
In geometry and 3D mathematics, the dot product finds angles, tests whether lines or planes are perpendicular, and computes projections. Computer graphics uses it for lighting (the brightness of a surface depends on the angle between its normal and the light direction) and for checking whether a surface faces the camera. In robotics and engineering, it measures how closely two directions are aligned and resolves forces into components.
How to Use the Dot Product Calculator
- Choose 2D vectors (x, y) or 3D vectors (x, y, z). Both vectors always have the same number of components.
- Enter the components of Vector A: x₁, y₁ and, in 3D, z₁. The preview shows A in component form.
- Enter the components of Vector B: x₂, y₂ and, in 3D, z₂. The dot product updates as you type.
- Read the dot product A · B at the top of the result, then the table of component products that add up to it.
- Follow the step-by-step calculation, including the magnitudes |A| and |B| and the angle θ between the vectors, in degrees or radians.
- Check the interpretation (acute, perpendicular or obtuse) and, for 2D vectors, the diagram showing A, B, the angle and the projection of A onto B.
Frequently Asked Questions
What is the dot product?
An operation that takes two vectors of the same dimension and returns a number: multiply matching components and add. (3, 4) · (1, 2) = 3 + 8 = 11. It is also called the scalar product.
How do you calculate the dot product?
Multiply the x-components, multiply the y-components (and the z-components in 3D), then add the products. A · B = a₁b₁ + a₂b₂ + a₃b₃.
Is the dot product a scalar or a vector?
A scalar. Each component product is a number and their sum is a number, with no direction. The cross product, by contrast, gives a vector.
How do you calculate the dot product of 2D vectors?
For A = (a₁, a₂) and B = (b₁, b₂), A · B = a₁b₁ + a₂b₂. For example, (1, 2) · (2, −1) = 2 + (−2) = 0.
How do you calculate the dot product of 3D vectors?
Add a third term for the z-components: A · B = a₁b₁ + a₂b₂ + a₃b₃. For (1, 2, 3) · (4, −1, 2) = 4 − 2 + 6 = 8.
What does a dot product of zero mean?
If both vectors are nonzero, they are perpendicular (orthogonal): the angle between them is 90°, because cos 90° = 0. If one of them is the zero vector, the dot product is also 0, but the angle is undefined.
How do you find the angle between two vectors using the dot product?
Use θ = cos⁻¹((A · B)/(|A||B|)). For (1, 0) and (−1, 1): A · B = −1, |A| = 1, |B| = √2, so cos θ = −1/√2 and θ = 135°. The angle is always between 0° and 180°.
What does a negative dot product mean?
The angle between the two vectors is obtuse, more than 90°, so they point in broadly opposite directions. The most negative value, −|A||B|, occurs when they point exactly opposite ways (θ = 180°).
Can the dot product be negative?
Yes. Components can be negative, and so can their products. (1, 0) · (−1, 1) = −1. The sign tells you whether the angle is acute (positive), right (zero) or obtuse (negative).
What is the difference between the dot product and the cross product?
The dot product gives a scalar, works in any dimension and is largest when the vectors are parallel. The cross product gives a vector perpendicular to both inputs, is defined for 3D vectors, and is zero when the vectors are parallel.
What happens when one vector is the zero vector?
The dot product is 0, since every component product is 0. But the zero vector has magnitude 0 and no direction, so the angle between it and another vector is undefined, and the calculator does not call the vectors perpendicular.
Related Calculators
Vector Calculator
Add, subtract and scale 2D and 3D vectors, find magnitude, direction and unit vectors, and calculate dot products, cross products and the angle between vectors, step by step.
Cross Product Calculator
Calculate the cross product of two 3D vectors with the determinant method, step by step, plus its magnitude, the angle between the vectors, areas and a 3D view.
Complex Number Calculator
Add, subtract, multiply and divide complex numbers step by step, and find the modulus, argument, conjugate and polar form on the complex plane.
Distance Formula Calculator
Find the distance between two points in 2D or 3D with the distance formula, showing Δx, Δy, Δz, every substitution step, the exact answer and a graph.
Scientific Calculator
Advanced math calculator supporting trigonometry, logs, exponentials, and roots.
Slope Calculator
Find the slope, equation, intercepts, angle, distance, and midpoint of a line from two points, an equation, or a point and slope, with a graph.
Last updated: September 27, 2026.