← AI / ML Foundations
9 / 25
Lesson 9 — Dot product & norm
Two tools behind every model: dot product and norm
A vector is just a list of numbers. The dot product of two vectors multiplies matching items and adds the results. The norm (length) of a vector is the square root of its dot product with itself — Euclidean distance from zero.
# [1, 2] · [3, 4] = 1*3 + 2*4 = 11
# norm([3, 4]) = (9 + 16) ** 0.5 = 5.0
Why it matters: a model's prediction is very often a dot product of "weights" and "features", and norms show up in similarity and regularisation. You will reuse both functions in later lessons.
Want it another way?
Task
Finish dot(a, b). norm() already uses it. Expected: dot 32, norm 5.0.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
Test your knowledge
A quick 3-question quiz on this lesson — instant feedback.