Dot Product Calculator
The dot product collapses two vectors into a single scalar that encodes how much they point in the same direction. It powers cosine similarity for search ranking, projection for physics, and every lighting calculation in computer graphics. This tool computes a dot product for two vectors of matching dimension (2D, 3D, N-D) and shows the cosine of the angle between them.
How to compute a dot product
-
1
Enter both vectors
Type components separated by commas or spaces: `3, 4, 5` for one vector and `1, 2, 1` for the other.
-
2
Match dimensions
The vectors must have the same length. The tool flags mismatches before calculating.
-
3
See the result
The scalar dot product is shown together with the cosine of the angle (cos θ) and the angle itself in degrees.
The two formulas
Component form for vectors a = (a1, a2, ..., an) and b = (b1, b2, ..., bn):
a . b = a1*b1 + a2*b2 + ... + an*bn
Geometric form:
a . b = |a| * |b| * cos(theta)
The two expressions are equal; setting them equal gives you cos(theta) = (a.b) / (|a| |b|), the cosine similarity formula.
What the sign tells you
| Dot product | Meaning |
|---|---|
| Positive | Vectors point roughly the same direction (angle < 90) |
| Zero | Vectors are orthogonal (perpendicular) |
| Negative | Vectors point roughly opposite directions (angle > 90) |
Worked example
a = (3, 4), b = (1, 2):
- Components: 31 + 42 = 3 + 8 = 11
- |a| = sqrt(9 + 16) = 5
- |b| = sqrt(1 + 4) = sqrt(5) ~ 2.236
- cos(theta) = 11 / (5 * 2.236) = 0.9839
- theta = arccos(0.9839) ~ 10.3 degrees
The vectors point almost the same way, hence the large positive dot product.
Common applications
- Cosine similarity for recommender systems: how similar are two embedding vectors?
- Projection of one vector onto another:
proj_b(a) = (a . b) / |b|^2 * b. - Work in physics:
W = F . d, force dotted with displacement. - Graphics lighting: surface normal dotted with light direction gives diffuse brightness (Lambert’s law).
- Orthogonality check: quickly verify whether two basis vectors are perpendicular.
Tips
- Normalize before comparing. If you only care about direction (similarity), divide each vector by its magnitude first; then the dot product equals the cosine directly.
- Watch the dimension. A 3-vector dotted with a 4-vector is undefined; pad or truncate deliberately, not accidentally.
- Numerical stability. For very large vectors, floating-point accumulation can lose precision; use double precision or Kahan summation when dimension exceeds a few thousand.
Frequently Asked Questions
Dot product returns a scalar, measures “how parallel” two vectors are. Cross product (defined only in 3D and 7D) returns a vector perpendicular to both, measures “how perpendicular”. They answer opposite questions.
Yes, for any dimension N. The component-wise definition extends directly; it is used every day in machine learning with vectors of hundreds or thousands of dimensions.
Because the geometric form |a| |b| cos(theta) is zero when cos is zero, which happens at 90 and 270 degrees. Two non-zero vectors are orthogonal precisely when their dot product is zero.
The vector components you enter are sent to our server because the calculation runs there. They are not stored or linked to your account.
Related Tools
BMI Calculator
Calculate body mass index from height and weight. Shows WHO category, healthy-weight range and limitations of BMI.
Social Security Calculator
Estimate a US Social Security retirement benefit from your PIA and claiming age. Compare monthly and annual amounts at 62, FRA 67 and 70.
Age Calculator
Calculate exact age in years, months and days from a birth date, plus total days, hours and the next birthday countdown.
Dog Age Calculator
Convert your dog's age to human years using modern veterinary research. Breed-size aware: small, medium and large dogs age differently.
Amp-Hour Calculator
Work out battery runtime and stored energy from amp-hours, voltage and load current. Get runtime in hours and minutes plus energy in watt-hours and kilowatt-hours.
Fahrenheit to Celsius Converter
Convert Fahrenheit temperatures to Celsius with the exact formula, Kelvin output and common reference points for weather, cooking and health.
Tool available in other languages
- 内積計算ツール [JA]
- Skalarprodukt Rechner [DE]
- Kalkulator Perkalian Titik [ID]
- 내적 계산기 [KO]
- 点积计算器 [ZH]
- Calculadora de Producto Punto [ES]
- Dotproduktkalkylator [SV]
- Máy tính tích vô hướng [VI]
- Nokta Çarpımı Hesaplayıcısı [TR]
- Dotproductrekenmachine [NL]
- เครื่องคำนวณผลคูณจุด [TH]
- Calculateur de produit scalaire [FR]
- Calculadora de Produto Escalar [PT]
- حاسبة الضرب القياسي [AR]
- Kalkulator iloczynu skalarnego [PL]
- Calcolatore del Prodotto Scalare [IT]
- Калькулятор скалярного произведения [RU]