Finding the space between two vectors? Could someone explain why the formula:
$$\theta = \cos^ {-1}(a \cdot b)$$ 
provides the angle between vector $a$ and vector $b$? All the online resources seem to explain how to find the angle, but not why the method works. 
Resources I looked at:
http://chemistry.about.com/od/workedchemistryproblems/a/scalar-product-vectors-problem.htm
http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/index.htm
http://en.m.wikipedia.org/wiki/Dot_product
 A: The dot product can be derived from the cosine law.
$$c^2=a^2+b^2-2ab\cos(C)$$
where C is the angle between $a$ and $b$. If you consider $a$ and $b$ as your vectors, then side $c$ can be represented as $(b-a)$. So (noting that I'm talking about distances)
$$|b-a|^2=|a|^2+|b|^2-2|a||b|cos(C)$$
$${(b_x-a_x)}^2+{(b_y-a_y)}^2={a_x}^2+{a_y}^2+{b_x}^2+{b_y}^2-2|a||b|cos(C)$$
$$({b_x}^2-2a_xb_x+{a_x}^2)+({b_y}^2-2a_yb_y+{a_y}^2)={a_x}^2+{a_y}^2+{b_x}^2+{b_y}^2-2|a||b|cos(C)$$
cancel out the squared terms and you get
$$-2(a_xb_x+a_yb_y)=-2|a||b|cos(C)$$
$$a_xb_x+a_yb_y=|a||b|cos(C)$$
$$a\cdot b=|a||b|cos(C)$$
which gives you a nice way of getting the angle between vectors if you only have their components, by the simple rearrangement:
$$C=\arccos(\frac{a\cdot b}{|a||b|})$$
It's less obvious why this works in the general dimensional case (and not just 2D), but a good place to start is to notice that any two vectors can always be put in a plane, and showing that expressing the $(x,y)$ of the plane in terms of the higher-dimensional vector components, then applying this calculation makes all the math come out okay.
A: We know that
$$\cos(\alpha-\beta)=\cos(\alpha)\cos(\beta)+\sin(\alpha)\sin(\beta)$$
Now let $\alpha$ be the angle between $a$ and the $x$-axis, and $\beta$ between $b$ and the $x$-axis. From the definition of sin and cos you got:
$$\cos(\alpha-\beta)=\frac{a_1}{|a|}\frac{b_1}{|b|}+\frac{a_2}{|a|}\frac{b_2}{|b|}=\frac{ab}{|a||b|}$$
Since the angle between a and b is $\theta=\alpha-\beta$, you got
$$\theta=\arccos\left(\frac{ab}{|a||b|}\right)$$
QED
A: A combination of linear algebra and geometry can be useful. If $R$ is a rotation matrix, it satisfies $R^TR=I_n$, where $I_n$ is the $n\times n$ identity matrix. Assume $v,w$ are unit vectors. We compute
$$Rv\cdot Rw=(Rv)^T(Rw)=v^T(R^TR)w=v^TI_nw=v^Tw=v\cdot w$$
using matrix transpose properties. Thus the dot product is rotation-invariant. Rotations act transitively, which for our purposes means that given $v,w$ we can find a rotation $R$ so that $Rv=e_1$ is the first basis unit vector. After that we rotate around the $x$-axis so that $Rw$ becomes a vector on the $xy$-plane (while $Rv=e_1$ remains unchanged), and we are reduced to the case of $\Bbb R^2$. Here,
$$(1,0)\cdot(\cos\theta,\sin\theta)=\cos\theta,$$
as desired (where $\theta$ is the angle between the second vector and the $x$-axis, or equivalently $e_1$).
