This tool multiplies two vectors position by position and adds the products to give one number, the dot product.
The calculation runs in your browser, and the numbers you type are not sent anywhere.
Vector A
Vector B
1 × 4 + 2 × 5 + 3 × 6 = 32
4 + 10 + 18 = 32
Each position in A is multiplied by the same position in B. The products are added to give one number: 32.
This Python function does the same calculation and prints the products and the sum for the starting vectors.
def dot(a, b):
if len(a) != len(b):
raise ValueError("the vectors must have the same length")
return sum(x * y for x, y in zip(a, b))
a = [1, 2, 3]
b = [4, 5, 6]
print([x * y for x, y in zip(a, b)])
print(dot(a, b))
# [4, 10, 18]
# 32