CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Math / Vectors and Matrices

How Much Together: Dot Product

Lesson 6 of 12 · 7 min · Free, no account needed

What you will learn

  • The dot product of a and b is a₁b₁ + a₂b₂: multiply in pairs, then add.
  • It is big when the arrows point the same way, 0 at a right angle, negative when they point apart.
  • It grows with b's shadow on a. Apps and neurons use it to score how well things match.

Start the lesson

How the lesson goes

  1. A movie app stores your taste as an arrow. How does it check if a film points your way?

    Ada's taste is the blue arrow. Tap the film you think the app suggests.

  2. Swing arrow b around a. Watch the number and the shadow.

    The number is 2 × b's first part + 1 × b's second part. Reach each goal.

  3. Sort by eye: same way, right angle, or against?

    Then the number checks you.

    Positive means less than a right angle, zero means exactly a right angle, negative means more.

  4. This number is the dot product.

    The dot product a · b = a₁b₁ + a₂b₂. Here 2 × 1 + 1 × 3 = 5.

    a · b = 0 means the arrows are perpendicular: a right angle.

    The app scores each film as taste · film and suggests the biggest. For Ada that is Laugh Riot.

  5. Now set your own taste.

    Across is comedy, up is action.

  6. Game: movie night. Rank your top three films.

    Tap the highest score first. Work it out from the arrows: the score appears after you tap.

  7. A neuron in an AI does the same sum: weights · inputs.

    The inputs are 2 and 1. Set the two weights so the sum is exactly 7.

  8. What is (3, 2) · (4, -1)?

    a · b = a₁b₁ + a₂b₂ = 3 × 4 + 2 × (-1) = 10.

  9. Which pair is at an exact right angle?

    Only (2, 1) and (1, -2) give a dot product of 0.

  10. The dot product says how much two arrows point together.

    Compare your taste with three friends. Who should you watch films with?

Previous lesson: Recipes of Arrows: Linear Combinations · Next lesson: A Matrix Moves the Grid · Part of the course: Vectors and Matrices

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab