# Angle Between Two Vectors Calculator

Created by Hanna Pamuła, PhD
Reviewed by Bogna Szyk and Jack Bowater
Last updated: Sep 18, 2023

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. Angle between two 2D vectors

1. Vectors represented by coordinates (standard ordered set notation, component form): For vector $\boldsymbol a$:

$\qquad\scriptsize \boldsymbol a = (x_a,y_a)$

And $\boldsymbol b$:

$\qquad\scriptsize \boldsymbol b = (x_b,y_b)$

The angle is:

$\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: For vector $\boldsymbol a$:

$\qquad\scriptsize A =(x_1,y_1)$

And:

$\qquad\scriptsize B =(x_2,y_2)$

So vector $\boldsymbol a$ is:

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

For vector $\boldsymbol b$:

$\qquad\scriptsize C =(x_3,y_3)$

And:

$\qquad\scriptsize D =(x_4,y_4)$

So vector $\boldsymbol b$ is:

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

And:

$\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: $\qquad\scriptsize\boldsymbol a = (x_a,y_a,z_a)$

And:

$\qquad\scriptsize\boldsymbol b = (x_b,y_b,z_b)$

Then:

$\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: For vector $\boldsymbol{a}$:

$\qquad\scriptsize A = (x_1,y_1,z_1)$

And:

$\qquad\scriptsize B =(x_2,y_2,z_2)$

So:

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

For vector $\boldsymbol{b}$:

$\qquad\scriptsize C = (x_3,y_3,z_3)$

And:

$\qquad\scriptsize D =(x_4,y_4,z_4)$

So:

$\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:

$\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$):

$\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:

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

Find the inverse cosine of both sides:

$\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:

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

• $|\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 $\boldsymbol{a}$ and $\boldsymbol{b}$ are, respectively:

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

And:

$\qquad\scriptsize\boldsymbol{b} = (x_b,y_b)$
$\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 $\boldsymbol{a}$ and $\boldsymbol{b}$ are, respectively:

$\qquad\scriptsize\boldsymbol{a} = (x_a,y_a,z_a)$

And:

$\qquad\scriptsize\boldsymbol{b} = (x_b,y_b,z_b)$

Then:

$\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=(x_1, y_1)$ and the terminal point $B=(x_2, y_2)$, then vector$\boldsymbol{a}$ may be expressed as:

$\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:

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

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

What do we need to do?

1. First, calculate vector $\boldsymbol{b}$, given the initial and terminal points:
$\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 $\boldsymbol{a}$ and $\boldsymbol{b}$:
$\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:
$\qquad\scriptsize\begin{split} |\boldsymbol{a}|&=\sqrt{3^2+6^2+1^2}\\ &=\sqrt{46}\approx6.782 \end{split}$

And:

$\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:
$\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}$