# What is the derivation of the dot product formula?

What is a mathematical explanation of the connection between: (1) projecting vector a onto vector b and multiplying the projected length of a with the length of vector b, and (2) the sum of the products of the equivalent components of the two vectors?

I realise there is a duality between a 2-dimensional vector and a 1x2 matrix, which can be used to explain the computation of the dot product. But I have not seen a satisfactory mathematical derivation, and was wondering whether there is another, simpler mathematical explanation.

Let's start with the geometrical definition$$\vec a\cdot \vec b = ab\cos\theta$$ Also, suppose that we have an orthonormal basis $$\{\hat e_i\}$$. Then $$\vec a=\sum_i a_i\hat e_i\\\vec b=\sum_i b_i\hat e_i$$ Now using the geometrical definition, if two of the basis vectors are the same $$\hat e_i\cdot \hat e_i=e_ie_i\cos 0=1$$and if two vectors are different $$\hat e_i\cdot \hat e_j=e_ie_j\cos\frac{\pi}2=0$$ Then $$\vec a \cdot\vec b=\vec a\cdot\left(\sum_i b_i\hat e_i\right)=\sum_i(\vec a\cdot \hat e_i)b_i=\sum_ia_i b_i$$