Angle Between Two Vectors
To find the angle between two vectors, I employ the formula that leverages the arccosine. It's based on the ratio of the vectors' dot product to the multiplication of their magnitudes. $$ \alpha = \arccos ( \frac{\vec{v} \cdot \vec{w}}{ |\vec{v}| \cdot |\vec{w}|} )$$
Example
To illustrate, let me walk you through a practical example:
I'm given two vectors:
$$ \vec{v} = \begin{pmatrix} 1 \\ 3 \end{pmatrix} $$
$$ \vec{w} = \begin{pmatrix} 4 \\ 2 \end{pmatrix} $$
When I visualize these vectors, they lie on a plane.
To find the angle between them, I apply the formula:
$$ \alpha = \arccos ( \frac{\vec{v} \cdot \vec{w}}{ |\vec{v}| \cdot |\vec{w}|} )$$
First, I calculate the dot product:
$$ \vec{v} \cdot \vec{w} = \begin{pmatrix} 1 \\ 3 \end{pmatrix} \cdot \begin{pmatrix} 4 \\ 2 \end{pmatrix} = 1 \cdot 4 + 3 \cdot 2 = 4+6= 10$$
Plugging this into the formula:
$$ \alpha = \arccos ( \frac{\vec{v} \cdot \vec{w}}{ |\vec{v}| \cdot |\vec{w}|} )$$
$$ \alpha = \arccos ( \frac{10}{ |\vec{v}| \cdot |\vec{w}|} )$$
Next, I determine the magnitudes using the Pythagorean theorem.
$$ |\vec{v}| = \sqrt{3^2+1^2} = \sqrt{10} $$
$$ |\vec{w}| = \sqrt{4^2+2^2} = \sqrt{20} $$
Substituting these magnitudes in:
$$ \alpha = \arccos ( \frac{10}{ |\vec{v}| \cdot |\vec{w}|} )$$
$$ \alpha = \arccos ( \frac{10}{ \sqrt{10} \cdot \sqrt{20}} )$$
$$ \alpha = \arccos ( \frac{10}{ \sqrt{200} } )$$
$$ \alpha = \arccos ( 0,71 )$$
From this, I deduce:
$$ \alpha = 45° $$
So, the angle between these two vectors is 45°.
Proof
For those interested in the underlying proof.
The dot product of two vectors is the product of their magnitudes and the cosine of the angle between them.
$$ \vec{v} \cdot \vec{w} = |\vec{v}| \cdot |\vec{w}| \cdot \cos \alpha $$
From this relationship, I can isolate the cosine of angle α.
$$ \cos \alpha = \frac{ \vec{v} \cdot \vec{w} }{|\vec{v}| \cdot |\vec{w}| } $$
Taking the arccosine of both sides.
$$ \arccos( \cos \alpha ) = \arccos( \frac{ \vec{v} \cdot \vec{w} }{|\vec{v}| \cdot |\vec{w}| } ) $$
Since the arccosine is the inverse function of cosine, the arccosine of the cosine of α gives me angle α.
$$ \alpha = \arccos( \frac{ \vec{v} \cdot \vec{w} }{|\vec{v}| \cdot |\vec{w}| } ) $$
This confirms the formula I use to calculate the angle between two vectors.