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θ=uvuvθ=arccos ⁣(uvuv)\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):

uv=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:

uv=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θ=(uv)/(uv)\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

uv\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=AB\vec{BA} = A - B and BC=CB\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 180180^\circ when u1<0u_1 < 0.

Common Mistakes to Avoid

  • Forgetting to divide by the magnitudes. arccos(uv)\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/(uv)\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 00^\circ or 180180^\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: uv=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=143.7417\|\vec{u}\| = \sqrt{1 + 4 + 9} = \sqrt{14} \approx 3.7417
Step 3: v=4+1+16=214.5826\|\vec{v}\| = \sqrt{4 + 1 + 16} = \sqrt{21} \approx 4.5826
Step 4: Product of magnitudes: 14×21=29417.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=AB=(14,23)=(3,1)\vec{BA} = A - B = (1-4,\, 2-3) = (-3, -1)
Step 2: BC=CB=(24,73)=(2,4)\vec{BC} = C - B = (2-4,\, 7-3) = (-2, 4)
Step 3: Dot product: (3)(2)+(1)(4)=64=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 =20014.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 9090^\circ
Step 6: θ=arccos(0.14142)81.87\theta = \arccos(0.14142) \approx 81.87^\circ
Answer: ABC81.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