## Friday, December 16, 2011

### Derivation of the dot product formula

There is a very famous formula in the field of vectors known as the dot product formula or the scalar product formula. It is used widely to find the angle between two vectors, or to find the length of projection of one vector onto another. This is what the formula looks like:

\large \begin{align*} \vec{a}=\begin{pmatrix} a_{1} \\ a_{2} \\ a_{3} \end{pmatrix} \; \; \vec{b}=\begin{pmatrix} b_{1} \\ b_{2} \\ b_{3} \end{pmatrix} \\\\ \vec{a}\cdot\vec{b}=a_1b_1+a_2b_2+a_3b_3=\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|\cos\theta\! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \end{align*}

My aim is to derive this formula from basic geometric principles. I will also be giving you the rationale behind these derivations- that is, the initial ideas that could have occurred to the pioneers of vectors, during the time in which they were inventing these formulas. Here we go.

The rationale for this formula goes as follows. Two vectors a and b exist in the manner shown below. How can I find the angle between these two vectors? (Note: This angle refers to the angle between the vectors such that they are diverging outwards together or converging inwards together.) Is there a function (of the components of the vectors) that exists that could allow me to deduce the angle between the vectors? Now that this logical basis for the derivation is set up, here is how the questions can be answered and how the formula can be derived:

(Note: The actual pioneers may not have done this. I am just providing a logical path for people to follow and to ultimately understand where these formulas came from.)

$\large \vec{a}= \begin{pmatrix} a_{1} \\ a_{2} \\ a_{3} \end{pmatrix} \; \; \vec{b}=\begin{pmatrix} b_{1} \\ b_{2} \\ b_{3} \end{pmatrix} \: \Rightarrow\: \vec{a}+\vec{b}=\begin{pmatrix} a_{1}+b_{1} \\ a_{2}+b_{2} \\ a_{3}+b_{3} \end{pmatrix}$

This is what the vectors would look like visually:

We are interested in finding theta, or some relation to theta. Using the cosine rule, one can deduce the following:

\large \begin{align*} \left \| \vec{a}+\vec{b} \right \|^{2}=\left \| \vec{a} \right \|^{2}+\left \| \vec{b} \right \|^{2}-2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|\cdot\cos (\pi -\theta )\\\\ \cos(\pi-\theta)=\frac{\left \| \vec{a} \right \|^{2}+\left \| \vec{b} \right \|^{2}-\left \| \vec{a}+\vec{b} \right \|^{2}}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|}\; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \\\\ \textup{Since}\: \cos(\pi-\theta)=-\cos\theta\; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \end{align*}

\large \begin{align*} \therefore\cos\theta =\frac{\left \| \vec{a}+\vec{b} \right \|^{2}-\left \| \vec{a} \right \|^{2}-\left \| \vec{b} \right \|^{2}}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|}\; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \\\\ =\: \: \frac{(a_{1}+b_{1})^{2}+(a_{2}+b_{2})^{2}+(a_{3}+b_{3})^{2}}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|}\;\; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \\\\-\; \! \! \! \! \! \! \! \: \: \: \:\; \; \; \frac{a_{1}^{2}+b_{1}^2+a_2^2+b_2^2+a_3^2+b_3^2}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|}\; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \end{align*}

\large \begin{align*} &=\frac{(a_1^2+b_1^2+2a_1b_1)+(a_2^2+b_2^2+2a_2b_2)+(a_3^2+b_3^2+2a_3b_3)}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|} \\\\&-\: \:\frac{a_{1}^{2}+b_{1}^2+a_2^2+b_2^2+a_3^2+b_3^2}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|} \end{align*}

\large \begin{align*} =\frac{2a_1b_1+2a_2b_2+2a_3b_3}{2\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|}\; \; \; \; \; \; \; \\\\ \cos\theta=\frac{a_1b_1+a_2b_2+a_3b_3}{\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|}\; \; \; \; \; \end{align*}

We found the function that determines the angle between the two vectors! Through further manipulation, we arrive at the dot product formula and will also understand how it is defined.

\large \begin{align*} \therefore a_1b_1+a_2b_2+a_3b_3=\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|\cos\theta \\\\ \vec{a}\cdot\vec{b}\overset{{\mathrm{def}}}{=}a_1b_1+a_2b_2+a_3b_3=\left \| \vec{a} \right \|\cdot\left \| \vec{b} \right \|\cos\theta\! \! \! \! \! \! \! \! \! \! \! \! \! \\\\\textup{QED}\; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \, \, \end{align*}

Voila! When I worked this out a couple of months back, I was blown off my feet. I never knew that this formula, which as a student I had to memorize, could actually be derived so beautifully from basic principles.

The beauty of this formula and of vectors in general is that information pertaining to the vectors, such as the angle between two vectors, can be found easily through a process of manipulating and computing a certain set of numbers in a specific manner. That's all. No algebra or complex thinking is required. Nothing novel too. It's just a simple set of rules.

LaTeX code source: http://www.codecogs.com/latex/eqneditor.php

1. I'm extremely impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the nice quality writing, it is rare to see a nice blog like this one these days.

Here is my weblog ... how you can help

1. Hi. Thanks for writing. I'm glad to know that you like my work. This is not a paid theme, it's in fact available under the standard themes offered by blogger. Oh and I can't seem to access your blog for some reason.

Anyways, good day!

2. Very nice read! For someone who's been trying to get some sort of intuition as to why vector multiplication is defined the way it is, this is great!

3. Thank you very much

4. This is very nice indeed...

Also, be sure to check out this brilliant alternative proof (though along the same vain) on the website below:

http://tutorial.math.lamar.edu/Classes/CalcII/DotProduct.aspx

...It is very similar, but extends the proof to any number of dimensions. The messy algebra that can occur is completely avoided by first proving one or two extremely simple lemmas, reducing the proof to about three steps.

5. Hi Atreya,
Nice proof, I was just wondering though does it only work if angle A and angle B are both theta. You have pi-theta for the unknown angle but what would happen if angle A wasn't theta. Would the unknown be pi-theta-A. Also is the total angle between a and b theta or 2 x theta.

6. Heya, I'm not sure I understand why the other angle is labelled pi-theta, shouldnt it be pi-theta-the_other_interior_angle?

7. nevermind, i see where i went wrong, sorry for that silly question :D

8. Why did you write cos(π-x) while proving in very 1st step

1. As u know the angle between two vector a and b is pi-theta so using expansion ...u get cos(pi-theta)=above relation in first step of prooving