Dot product

Level FundamentalDifficulty ★★★★★Concept⌖ Open in the map

What is it?

u⋅v=∑iuivi=∥u∥∥v∥cos⁡θu \cdot v = \sum_i u_i v_i = \norm u \norm v \cos\theta. It measures how much two vectors point the same way, and it is the single most executed operation in machine learning.

Formulas

u⋅v=∑i=1nuivi=∥u∥ ∥v∥cos⁡θu \cdot v = \sum_{i=1}^n u_i v_i = \norm u\,\norm v \cos\theta
proj⁡uv=u⋅vu⋅u u\operatorname{proj}_u v = \frac{u \cdot v}{u \cdot u}\, u
projection

Where it shows up in computing

  • Lighting and shading★★★★★fundamentalComputer graphics

    Diffuse lighting is max⁡(0,n⋅l)\max(0, n \cdot l), the dot product of the unit normal and the light direction.

  • Recommender systems★★★★★frequentOptimization and systems

    Predicted affinity between a user and an item is the dot product of their embedding vectors.

Where it shows up in AI

  • Neural networks★★★★★fundamentalAI and machine learning

    Each neuron computes w⋅x+bw \cdot x + b before its activation.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

This page has the essentials. A fuller treatment (intuition, formal definition, worked example) is on the way.

↑ ↓ to navigate · ↵ · Esc