Omni Calculator logo
Last updated:

Angle Between Two Vectors Calculator

Table of contents

Angle between two vectors formulasHow to find the angle between two vectors?Angle between two 3D vectors – exampleHow to use the angle between two vectors calculator?FAQs

With this angle between two vectors calculator, you'll quickly learn how to find the angle between two vectors. It doesn't matter if your vectors are in 2D or 3D, nor if their representations are coordinates or initial and terminal points – our tool is a safe bet in every case. Play with the calculator and check the definitions and explanations below; if you're searching for the angle between two vectors formulas, you'll definitely find them there.

Angle between two vectors formulas

In this paragraph, you'll find the formulas for the angle between two vectors – and only the formulas. If you'd like to understand how we derive them, go directly into the next paragraph, How to find the angle between two vectors.

Image of the angle between two vectors

Angle between two 2D vectors

  1. Vectors represented by coordinates (standard ordered set notation, component form):
2D Vector in a component form

For vector a\boldsymbol a:

a=(xa,ya)\qquad\scriptsize \boldsymbol a = (x_a,y_a)

And b\boldsymbol b:

b=(xb,yb)\qquad\scriptsize \boldsymbol b = (x_b,y_b)

The angle is:

angle=arccos(xaxb+yaybxa2+ya2xb2+yb2)\quad\scriptsize\begin{split} \mathrm{angle} &= \mathrm{arccos}\bigg(\! \frac{x_ax_b +y_a y_b} {\sqrt{x_a^2+y_a^2}\cdot\sqrt{x_b^2+y_b^2}}\bigg) \end{split}
  1. Vectors between a starting and terminal point:
2D Vector. Notation: starting and terminal point coordinates.

For vector a\boldsymbol a:

A=(x1,y1)\qquad\scriptsize A =(x_1,y_1)

And:

B=(x2,y2)\qquad\scriptsize B =(x_2,y_2)

So vector a\boldsymbol a is:

a=(x2x1,y2y1)\qquad\scriptsize\boldsymbol a = (x_2-x_1,y_2-y_1)

For vector b\boldsymbol b:

C=(x3,y3)\qquad\scriptsize C =(x_3,y_3)

And:

D=(x4,y4)\qquad\scriptsize D =(x_4,y_4)

So vector b\boldsymbol b is:

b=(x4x3,y4y3)\qquad\scriptsize\boldsymbol{b}=(x_4-x_3,y_4-y_3)

And:

angle=arccos(((x2x1)(x4x3)+(y2y1)(y4y3))/((x2x1)2+(y2y1)2(x4x3)2+(y4y3)2))\scriptsize\begin{split} \mathrm{angle} = &\mathrm{arccos}\Big(\big((x_2-x_1)(x_4-x_3)\\ &+(y_2-y_1)(y_4-y_3)\big)\\ & /\big(\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\\ & \cdot\!\sqrt{(x_4-x_3)^2+(y_4-y_3)^2}\big)\Big) \end{split}

Angle between two 3D vectors

  1. Vectors represented by coordinates:
3D Vector in a component form
a=(xa,ya,za)\qquad\scriptsize\boldsymbol a = (x_a,y_a,z_a)

And:

b=(xb,yb,zb)\qquad\scriptsize\boldsymbol b = (x_b,y_b,z_b)

Then:

angle=arccos((xaxb+yayb+zazb)/(xa2+ya2+za2xb2+yb2+zb2))\scriptsize \begin{split} &\mathrm{angle} = \mathrm{arccos}\Big((x_a x_b+y_a y_b+z_a z_b)\\ & /\big(\sqrt{x_a^2+y_a^2+z_a^2}\cdot\sqrt{x_b^2+y_b^2+z_b^2}\,\big)\Big) \end{split}
  1. Vectors between a starting and terminal point:
3D Vector. Notation: starting and terminal point

For vector a\boldsymbol{a}:

A=(x1,y1,z1)\qquad\scriptsize A = (x_1,y_1,z_1)

And:

B=(x2,y2,z2)\qquad\scriptsize B =(x_2,y_2,z_2)

So:

a=(x2x1,y2y1,z2z1)\qquad\scriptsize\boldsymbol{a} = (x_2-x_1,y_2-y_1,z_2-z_1)

For vector b\boldsymbol{b}:

C=(x3,y3,z3)\qquad\scriptsize C = (x_3,y_3,z_3)

And:

D=(x4,y4,z4)\qquad\scriptsize D =(x_4,y_4,z_4)

So:

b=(x4x3,y4y3,z4z3)\qquad\scriptsize\boldsymbol{b}=(x_4-x_3,y_4-y_3,z_4-z_3)

Find the final formula analogically to the 2D version:

angle=arccos(((x2x1)(x4x3)+(y2y1)(y4y3)+(z2z1)(z4z3))/((x2x1)2+(y2y1)2+(z2z1)2(x4x3)2+(y4y3)2+(z4z3)2))\scriptsize\begin{split} &\mathrm{angle} = \mathrm{arccos}\Big(\big((x_2-x_1)(x_4-x_3)\\ &+(y_2-y_1)(y_4-y_3) +(z_2-z_1)(z_4-z_3)\big) \\& /\big(\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}\\ & \!\cdot\!\sqrt{(x_4-x_3)^2+(y_4-y_3)^2 +(z_4-z_3)^2}\big)\Big) \end{split}

Also, it is possible to have one vector defined by coordinates and the other defined by a starting and terminal point, but we won't let that obscure this section even further. All that matters is that our angle between two vectors calculator has all possible combinations available to you.

How to find the angle between two vectors?

OK, the above paragraph was a bit of a TL;DR. As a way of better understanding the formulas for the angle between two vectors, let's check where they come from:

  1. Start with the basic geometric formula to calculate the dot product:

    The dot product is defined as the product of the vectors' magnitudes multiplied by the cosine of the angle between them (here denoted by α\alpha):

ab=abcos(α)\small\qquad\boldsymbol{a}\cdot\boldsymbol{b} = |\boldsymbol{a}| \, |\boldsymbol{b}| \cos(\alpha)

🙋 Our vector magnitude calculator is here to help if you need a refresh about that other important vectorial quantity!

  1. Then, make the angle the subject of the equation:

    Divide by the product of the vectors' magnitudes:

cos(α)=(abab)\qquad\scriptsize\cos(\alpha) = \left(\frac{\boldsymbol{a}\cdot\boldsymbol{b}}{|\boldsymbol{a}| \, |\boldsymbol{b}|}\right)

Find the inverse cosine of both sides:

α=arccos(abab)\qquad\scriptsize\alpha = \mathrm{arccos}\left(\frac{\boldsymbol{a}\cdot\boldsymbol{b}}{|\boldsymbol{a}| \, |\boldsymbol{b}|}\right)
  1. Afterward, we need to brush up on the definition of a vectors' magnitude:

    As magnitude is the square root of the sum of the vector's components to the second power, we find out that:

    • v=x2+y2|\boldsymbol{v}| =\sqrt{x^2+y^2} in 2D space; and

    • v=x2+y2+z2|\boldsymbol{v}| =\sqrt{x^2+y^2+z^2} in 3D space.

Did you notice that it's the same formula as the one used in the distance calculator? And that it comes directly from geometry — learn how with the Pythagorean theorem calculator?

  1. Use the algebraic formula for the dot product (the sum of products of the vectors' components), and substitute in the magnitudes:

In 2D space:

If vectors a\boldsymbol{a} and b\boldsymbol{b} are, respectively:

a=(xa,ya)\qquad\scriptsize\boldsymbol{a} = (x_a,y_a)

And:

b=(xb,yb)\qquad\scriptsize\boldsymbol{b} = (x_b,y_b)
α=arccos((xaxb+yayb)/(xa2+ya2xb2+yb2))\qquad\scriptsize \begin{split} \alpha = &\mathrm{arccos}\Big(\big(x_a x_b+y_a y_b\big)\\ &/\big(\sqrt{x_a^2+y_a^2}\!\cdot\!\sqrt{x_b^2+y_b^2}\big)\Big) \end{split}

In 3D space:

If vectors a\boldsymbol{a} and b\boldsymbol{b} are, respectively:

a=(xa,ya,za)\qquad\scriptsize\boldsymbol{a} = (x_a,y_a,z_a)

And:

b=(xb,yb,zb)\qquad\scriptsize\boldsymbol{b} = (x_b,y_b,z_b)

Then:

α=arccos((xaxb+yayb+zazb)/(xa2+ya2+za2xb2+yb2+zb2))\scriptsize \begin{split} &\alpha = \mathrm{arccos}\Big(\big(x_a x_b+y_a y_b +z_a z_b\big)\\ &/\big(\sqrt{x_a^2+y_a^2+z_a^2} \cdot \sqrt{x_b^2+y_b^2+z_b^2}\big)\Big) \end{split}

And that's it!

Additionally, if your vectors are in a different form (you know their initial and terminal points), you'll need to perform some calculations beforehand. The aim is to reduce them into standard vector notation.

If your example vector is described by the initial point A=(x1,y1)A=(x_1, y_1) and the terminal point B=(x2,y2)B=(x_2, y_2), then vectora\boldsymbol{a} may be expressed as:

a=(x2x1,y2y1)\scriptsize\boldsymbol{a} = (x_2-x_1,y_2-y_1)

Still not making sense? No worries! We've prepared some exemplary calculations to make sure it's as clear as crystal.

Angle between two 3D vectors – example

Assume that we want to find the angle between two vectors:

a=(3,6,1)\scriptsize\boldsymbol{a} = (3, 6, 1)

and b\boldsymbol{b} defined as the vector between point A=(1,1,2)A = (1, 1, 2) and B=(4,8,6)B = (-4, -8, 6).

What do we need to do?

  1. First, calculate vector b\boldsymbol{b}, given the initial and terminal points:
b=(41,81,62)=(5,9,4)\qquad\scriptsize \begin{split} \boldsymbol{b} &= (-4-1,-8-1,6-2)\\ &= (-5,-9,4) \end{split}
  1. Then, find the dot product of vectors a\boldsymbol{a} and b\boldsymbol{b}:
  ab=(3×5)+(6×9)+(1×4)=1554+4=65\quad\ \ \scriptsize \begin{split} \boldsymbol{a}\cdot\boldsymbol{b}&= (3 \times -5) + (6 \times-9) + (1\times 4)\\ & = -15 - 54 + 4 = -65 \end{split}
  1. Next, determine the magnitude of vectors:
a=32+62+12=466.782\qquad\scriptsize\begin{split} |\boldsymbol{a}|&=\sqrt{3^2+6^2+1^2}\\ &=\sqrt{46}\approx6.782 \end{split}

And:

b=(5)2+(9)2+42=12211.045\qquad\scriptsize\begin{split} |\boldsymbol{b}|&=\sqrt{(-5)^2+(-9)^2+4^2}\\ &=\sqrt{122}\approx11.045 \end{split}
  1. Finally, use the transformed dot product equation:
α=arccos(abab)=arccos(656.782×11.045)=arccos(0.86767)=150.189°150.2°\qquad\scriptsize\begin{split} \alpha &= \mathrm{arccos}\left(\frac{\boldsymbol{a}\cdot\boldsymbol{b}}{|\boldsymbol{a}| \, |\boldsymbol{b}|}\right) \\[1em] &=\mathrm{arccos}\left(\frac{-65}{6.782\times11.045}\right) \\[1em] &=\mathrm{arccos}(-0.86767) \\[1em] &=150.189\degree\approx150.2\degree \end{split}

And there you go! You've just calculated the angle between two 3D vectors. Congratulations!

If you want to learn more coordinate geometry concepts, we recommend checking the average rate of change calculator.

How to use the angle between two vectors calculator?

So, how does our angle between two vectors calculator work? Follow these step-by-step instructions:

  1. Choose your vector space. Let's consider the same example as in the previous paragraph. Our vectors and points have three coordinates, so we need to pick the 3D option.

  2. Pick the first vector's representation. The first vector is in standard notation, so we leave the default value: coordinate representation.

  3. Input the first vector. Type in x=3,x = 3, y=6,y = 6, and z=1z = 1.

  4. Choose the second vector's representation. This time we need to change it to point representation.

  5. Enter the second vector's values. Input A=(1,1,2)\boldsymbol A = (1,1,2) and B=(4,8,6)\boldsymbol B = (-4,-8,6) into the proper fields.

  6. The tool has found the angle between two 3D vectors the moment you fill out the last field. In our case, it's 150.2°150.2\degree – which is, of course, the same result we got from the manual calculations.

FAQs

What is a vector?

A vector is a geometric object that has both magnitude and direction. It's very common to use them to represent physical quantities such as force, velocity, and displacement, among others.

How to define the angle formed by two vectors?

The angle formed between two vectors is defined using the inverse cosine of the dot products of the two vectors and the product of their magnitudes.

How do I calculate the angle between two vectors in 2D?

To calculate the angle between two vectors in a 2D space:

  1. Find the dot product of the vectors.
  2. Divide the dot product by the magnitude of the first vector.
  3. Divide the resultant by the magnitude of the second vector.

Mathematically, angle α between two vectors [xa, ya] and [xb, yb] can be written as:

α = arccos[(xa xb + ya yb) / (√(xa² + ya²) × √(xb² + yb²))].

How do I calculate the angle between two vectors in 3D?

To calculate the angle between two vectors in a 3D space:

  1. Find the dot product of the vectors.
  2. Divide the dot product by the magnitude of the first vector.
  3. Divide the resultant by the magnitude of the second vector.

Mathematically, angle α between two vectors [xa, ya, za] and [xb, yb, zb] can be written as:

α = arccos[(xa xb + ya yb + za zb) / (√(xa² + ya² + za²) × √(xb² + yb² + zb²) )].

Image of the angle α between two vectors

© Omni Calculator

Vector a

3D Vector in a component form

© Omni Calculator

Vector b

3D Vector in a component form

© Omni Calculator

Angle between two vectors

Check out 6 similar angle calculators 🕑
Central angleClock angleComplementary angles...3 more