Vector Angle
Formulas and examples for calculating the angle between two vectors
This page describes how to calculate the angle between two vectors.
The angle can be calculated from the dot product and the magnitude of the vectors.
The following formula is used for this: \(\displaystyle cos ∡ (\overrightarrow{x},\overrightarrow{y})= \frac{\overrightarrow{x}·\overrightarrow{y}}{\left|\overrightarrow{x}\right|·\left|\overrightarrow{y}\right|}\)
For the vectors
\(\overrightarrow{x} =\left[\matrix{a\\b}\right]\) \(\overrightarrow{y} =\left[\matrix{a\\b}\right]\)
the formula is
\(\displaystyle cos ∡ (\overrightarrow{x},\overrightarrow{y})= \frac{\left[\matrix{x_a\\x_b}\right]·\left[\matrix{y_a\\y_b}\right]} {\left|\left[\matrix{x_a\\x_b}\right]\right|·\left|\left[\matrix{y_a\\y_b}\right]\right|} \) \(\displaystyle =\frac{x_a·y_a+x_b·y_b}{\sqrt{x_a^2+x_b^2}·\sqrt{y_a^2+y_b^2}}\)
Example
The following example calculates the angle of the following vectors:
\(\overrightarrow{x} =\left[\matrix{3\\0}\right]\) \(\overrightarrow{y} =\left[\matrix{5\\5}\right]\)
\(\displaystyle cos ∡ (\overrightarrow{x},\overrightarrow{y})= \frac{\left[\matrix{3\\0}\right]·\left[\matrix{5\\5}\right]} {\left|\left[\matrix{3\\0}\right]\right|·\left|\left[\matrix{5\\5}\right]\right|} \) \(\displaystyle =\frac{3·5+0·5}{\sqrt{3^2+0^2}·\sqrt{5^2+5^2}}\)
\(\displaystyle = \frac{15}{3·\sqrt{2·5^2}}=\frac{15}{3·5·\sqrt{2}} = \frac{15}{15·\sqrt{2}}=\frac{1}{\sqrt{2}}\)
The result is \(\displaystyle ∡ (\overrightarrow{x},\overrightarrow{y})= acos\left(\frac{1}{\sqrt{2}}\right)=45°\)
The image below shows the graphical representation of the vectors and angle.
|