# A purely algebraic proof of $\vec{a}\cdot \vec{b} = \lVert\vec{a} \rVert\lVert\vec{b} \rVert\cos(\theta)$

I have seen a proof of the fact that $$\vec{a}\cdot \vec{b} = \lVert\vec{a} \rVert\lVert\vec{b} \rVert\cos(\theta)$$ where $\vec{a}$ and $\vec{b}$ are two vectors. The proof relies on the Law of Cosines. The proofs that I have seen of the Law of Cosines all rely on pictures (see for example this). So I was wondering if there is a purely algebraic proof of the above formula. This could be done by proving a purely algebraic proof of the Law of Cosines.

I am thinking that the reason for using pictures, is that cosine is often defined using pictures (triangles). But what if we take $$\cos(x) = \sum_{n=0}^\infty \frac{(-1)^n x^{2n}}{(2n)!}$$ as the (algebraic) definition. Is there then a purely algehraic proof of the Law of Cosines or the formula above? If there is a nicer proof that relies on some other (algebraic) definition of $\cos(x)$, then I would be interested in seeing how that can be used as well.

Edit: From the comment below I see that this has to do with the definition of angle. So, I change by question: Is there a way to purely algebraically arrive at the above formula? I understand that this would involve choosing specific definitions. Can one, for example, prove the Law of Cosines, using $\vec{a}\cdot \vec{b} = \lVert\vec{a} \rVert\lVert\vec{b} \rVert\cos(\theta)$ as teh definition of the angle between two vectors?

• The problem is, what is $θ$ if you don't want to define it as an angle? And if it is an angle, what is an angle, if not the angle in the plane generated by $\vec{a},\vec{b}$? – user21820 May 4 '16 at 15:04
• @user21820: Would it make sense to change the question to ask for a proof of the Law of Cosine using the formula for the dot product as definition of angle? – John Doe May 4 '16 at 15:07
• Your question in the above comment makes sense, and yes I'm certain it follows rather quickly. – user21820 May 4 '16 at 15:11
• It's okay; your original question isn't so long that people would miss the extra paragraph. =) – user21820 May 4 '16 at 15:13
• @JohnDoe fixed the comment. – Omnomnomnom May 4 '16 at 15:22

Define $\cos\angle(a,b) = \dfrac{a ∙ b}{|a| \cdot |b|}$ for any nonzero Euclidean vectors $a,b$, and $0$ if either $a$ or $b$ is zero.

Then you want to prove $|a-b|^2 = |a|^2 + |b|^2 - 2 |a| \cdot |b| \cdot \cos\angle(a,b)$ for any Euclidean vectors $a,b$.

But it is obvious if $a$ or $b$ is zero, and otherwise it does immediately follow from the fact that $|v|^2 = v ∙ v$ for any Euclidean vector $v$.

In particular you have $|a-b|^2 = (a-b) ∙ (a-b) = a∙a - b∙a - a∙b + b∙b$ and this gives what you want quite immediately.

After @user21820's comment above I figured it out myself. So here is my answer:

Is we take the definition of the angle $\theta$ from $$\vec{a}\cdot \vec{b} = \lVert\vec{a} \rVert\lVert\vec{b} \rVert\cos(\theta)$$ Then \begin{align} \lVert \vec{b}-\vec{a}\rVert ^2 &= (\vec{b}-\vec{a})\cdot (\vec{b}-\vec{a})\\ &=\lVert \vec{b}\rVert^2 + \lVert \vec{a}\rVert^2 - 2\vec{a}\cdot \vec{b} \\ &= \lVert \vec{b}\rVert^2 + \lVert \vec{a}\rVert^2 - 2\lVert\vec{a}\rVert\lVert \vec{b}\rVert\cos(\theta) \end{align} This is exactly the Law of Cosines.

• Yeap lol I typed it faster I guess. – user21820 May 4 '16 at 15:20

There several ways to approach the concept of the inner product (or dot product) and one needs to be careful not to construct a flawed circular argument. For example, in some other answers, are we proving the Law of Cosines or using it? Is the use of the distributive property justified? Maybe it is, maybe it isn't - depending on what your starting point is.

Meaning, what's the definition? One approach is to define the dot product $\vec{a}\cdot\vec{b}$ according to the formula $$\vec{a}\cdot\vec{b}=\text{length}(\vec{a})\ \text{length}(\vec{b}) \cos \theta.$$ Then you would have to prove:

1. That the distributive property holds
2. That $\vec{a}\cdot\vec{b}=a_1 b_1 + a_2 b_2$, with respect to an orthonormal basis

(The Law of Cosines can then be proven algebraically but be careful not to use the distributive property until you've proven it w/o the Law of Cosines.)

Alternatively, you can define the dot product according the formula $$\vec{a}\cdot\vec{b}=a_1 b_1 + a_2 b_2$$ with respect to an orthonormal basis, and then you would have to prove

1. That the distributive property holds (which is rather obvious)
2. That $\vec{a}\cdot\vec{b}=\text{length}(\vec{a})\ \text{length}(\vec{b}) \cos \theta.$

Here's a robust chain of algebraic identities that will allow you to use either expression as the starting point and prove the other. The argument is so simple that it can be almost confusing. Assume $\vec{a}\cdot\vec{b}=\text{length}(\vec{a})\ \text{length}(\vec{b}) \cos \theta$ as the definition, prove the distributive property geometrically, and let $$\left\{\vec{e}_1,\vec{e}_2\right\}$$ be an orthonormal basis with respect to which \begin{align}\vec{a}=a_1\vec{e}_1+a_2\vec{e}_2 \\ \vec{b}=b_1\vec{e}_1+b_2\vec{e}_2\end{align}. Then \begin{align}\vec{a}\cdot\vec{b}&=\left(a_1\vec{e}_1+a_2\vec{e}_2 \right)\cdot\left(b_1\vec{e}_1+b_2\vec{e}_2\right)\\ &=a_1b_1\ \vec{e}_1\cdot\vec{e}_1 + a_1b_2\ \vec{e}_1\cdot\vec{e}_2 + a_2b_1\ \vec{e}_2\cdot\vec{e}_1 + a_2b_2\ \vec{e}_2\cdot\vec{e}_2\\ &=a_1 b_1 + a_2 b_2\end{align}

These identities can be reversed to go from the components definition to the geometric definition. The interesting part about this proof is that, on the surface, it doesn't even use the definition $\vec{a}\cdot\vec{b}=\text{length}(\vec{a})\ \text{length}(\vec{b}) \cos \theta$ so it is important to track down how this definition was used and how to retrieve it by reversing the argument.

(Edit: see this https://www.lem.ma/VD and the subsequent lessons. I believe the dot product is addressed in the fourth lesson and this and another proof are given.)