The topic Matrices and linear systems ended with systems that have no solution. Take three equations in two unknowns:
x1=1,x2=2,x1+x2=6.
The first two force x1+x2=3, not 6. In matrix form Ax=b has no exact solution, but some x come closer than others. To say "closer" we need lengths, and lengths come from one operation.
The dot product of x,y∈Rn multiplies matching coordinates and adds them up:
⟨x,y⟩=x⊤y=i=1∑nxiyi.
It gives the length∥x∥=⟨x,x⟩ and the distance∥x−y∥. In the plane it also gives the angle, by the law of cosines:
⟨x,y⟩=∥x∥∥y∥cosθ.
For u=(3,4) and v=(4,3): u⊤v=24, both lengths are 5, so cosθ=0.96 and θ≈16.3∘. In R768 there is no protractor, so we turn this around and define the angle by the formula.
Two vectors are orthogonal, x⊥y, when ⟨x,y⟩=0. Then Pythagoras holds in any dimension: ∥x+y∥2=∥x∥2+∥y∥2.
The dot product is one example of an inner product: a rule that is symmetric, linear in each argument and gives ⟨x,x⟩>0 for every x=0. Another is ⟨x,y⟩M=x⊤My with M=diag(m1,…,mn) and all mi>0. It weighs features differently, which is what rescaling features does to a model's geometry. Below, ⟨x,y⟩ means the plain dot product.
Answers are saved on the server and tied to this browser until you sign in.