A free online calculator, showing all steps, to calculate the angle α between two vectors in 2D or 3D is presented.
Let vectors →U and →V be defined by their components as follows:
→U=<ux,uy,uz>
→V=<vx,vy,vz>
The dot product of vectors →U and →V is defined as:
→U⋅→V=|→U|⋅|→U|cosα
where |→U| and |→U| are the magnitude of vectors →U and →V respectively and α is the angle between the two vectors.
and it can be proved that the dot product of the two vectors →U and →V is given by a formula involving the components of the two vectors as follows:
→U⋅→V=ux⋅vx+uy⋅vy+uz⋅vz
hence the formula for cosα is given by
cosα=ux⋅vx+uy⋅vy+uz⋅vz|→U|⋅|→U|
The magnitudes |→U| and |→U| are given by
|→U|=√u2x+u2y+u2z
|→V|=√v2x+v2y+v2z
Use the inverse cosine function to express angle α made by the two vectors as
α=arccos(ux⋅vx+uy⋅vy+uz⋅vz√u2x+u2y+u2z⋅√v2x+v2y+v2z)
Enter the components of vectors →U and →V and press "Calculate". The outputs are the magnitudes |→U| and |→U|, the dot product →U⋅→V and angle α. 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.