Theorem: Cosine Formula for Dot Product

Let $\mathbf v, \mathbf w$ be two non-zero vectors in $\R^n$.
The dot product of $\mathbf v$ and $\mathbf w$ can be calculated by:
:$\mathbf v \cdot \mathbf w = \norm {\mathbf v} \norm {\mathbf w} \cos \theta$
where:
:$\norm {\, \cdot \,}$ denotes vector length and
:$\theta$ is the angle between $\mathbf v$ and $\mathbf w$.

Proof:
There are two cases:
:$(1): \quad \mathbf v$ and $\mathbf w$ are not scalar multiples of each other
:$(2): \quad \mathbf v$ and $\mathbf w$ are scalar multiples of each other.
=== Case 1 ===
:400px
Let the two vectors $\mathbf v$ and $\mathbf w$ not be scalar multiples of each other. 
Then by the definition of angle between vectors, we have $\theta$ defined as in the triangle as shown above.
(Note that from Angle Between Non-Zero Vectors Always Defined, such a triangle is guaranteed to exist).
By the Law of Cosines:
:$\norm {\mathbf v - \mathbf w}^2 = \norm {\mathbf w}^2 + \norm {\mathbf v}^2 - 2 \norm {\mathbf v} \norm {\mathbf w} \cos \theta$
Now, observe that:
{{begin-eqn}}
{{eqn | l = \norm {\mathbf v - \mathbf w}^2
      | r = \paren {\mathbf v - \mathbf w} \cdot \paren {\mathbf v - \mathbf w}
      | c = Dot Product of Vector with Itself
}}
{{eqn | r = \mathbf v \cdot \mathbf v - 2 \paren {\mathbf v \cdot \mathbf w} + \mathbf w \cdot \mathbf w
      | c = Properties of Dot Product
}}
{{eqn | r = \norm {\mathbf v}^2 + \norm {\mathbf w}^2 - 2 \paren {\mathbf v \cdot \mathbf w}
      | c = Dot Product of Vector with Itself
}}
{{end-eqn}}
Equating these two expressions for $\norm {\mathbf v - \mathbf w}^2$ gives:
{{begin-eqn}}
{{eqn | l = \norm {\mathbf w}^2 + \norm {\mathbf v}^2 - 2 \norm {\mathbf v} \norm {\mathbf w} \cos \theta
      | r = \norm {\mathbf v}^2 + \norm {\mathbf w}^2 - 2 \paren {\mathbf v \cdot \mathbf w}
      | c =
}}
{{eqn | l = -2 \paren {\norm {\mathbf v} \norm {\mathbf w} \cos \theta}
      | r = -2 \paren {\mathbf v \cdot \mathbf w}
      | c =
}}
{{eqn | l = \norm {\mathbf v} \norm {\mathbf w} \cos \theta
      | r = \mathbf v \cdot \mathbf w
      | c =
}}
{{end-eqn}}
which is exactly the desired result.
{{qed|lemma}}
=== Case 2 ===
Let $\mathbf v = \paren {v_1, v_2, \ldots, v_n}$ and $\mathbf w = \paren {w_1, w_2, \ldots, w_n}$.
{{WLOG}}, let $\mathbf v = c \mathbf w$, where $c$ is some scalar. 
If $c > 0$, then by the definition of angle between vectors:
:$\theta = 0 \implies \cos \theta = 1$
If $c < 0$, then by the definition of angle between vectors:
:$\theta = \pi \implies \cos \theta = -1$
(Note that $c$ cannot be $0$ because we have stipulated $\mathbf v$ and $\mathbf w$ to be non-zero).
Then:
{{begin-eqn}}
{{eqn | l = \mathbf v \cdot \mathbf w
      | r = \paren {c \mathbf w} \cdot \mathbf w
      | c =
}}
{{eqn | r = c \paren {\mathbf w \cdot \mathbf w}
      | c = Properties of Dot Product
}}
{{eqn | r = c \paren {\norm {\mathbf w}^2}
      | c = Dot Product of Vector with Itself
}}
{{eqn | r = \paren {c \norm {\mathbf w} } \norm {\mathbf w}
      | c =
}}
{{eqn | r = c \sqrt {\sum_{i \mathop = 1}^n w_i^2} \norm {\mathbf w}
      | c ={{Defof|Vector Length}} in $\R^n$
}}
{{eqn | r = \sgn \paren c \sqrt{c^2 \sum_{i \mathop = 1}^n w_i^2} \norm {\mathbf w}
      | c = where $\sgn \paren c$ is the signum function, that is the algebraic sign of $c$
}}
{{eqn | r = \sgn \paren c \sqrt {\sum_{i \mathop = 1}^n \paren {c w_i}^2} \norm {\mathbf w}
      | c =
}}
{{eqn | r = \sgn \paren c \sqrt {\sum_{i \mathop = 1}^n v_i^2} \norm {\mathbf w}
      | c = {{hypothesis}}
}}
{{eqn | r = \sgn \paren c \norm {\mathbf v} \norm {\mathbf w}
      | c = Definition of $\norm {\mathbf u}$
}}
{{eqn | r = \norm {\mathbf v} \norm {\mathbf w} \cos \theta
      | c = $\sgn \paren c = \cos \theta$
}}
{{end-eqn}}
{{qed}}