Why do you calculate the dot product that way?

I am learning dot product these days. I understand the geometric meaning of one vector's interpretation in the same direction of the other to calculate the work in terms of force and distance in the designated direction in physics.

However, I don't understand why this calculation is same as the dot product of two vectors. I only understand the dot product of two vectors should be 0 when orthogonal because it's obvious that the two vectors slopes are perpendicular.

My question is why and how do you connect the calculation of dot product to the geometric meaning?


If you are familiar with how to represent a vector in the polar coordinate system and with trigonometric identities, you can easily get some insight.

Consider the two vectors $a = (a_1, a_2)$ and $b = (b_1, b_2)$. Then, $a_1 = |a|\cos \alpha$, $a_2 = |a|\sin \alpha$, $b_1 = |b|\cos \beta$, and $b_2 = |b|\sin \beta$, where $\alpha$ and $\beta$ are angles of $a$ and $b$ with respect to the $x$-axis, respectively. Then, the signed angle between $a$ and $b$ is $\theta = \beta - \alpha$.

From the trigonometric identity, $$ \cos\theta = \cos (\beta - \alpha) = \cos\beta\cos\alpha + \sin\beta\sin\alpha = \frac{1}{|a||b|}(a_1 b_1 + a_2 b_2) $$

Therefore, we have $|a||b|\cos\theta = a_1 b_1 + a_2 b_2$, which is $a\cdot b$.

We can extend the notion to general $n$-dimensional vectors.


Let $v,w$ be two vectors. Together with their sum $v+w$ the form a triangle. The cosine law states that the angle $\alpha$ between the sides $v$ and $w$ now satisfies

$$\vert v+w\vert^2=\vert v\vert^2+\vert w\vert^2-2\vert v\vert\vert w\vert\cos\alpha.$$

Since the usual angle between the vectors $v$ and $w$ is $\beta=90^\circ-\alpha$, this yields

$$\vert v+w\vert^2=\vert v\vert^2+\vert w\vert^2+2\vert v\vert\vert w\vert\cos\beta.$$

We get

$$\vert v\vert\vert w\vert\cos\beta=\frac12(\vert v+w\vert^2-\vert v\vert^2-\vert w\vert^2)=v_1w_1+v_2w_2+v_3w_3.$$

This means that the two usual ways of defining the inner product - one geometric, one in coordinates - are equal. The last step just requires doing the slightly tedious calculation of evaluating all the moduli.

Sorry for the lack of pictures. You should probably try sketching along with the explanation.