Lesson 2 of 15

The dot product, algebraically and geometrically

The dot product begins as multiply matching coordinates and add. Geometrically, the same number measures alignment -- and that second reading is the one machine learning keeps using.

One operation, read from both sides. Algebraically it is a sum of coordinate products and the weighted score inside a linear model. Geometrically it carries length, angle, orthogonality and projection.

The final boards remove length with cosine similarity, then hold one dot product fixed to draw the line that leads directly into systems of equations.

There is no timer. Calculate when the board asks for arithmetic and reason from the picture when it asks for geometry. Every answer is computed from the vectors, and a miss shows which interpretation broke.

1 of 6

Multiply matching coordinates, then add

Two equal-length vectors go in; one scalar comes out.

The dot product pairs corresponding coordinates, multiplies each pair, and adds the products: u · v = u₁v₁ + ... + u_dv_d. For (2, -1) · (3, 4), that is 2×3 + (-1)×4 = 2.

The dimensions must match because every coordinate needs a partner. For one-dimensional NumPy arrays, u @ v, np.dot(u, v), and (u * v).sum() compute the same number.

The most common mistake is stopping after the coordinatewise products. u * v is still a vector; the final sum is what makes it a dot product.

Challenge

Multiply, Then Add

1 of 3

Compute a dot product without losing a sign.

Pair matching coordinates. The distractors stop one step early or mishandle a negative.