Compute a two-coordinate dot product

Preserve the order of coordinates and the signs of values. · 175 words

A vector is an ordered list of numbers, and a dot product combines two vectors of the same length. For two coordinates, multiply matching entries and add the products. If a = (3, 1) and b = (2, 4), then a dot b = 3 times 2 + 1 times 4 = 6 + 4 = 10. The result is one number called the dot product. This calculation is valid because both vectors have exactly two coordinates.

Imagine an AI shopping model scores products from two features: comfort and weight, each scaled from 0 to 1. Put each product in a row of a feature matrix. This shoe is row c = (0.8, 0.4). The model uses weight vector w = (5, 2), so larger weights mean more important features. Its row score is c dot w = 0.8 times 5 + 0.4 times 2 = 4.8. Applying the same calculation to every row gives one score per product. Those scores rank products under the model. They do not prove that a product is good.

Check your recall

What is the dot product of the vectors (3, 1) and (2, 4)?

Check your answer

Multiply matching coordinates and add: 3 times 2 + 1 times 4 = 6 + 4 = 10.

Sources and credits

Original KeyTouch lesson. Background reading · Zhang et al. · Linear Algebra.