Angle Between Two Vectors Calculator

Find the angle between two vectors in 2D or 3D using the dot product, step by step
Angle between (3, 4) and (4, 3)
Angle between (1, 2, 3) and (-2, 1, 4)
Angle at vertex B in the triangle A(1,2), B(4,3), C(2,7)
Are (2, -1) and (1, 2) perpendicular?

The Dot Product Formula

The angle ╬╕\theta between two vectors comes from the dot product:

cosтБб╬╕=uтГЧтЛЕvтГЧтИеuтГЧтИетАЙтИеvтГЧтИетЯ╣╬╕=arccosтБбтАЙтБг(uтГЧтЛЕvтГЧтИеuтГЧтИетАЙтИеvтГЧтИе)\cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\|\,\|\vec{v}\|} \qquad\Longrightarrow\qquad \theta = \arccos\!\left(\frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\|\,\|\vec{v}\|}\right)

In 2D, with uтГЧ=(u1,u2)\vec{u} = (u_1, u_2) and vтГЧ=(v1,v2)\vec{v} = (v_1, v_2):

uтГЧтЛЕvтГЧ=u1v1+u2v2,тИеuтГЧтИе=u12+u22\vec{u} \cdot \vec{v} = u_1v_1 + u_2v_2, \qquad \|\vec{u}\| = \sqrt{u_1^2 + u_2^2}

In 3D the pattern just gains a term:

uтГЧтЛЕvтГЧ=u1v1+u2v2+u3v3,тИеuтГЧтИе=u12+u22+u32\vec{u} \cdot \vec{v} = u_1v_1 + u_2v_2 + u_3v_3, \qquad \|\vec{u}\| = \sqrt{u_1^2 + u_2^2 + u_3^2}

The formula requires both vectors to be non-zero тАФ the zero vector has no direction, so the angle is undefined. It returns the smaller angle between the two directions, always in [0тИШ,180тИШ][0^\circ, 180^\circ].

Step-by-Step, and Reading the Sign

  1. Dot product: multiply matching components and add.
  2. Magnitudes: square each component, sum, take the square root.
  3. Divide: cosтБб╬╕=(uтГЧтЛЕvтГЧ)/(тИеuтГЧтИетИеvтГЧтИе)\cos\theta = (\vec{u}\cdot\vec{v})/(\|\vec{u}\|\|\vec{v}\|). This value always lies in [тИТ1,1][-1, 1]; anything outside means an arithmetic slip.
  4. Inverse cosine: ╬╕=arccosтБб(cosтБб╬╕)\theta = \arccos(\cos\theta). Set your calculator to degrees or radians deliberately тАФ ╧А\pi radians =180тИШ= 180^\circ.

What the sign tells you immediately

uтГЧтЛЕvтГЧ\vec{u}\cdot\vec{v}Angle
>0> 0acute, ╬╕<90тИШ\theta < 90^\circ
=0= 0perpendicular, ╬╕=90тИШ\theta = 90^\circ
<0< 0obtuse, ╬╕>90тИШ\theta > 90^\circ

Angle between two points

Points have no direction, so first convert to vectors. For the angle at vertex BB in triangle ABCABC, build BAтГЧ=AтИТB\vec{BA} = A - B and BCтГЧ=CтИТB\vec{BC} = C - B тАФ both pointing away from the vertex тАФ then apply the same formula. Subtracting in the wrong direction gives the supplement, 180тИШтИТ╬╕180^\circ - \theta.

Direction angle of a single vector

For one 2D vector measured from the positive xx-axis, use ╬╕=arctanтБб(u2/u1)\theta = \arctan(u_2/u_1) and adjust by 180тИШ180^\circ when u1<0u_1 < 0.

Common Mistakes to Avoid

  • Forgetting to divide by the magnitudes. arccosтБб(uтГЧтЛЕvтГЧ)\arccos(\vec{u}\cdot\vec{v}) alone is meaningless and usually out of domain.
  • Adding components instead of multiplying them. The dot product is u1v1+u2v2u_1v_1 + u_2v_2, not (u1+v1)+(u2+v2)(u_1+v_1) + (u_2+v_2).
  • Using the cross product in 2D. sinтБб╬╕=тИеuтГЧ├ЧvтГЧтИе/(тИеuтГЧтИетИеvтГЧтИе)\sin\theta = \|\vec{u}\times\vec{v}\|/(\|\vec{u}\|\|\vec{v}\|) works, but arcsinтБб\arcsin cannot distinguish ╬╕\theta from 180тИШтИТ╬╕180^\circ - \theta. The dot product is unambiguous over the full range.
  • Rounding cosтБб╬╕\cos\theta too early. Keep four or five decimals before applying arccosтБб\arccos; near 0тИШ0^\circ or 180тИШ180^\circ the inverse cosine is extremely sensitive.
  • Ignoring degree/radian mode. An answer of 0.280.28 is radians, 16.2616.26 is degrees тАФ same angle.
  • Using position vectors when you need displacement vectors. For an angle at a point, subtract that point from the other two first.

Examples

Step 1: Dot product: uтГЧтЛЕvтГЧ=3(4)+4(3)=12+12=24\vec{u}\cdot\vec{v} = 3(4) + 4(3) = 12 + 12 = 24
Step 2: Magnitudes: тИеuтГЧтИе=9+16=5\|\vec{u}\| = \sqrt{9 + 16} = 5 and тИеvтГЧтИе=16+9=5\|\vec{v}\| = \sqrt{16 + 9} = 5
Step 3: cosтБб╬╕=245├Ч5=2425=0.96\cos\theta = \dfrac{24}{5 \times 5} = \dfrac{24}{25} = 0.96
Step 4: ╬╕=arccosтБб(0.96)=16.26тИШ\theta = \arccos(0.96) = 16.26^\circ (equivalently 0.28380.2838 rad)
Answer: ╬╕тЙИ16.26тИШ\theta \approx 16.26^\circ

Step 1: Dot product: 1(тИТ2)+2(1)+3(4)=тИТ2+2+12=121(-2) + 2(1) + 3(4) = -2 + 2 + 12 = 12
Step 2: тИеuтГЧтИе=1+4+9=14тЙИ3.7417\|\vec{u}\| = \sqrt{1 + 4 + 9} = \sqrt{14} \approx 3.7417
Step 3: тИеvтГЧтИе=4+1+16=21тЙИ4.5826\|\vec{v}\| = \sqrt{4 + 1 + 16} = \sqrt{21} \approx 4.5826
Step 4: Product of magnitudes: 14├Ч21=294тЙИ17.1464\sqrt{14 \times 21} = \sqrt{294} \approx 17.1464
Step 5: cosтБб╬╕=12/17.1464=0.69985\cos\theta = 12/17.1464 = 0.69985
Step 6: ╬╕=arccosтБб(0.69985)тЙИ45.58тИШ\theta = \arccos(0.69985) \approx 45.58^\circ
Answer: ╬╕тЙИ45.6тИШ\theta \approx 45.6^\circ (about 0.7960.796 rad)

Step 1: Build vectors from the vertex: BAтГЧ=AтИТB=(1тИТ4,тАЙ2тИТ3)=(тИТ3,тИТ1)\vec{BA} = A - B = (1-4,\, 2-3) = (-3, -1)
Step 2: BCтГЧ=CтИТB=(2тИТ4,тАЙ7тИТ3)=(тИТ2,4)\vec{BC} = C - B = (2-4,\, 7-3) = (-2, 4)
Step 3: Dot product: (тИТ3)(тИТ2)+(тИТ1)(4)=6тИТ4=2(-3)(-2) + (-1)(4) = 6 - 4 = 2
Step 4: Magnitudes: 9+1=10\sqrt{9 + 1} = \sqrt{10} and 4+16=20\sqrt{4 + 16} = \sqrt{20}, product =200тЙИ14.1421= \sqrt{200} \approx 14.1421
Step 5: cosтБб╬╕=2/14.1421=0.14142\cos\theta = 2/14.1421 = 0.14142, which is positive but small тАФ expect just under 90тИШ90^\circ
Step 6: ╬╕=arccosтБб(0.14142)тЙИ81.87тИШ\theta = \arccos(0.14142) \approx 81.87^\circ
Answer: тИаABCтЙИ81.87тИШ\angle ABC \approx 81.87^\circ

Frequently Asked Questions

╬╕ = arccos((u ┬╖ v) / (тАЦuтАЦтАЦvтАЦ)). Take the dot product of the two vectors, divide by the product of their magnitudes, then apply the inverse cosine. The same formula works unchanged in 2D, 3D, and any higher dimension.

Yes тАФ only the component count changes. The dot product becomes uтВБvтВБ + uтВВvтВВ + uтВГvтВГ and each magnitude gains a third squared term under the root. Nothing else about the procedure differs, which is why the dot-product method is preferred over cross products in 3D.

Points alone do not define an angle, so pick the vertex where the angle sits and subtract it from the other two points to form vectors. For the angle at B in triangle ABC, use BA = A тИТ B and BC = C тИТ B, then apply the dot-product formula. Both vectors must point away from the vertex.

It means the angle is obtuse тАФ greater than 90┬░ тАФ because cos ╬╕ is negative there. A dot product of exactly zero means the vectors are perpendicular, and a positive value means the angle is acute. You can read the shape of the answer before computing any inverse cosine.

Related Solvers

Related Guides

Try AI-Math for Free

Get step-by-step solutions to any math problem. Upload a photo or type your question.

Start Solving