If $ \vec{a} = a_1 \hat{i} + a_2 \hat{j} + a_3 \hat{k} $ and $ \vec{b} = b_1 \hat{i} + b_2 \hat{j} + b_3 \hat{k} $ are two vectors, there dot products have two different forms
(i) $ \vec{a}.\vec{b} = \mid a \mid \times \mid b \mid cos \space \theta $
(ii) $ \vec{a} . \vec{b} = a_1b_1 + a_2b_2 + a_3b_3 $
How can we prove that these two are the same? How can we prove it in 3 dimensional XYZ space?
Consider vectors $\vec{a}$ and $\vec{b}$. Define vector $\vec{c}$ as
$ \vec{c} = \vec{b} - \vec{a} $
Vectors $\vec{a},\vec{b},\vec{c}$ form the three sides of a triangle in $3D$. Let $\theta$ be the angle between $\vec{a}$ and $\vec{b}$.
And let's define the inner (dot) product between $\vec{a}$ and $\vec{b}$ as follows:
$ \vec{a} \cdot \vec{b} = a_1 b_1 + a_2 b_2 + a_3 b_3 $
Then
$ \vec{a} \cdot \vec{a} = a_1^2 + a_2^2 + a_3^2 = a^2 $
And similarly, $\vec{b} \cdot \vec{b} = b^2 $, and $\vec{c} \cdot \vec{c} = c^2$
Therefore, applying the law of cosines to the triangle, on the one hand we have,
$ (\vec{b} - \vec{a}) \cdot (\vec{b} - \vec{a} ) = c^2 = a^2 + b^2 - 2 a b \cos \theta $
And on the other hand, we have
$ (\vec{b} - \vec{a}) \cdot (\vec{b} - \vec{a} ) = \vec{b} \cdot \vec{b} + \vec{a} \cdot \vec{a} - 2 \vec{a} \cdot \vec{b} $
Comparing the two expressions, we deduce that
$ \vec{a} \cdot \vec{b} = a b \cos \theta $