# Angle Between Two Vectors: Formula & Examples

TL;DR

The angle between two vectors is found from their dot product:

\[ \cos \theta = \frac{\mathbf{a} \cdot \mathbf{b}}{\| \mathbf{a} \| \| \mathbf{b} \|} \]

This article covers the formula, where it comes from, 2D and 3D worked examples, the cross-product alternative, six examples, and the common mistakes.

## What Is the Angle Between Two Vectors?

A **vector** is a quantity with both a size (its **magnitude**, written \( \|\mathbf{a}\| \)) and a direction, drawn as an arrow. The **angle between two vectors** is the angle \( \theta \) you would measure between their two arrows when they start from the same point. By convention, it is taken between 0° and 180° (0 to \( \pi \) radians): 0° when they point the same way, 180° when they point exactly opposite.

The tool that recovers this angle is the **dot product** (or scalar product). For two vectors \( \mathbf{a} \) and \( \mathbf{b} \), the dot product is defined as:

\[ \mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2 \]

And geometrically, it equals the product of the two magnitudes and the cosine of the angle between them:

\[ \mathbf{a} \cdot \mathbf{b} = \|\mathbf{a}\| \|\mathbf{b}\| \cos \theta \]

Setting those two expressions equal allows us to solve for \( \theta \). This material sits in NCERT Class 12, Chapter 10 (Vector Algebra).

## The Formula and Where It Comes From

The formula for the angle between two vectors is derived from the geometric definition of the dot product. Start from:

\[ \mathbf{a} \cdot \mathbf{b} = \|\mathbf{a}\| \|\mathbf{b}\| \cos \theta \]

Divide both sides by the product of the magnitudes:

\[ \cos \theta = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \|\mathbf{b}\|} \]

Then take the inverse cosine to isolate the angle:

\[ \theta = \cos^{-1} \left( \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \|\mathbf{b}\|} \right) \]

The **numerator** \( 
\mathbf{a} \cdot \mathbf{b} \) is computed from components, and the **denominator** is the product of the two lengths. The result of the division is a pure number between −1 and 1, exactly the range where cosine lives.

## The Sign of the Dot Product Tells You the Angle's Type

Before computing anything, the **sign** of \( 
\mathbf{a} \cdot \mathbf{b} \) already classifies the angle:

- **Positive dot product** means \( \cos \theta > 0 \), so the angle is **acute** (less than 90°).
- **Zero dot product** means \( \cos \theta = 0 \), so the angle is exactly **90°**, the vectors are **perpendicular**.
- **Negative dot product** means \( \cos \theta < 0 \), so the angle is **obtuse** (between 90° and 180°).

## Finding the Angle in 2D and 3D

**In 2D**:
\[ \mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2, \quad \|\mathbf{a}\| = \sqrt{a_1^2 + a_2^2} \]

**In 3D**:
\[ \mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2 + a_3 b_3, \quad \|\mathbf{a}\| = \sqrt{a_1^2 + a_2^2 + a_3^2} \]

In both cases, the angle is given by:
\[ \theta = \cos^{-1} \left( \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \|\mathbf{b}\|} \right) \]

## Examples of the Angle Between Two Vectors

### Example 1 - Find the angle between \( \mathbf{a} = \langle 3,0\rangle \) and \( \mathbf{b} = \langle 0,5\rangle \)

Dot product: \( \mathbf{a} \cdot \mathbf{b} = 0 \). Final answer: \( \theta = 90° \).

### Example 2 - Find the angle between \( \mathbf{a} = \langle 1,-2\rangle \) and \( \mathbf{b} = \langle -2,1\rangle \)

Dot product: \( \mathbf{a} \cdot \mathbf{b} = -4 \). Final answer: \( \theta \approx 143.13° \).

### Example 3 - Find the angle between \( \mathbf{a} = \langle 1,1\rangle \) and \( \mathbf{b} = \langle 1,0\rangle \)

Dot product: \( \mathbf{a} \cdot \mathbf{b} = 1 \). Final answer: \( \theta = 45° \).

### Example 4 - Find the angle between \( \mathbf{a} = \langle 2,2\rangle \) and \( \mathbf{b} = \langle 4,4\rangle \)

Dot product: \( \mathbf{a} \cdot \mathbf{b} = 16 \). Final answer: \( \theta = 0° \).

### Example 5 - Find the angle between the 3D vectors \( \mathbf{a} = \langle 1,2,3\rangle \) and \( \mathbf{b} = \langle 3,-2,1\rangle \)

Dot product: \( \mathbf{a} \cdot \mathbf{b} = 2 \). Final answer: \( \theta \approx 81.79° \).

### Example 6 - Two forces act on a point as vectors \( 
\mathbf{F_1} = \langle 6, 8 \rangle \) and \( \mathbf{F_2} = \langle 8, -6 \rangle \).

Dot product: \( \mathbf{F_1} \cdot \mathbf{F_2} = 0 \). Final answer: \( \theta = 90° \).

## Why the Angle Between Two Vectors Matters

This formula underlies numerous technologies:

- **Physics:** Work done equals \( \mathbf{F} \cdot \mathbf{d} = \|\mathbf{F}\|\|\mathbf{d}\| \cos \theta \).
- **Computer graphics:** Surface brightness is determined by the angle between the surface normal vector and the light direction.
- **Machine learning:** Cosine similarity measures how similar two entities are using this formula.
- **Navigation:** Drones or self-driving vehicles evaluate heading direction against target direction.

## The Mistakes Students Make Most Often With the Angle Between Two Vectors

### Mistake 1: Dropping the sign of the dot product
- Keep the sign to avoid misclassification of the angle.

### Mistake 2: Forgetting the square root in the magnitude
- Magnitude must be correctly calculated as the square root of the sum of squares.

### Mistake 3: Getting a cosine outside \([-1, 1]\)
- Out-of-range values signal upstream errors in the calculations.

## Key Takeaways

- The **angle between two vectors** is \( \theta = \cos^{-1} \left( \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \|\mathbf{b}\|} \right) \).
- The formula stems from the geometric definition of the dot product.
- The sign of the dot product indicates angle types: positive, zero, or negative.
- Magnitudes in 3D expand upon 2D by adding another dimension.
- Common errors include misusing the dot product sign and forgetting square roots in maginitudes.

## Practice Problems
1. Find the angle between \( \mathbf{a} = \langle 1, 0 \rangle \) and \( \mathbf{b} = \langle 1, 1 \rangle \).
2. Find the angle between \( \mathbf{a} = \langle 2, -1 \rangle \) and \( \mathbf{b} = \langle -1, 2 \rangle \).
3. Find the angle between 3D vectors \( \mathbf{a} = \langle 1, 0, 1 \rangle \) and \( \mathbf{b} = \langle 0, 1, 0 \rangle \).

Answers:
1. 45°. Answer to Question 2: about 143.13°. Answer to Question 3: 90°.
