Use cosθ=a⋅b∣a∣∣b∣\cos \theta = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}||\mathbf{b}|}cosθ=∣a∣∣b∣a⋅b.