⟨u,v⟩\langle \mathbf{u}, \mathbf{v} \rangle

Dot product (inner product)

Read "the dot product of u and v". Multiply the two vectors entry by entry and add the results. You get one number, which is large when the vectors point the same way.

⟨u,v⟩=∑iuivi\langle \mathbf{u}, \mathbf{v}\rangle = \sum_i u_i v_i. It also equals ∥u∥ ∥v∥cos⁡θ\|\mathbf{u}\|\,\|\mathbf{v}\|\cos\theta, where θ\theta is the angle between the vectors. The second form is why attention uses it: the dot product is large and positive when two vectors point the same way, near zero when they are perpendicular, and negative when they point apart.

Angle brackets ⟨u,v⟩\langle \mathbf{u}, \mathbf{v}\rangle, u⊤v\mathbf{u}^\top\mathbf{v} and u⋅v\mathbf{u}\cdot\mathbf{v} are three ways of writing the same operation.

Example

⟨[1,2,3], [4,0,−1]⟩=1⋅4+2⋅0+3⋅(−1)=1\langle [1, 2, 3],\, [4, 0, -1] \rangle = 1{\cdot}4 + 2{\cdot}0 + 3{\cdot}(-1) = 1

Only slightly positive compared with the vectors' lengths (about 3.7 and 4.1), so they are close to perpendicular.

Where the course uses it

Related terms