Vector dot product

Calculate vector dot product using the values and assumptions you provide.

Calculate vector dot product using the values and assumptions you provide.

Both dots and commas are accepted as decimal separators.

Your inputs stay in your browser. Displayed results are rounded to a maximum of 12 significant digits.

Method and assumptions

Method version 1.0.0 · Updated

Calculate

Formula: A · B = ax·bx + ay·by + az·bz

Calculate vector dot product using the values and assumptions you provide.

ax
Vector A · x
ay
Vector A · y
az
Vector A · z
bx
Vector B · x
by
Vector B · y
bz
Vector B · z

Results depend on the assumptions entered; verify professional or safety-critical decisions independently.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const a = [1, 2, 3], b = [4, 5, 6];
console.log(a.reduce((sum, x, i) => sum + x * b[i], 0)); // dot product = 32
TypeScript
const a: number[] = [1,2,3], b: number[] = [4,5,6];
const dot = a.reduce((sum, x, i) => sum + x * b[i]!, 0);
console.log(dot); // 32
Python
a, b = [1,2,3], [4,5,6]
print(sum(x*y for x,y in zip(a,b)))  # dot product = 32
Java
int dot = 1*4 + 2*5 + 3*6;
System.out.println(dot); // 32
C#
int dot = 1*4 + 2*5 + 3*6;
Console.WriteLine(dot); // 32