Mathematics · Vectors & matrices

Dot product and angle between vectors calculator

Find the dot product, vector norms, cosine and angle between two 2D or 3D vectors.

Created v1.0

By Thibaut Grzelak, Mechanical Analysis Engineer

Vectors & matrices
01

Calculation inputs

Vector A
Vector B
03

Results

Norm of A
1
Norm of B
1
Cosine of θ
0

Results show up to four significant digits for readability; internal calculations retain full precision.

See calculation details

01Norm of A

Formula‖A‖ = √(∑ᵢ Aᵢ²)
Substitution√(1² + 0²)
Result
1

02Norm of B

Formula‖B‖ = √(∑ᵢ Bᵢ²)
Substitution√(0² + 1²)
Result
1

03Dot product

FormulaA·B = ∑ᵢ AᵢBᵢ
Substitution1 × 0 + 0 × 1
Result
0

04Cosine of θ

Formulacos θ = (A·B)/(‖A‖‖B‖)
Substitution0 / (1 × 1)
Result
0

05Angle θ

Formulaθ = arccos(cos θ)
Substitutionarccos(0) × 180°/π
Result
90
01Formulas and symbols

Formulas used

θ

A·B = ∑ AᵢBᵢ

cos θ = (A·B)/(‖A‖‖B‖)

A·B: dot product; θ: angle; ‖A‖ and ‖B‖: norms.

SymbolMeaning
dDimension
AₓVector A — ₓ
AᵧVector A — ᵧ
A_zVector A — 𝓏
BₓVector B — ₓ
BᵧVector B — ᵧ
B_zVector B — 𝓏
A·BDot product
‖A‖Norm of A
‖B‖Norm of B
cos θCosine of θ
θAngle θ
02Validation example

Reference numerical case

  1. A = (1, 0), B = (0, 1): A·B = 0, norms 1, cos θ = 0 and θ = 90°.
03How it works

The dot product sums component products. Dividing by both norms gives the cosine of the angle from 0° to 180°. The cosine is clamped to [−1, 1] only to contain floating-point round-off.

04Limits and conventions

Both vectors use the same dimension and orthonormal axes. With a zero vector the dot product is zero, but the angle and its cosine are undefined. A projected 3D drawing cannot show the true spatial angle.

05Common mistakes

A positive dot product means an acute angle, a negative one an obtuse angle. Perpendicular nonzero vectors have a zero dot product.

06Practical questions

What does a zero dot product mean geometrically?

For two nonzero vectors, A·B = 0 means they are perpendicular because A·B = ‖A‖‖B‖cosθ. A zero vector is a special case because its direction and angle are undefined.

How can the dot product be used to find the angle between vectors?

For two nonzero vectors, compute cosθ = (A·B)/(‖A‖‖B‖), then θ = arccos(cosθ). The result lies between 0° and 180°.

07Technical references