For two vectors $a$ and $b$, why does $\cos(θ)$ equal the dot product of $a$ and $b$ divided by the product of the vectors' magnitudes? While watching a video about dot products (https://www.youtube.com/watch?v=WDdR5s0C4cY), the following formula is presented for finding the angle between two vectors:

For vectors $a$, and $b$,
  $$\cos( \theta ) =  \frac{(a, b)}{  \|  a  \|   \| b \| }$$
  where $(a,b)$ is the dot product of $a$ and $b$.

How is this formula derived?

There are several derivations of this online. Here's where you can start. 
Define two vectors $\textbf{a}$ and $\textbf{b}$. Then $ \textbf{a} - \textbf{b}$ is the vector that connects their endpoints and makes a triangle. 
Therefore, we have a triangle with side lengths  $|\textbf{a}|$, $|\textbf{b}|$, and $|\textbf{a} - \textbf{b}|$. Let the angle between the two vectors be $\theta$. By the Law of Cosines, we have
$$|\textbf{a} - \textbf{b}|^2 = |\textbf{a}|^2 + |\textbf{b}|^2 - 2 |\textbf{a}|  |\textbf{b}| \cos (\theta)$$
Now, use the fact that 
$$
\begin{align*}
|\textbf{a}- \textbf{b}|^2 &= (\textbf{a}- \textbf{b}) \cdot (\textbf{a}- \textbf{b})\\ &= \textbf{a} \cdot \textbf{a} - 2 (\textbf{a} \cdot   \textbf{b}) + \textbf{b} \cdot \textbf{b} \\ &=  |\textbf{a}|^2 - 2 (\textbf{a} \cdot   \textbf{b}) + |\textbf{b}|^2
\end{align*}
$$
Simplify this equation, and you will get the desired formula.
