Calculate Angle Between Two Vectors

Online calculator for calculating the angle between two vectors in 2D and 3D space

Vector Angle Calculator

Angle Between Vectors

Calculates the angle θ between two vectors a⃗ and b⃗ using the dot product in 2D or 3D space.

Choose Dimensions
Enter Vector Components
Vector a⃗
Vector b⃗
Y-Component
Result
Angle θ:

Visualization

Angle between vectors

The graphic shows two vectors with their common origin and the included angle.
The angle is calculated using the dot product and vector lengths.

What is the Angle Between Two Vectors?

The angle between two vectors is the smallest angle between their directions:

  • Range: 0° to 180° (0 to π radians)
  • Common origin: Vectors start from the same point
  • Direction dependent: Only direction matters, not position
  • 0°: Vectors point in the same direction
  • 90°: Vectors are perpendicular to each other
  • 180°: Vectors point in opposite directions

Calculation via Dot Product

The angle calculation is done using the dot product of the vectors:

Dot Product
\[\vec{a} \cdot \vec{b} = a_x \cdot b_x + a_y \cdot b_y + a_z \cdot b_z\]

Sum of component products

Vector Lengths
\[|\vec{a}| = \sqrt{a_x^2 + a_y^2 + a_z^2}\]

Euclidean norm of the vectors

2D and 3D Vectors

The calculator supports both 2D and 3D vectors:

2D Vectors
\[\vec{a} = \begin{pmatrix} a_x \\ a_y \end{pmatrix}, \vec{b} = \begin{pmatrix} b_x \\ b_y \end{pmatrix}\]

Vectors in the plane (x, y)

3D Vectors
\[\vec{a} = \begin{pmatrix} a_x \\ a_y \\ a_z \end{pmatrix}, \vec{b} = \begin{pmatrix} b_x \\ b_y \\ b_z \end{pmatrix}\]

Vectors in space (x, y, z)

Formulas for Angle Calculation

Main Formula - Angle via Dot Product
\[\cos(\theta) = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}| \cdot |\vec{b}|}\]

Cosine of the angle through normalized dot product

Dot Product 2D
\[\vec{a} \cdot \vec{b} = a_x \cdot b_x + a_y \cdot b_y\]

Dot product in the plane

Dot Product 3D
\[\vec{a} \cdot \vec{b} = a_x \cdot b_x + a_y \cdot b_y + a_z \cdot b_z\]

Dot product in space

Vector Length 2D
\[|\vec{a}| = \sqrt{a_x^2 + a_y^2}\]

Length in the plane

Vector Length 3D
\[|\vec{a}| = \sqrt{a_x^2 + a_y^2 + a_z^2}\]

Length in space

Calculate Angle
\[\theta = \arccos\left(\frac{\vec{a} \cdot \vec{b}}{|\vec{a}| \cdot |\vec{b}|}\right)\]

Arccosine of the normalized dot product

Example

Example Calculation (2D)
a⃗(4,7) b⃗(5,2)
1. Dot Product
\[\vec{a} \cdot \vec{b} = 4 \cdot 5 + 7 \cdot 2 = 34\]

Sum of component products

2. Vector Lengths
\[|\vec{a}| = \sqrt{16+49} = \sqrt{65}\] \[|\vec{b}| = \sqrt{25+4} = \sqrt{29}\]

Lengths of both vectors

3. Calculate Cosine
\[\cos(\theta) = \frac{34}{\sqrt{65} \cdot \sqrt{29}} \approx 0.781\]

Normalized dot product

4. Angle
\[\theta = \arccos(0.781) \approx 38.7°\]

The angle is approximately 38.7°

Vector Angles in Linear Algebra

The angle between two vectors is a fundamental concept in linear algebra and geometry. It describes the directional relationship between two vectors regardless of their position in space and is calculated exclusively using the dot product and vector lengths.

Mathematical Foundations

The angle calculation is based on the geometric interpretation of the dot product:

\[\vec{a} \cdot \vec{b} = |\vec{a}| \cdot |\vec{b}| \cdot \cos(\theta)\]

By rearranging for the cosine, we get the angle formula:

\[\cos(\theta) = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}| \cdot |\vec{b}|}\]

Step-by-Step Calculation

  1. Calculate dot product: Sum of component products
  2. Determine vector lengths: Euclidean norm of each vector
  3. Calculate cosine: Dot product divided by length product
  4. Find angle: Arccosine of the calculated value

Special Angle Values

0° (Parallel)

cos(θ) = 1
Vectors point in same direction

90° (Orthogonal)

cos(θ) = 0
Vectors are perpendicular

180° (Anti-parallel)

cos(θ) = -1
Vectors point in opposite directions

Practical Applications

Vector angle calculation is found in many areas:

  • Computer graphics: Lighting calculations, normal vectors
  • Physics: Force and velocity vectors, torques
  • Machine learning: Similarity measurements, data analysis
  • Robotics: Motion planning, orientation determination
  • Navigation: Direction finding, GPS calculations
  • Crystallography: Bond angles in molecules

Properties of Vector Angles

Commutativity

The angle between a⃗ and b⃗ equals the angle between b⃗ and a⃗.

Dimension Independence

The formula works equally for 2D, 3D and higher dimensions.

Scale Invariance

Vector length doesn't affect the angle, only direction matters.

Value Range

The angle always lies between 0° and 180° (0 and π radians).

Related Concepts

The dot product and vector angle are closely related to other mathematical concepts:

  • Orthogonality: Two vectors are orthogonal when their dot product is zero
  • Projection: The projection of one vector onto another depends on the angle
  • Law of cosines: The vector angle generalizes the law of cosines for n-dimensional spaces
  • Norm and metric: The angle defines a natural metric in vector space

Is this page helpful?            
Thank you for your feedback!

Sorry about that

How can we improve it?


More graphics functions

Angle of two lines  •  Angle of two vectors  •  Center of a straight line  •  Distance of two points  •  Distance of a point and a line  •  Rise over Run  •  Slope of a line  •  Straight line equation  •  Circular arc  •  Helix  •  Koch snowflake  •