A free online calculator, showing all steps, to calculate the angle \( \alpha \) between two vectors in 2D or 3D is presented.
Let vectors \( \vec {U} \) and \( \vec {V} \) be defined by their components as follows:
\( \vec {U} \; = \; \lt u_{x} , u_{y} , u_{z} \gt \)
\( \vec {V} \; = \; \lt v_{x} , v_{y} , v_{z} \gt \)
The dot product of vectors \( \vec {U} \) and \( \vec {V} \) is defined as:
\( \vec {U} \cdot \vec {V} = | \vec {U} | \cdot | \vec {U} | \cos \alpha \)
where \( | \vec {U} | \) and \( | \vec {U} | \) are the magnitude of vectors \( \vec {U} \) and \( \vec {V} \) respectively and \( \alpha \) is the angle between the two vectors.
and it can be proved that the dot product of the two vectors \( \vec {U} \) and \( \vec {V} \) is given by a formula involving the components of the two vectors as follows:
\( \vec {U} \cdot \vec {V} = u_x \cdot v_x + u_y \cdot v_y + u_z \cdot v_z \)
hence the formula for \( \cos \alpha \) is given by
\[ \large \color{red} {\cos \alpha = \dfrac{u_x \cdot v_x + u_y \cdot v_y + u_z \cdot v_z }{| \vec {U} | \cdot | \vec {U} | } } \]
The magnitudes \( | \vec {U} | \) and \( | \vec {U} | \) are given by
\( | \vec {U} | = \sqrt {u_x^2 + u_y^2 + u_z^2 } \)
\( | \vec {V} | = \sqrt {v_x^2 + v_y^2 + v_z^2 } \)
Use the inverse cosine function to express angle \( \alpha \) made by the two vectors as
\[ \large \color{red} {\alpha = \arccos \left (\dfrac{u_x \cdot v_x + u_y \cdot v_y + u_z \cdot v_z }{\sqrt {u_x^2 + u_y^2 + u_z^2 } \cdot \sqrt {v_x^2 + v_y^2 + v_z^2 } } \right) } \]
Enter the components of vectors \( \vec {U} \) and \( \vec {V} \) and press "Calculate". The outputs are the magnitudes \( | \vec {U} | \) and \( | \vec {U} | \), the dot product \( \vec {U} \cdot \vec {V} \) and angle \( \alpha \). You may also enter the number of decimal places required.
Note that you may also use the calculator for 2 D vectors by setting the \( z \) components of both vectors equal to zero.