# Vectors, Dot Product and Cross Product: A Clear Guide With Examples

> Learn vector components and magnitude, the dot product and the angle between vectors, and the cross product and area, with fully worked examples.

Source: https://practicecalculus.com/blog/vectors-dot-and-cross-product
Updated: 2026-08-19

## Key takeaways

- The dot product $\mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2 + a_3 b_3$ is a number, and it also equals $|\mathbf{a}||\mathbf{b}|\cos\theta$.
- Two nonzero vectors are perpendicular exactly when their dot product is 0.
- The cross product $\mathbf{a} \times \mathbf{b}$ is a vector perpendicular to both $\mathbf{a}$ and $\mathbf{b}$, with length equal to the area of the parallelogram they span.
- The cross product only works in 3D, and order matters: $\mathbf{b} \times \mathbf{a} = -(\mathbf{a} \times \mathbf{b})$.

Calculus 3 starts by moving from numbers to arrows. Forces, velocities and gradients all have a size and a direction, and you need a way to measure angles, test for right angles and find areas without drawing anything. The dot product and the cross product are those two tools.

This guide covers vector components and length, the dot product and angles, projections, and the cross product and area, each with a fully worked example.

## What is a vector?

A **vector** is a quantity with both a **magnitude** (length) and a **direction**. In components, a vector in 3D is written

$$\mathbf{a} = \langle a_1, a_2, a_3 \rangle = a_1\mathbf{i} + a_2\mathbf{j} + a_3\mathbf{k}$$

where $\mathbf{i}, \mathbf{j}, \mathbf{k}$ are the unit vectors along the $x$, $y$ and $z$ axes. The vector from point $P(x_1, y_1, z_1)$ to point $Q(x_2, y_2, z_2)$ is "end minus start":

$$\overrightarrow{PQ} = \langle x_2 - x_1,\ y_2 - y_1,\ z_2 - z_1 \rangle$$

You add vectors and multiply them by numbers one component at a time: $\langle 1, 2, 3\rangle + \langle 4, 0, -1 \rangle = \langle 5, 2, 2 \rangle$ and $3\langle 1, -2, 0\rangle = \langle 3, -6, 0 \rangle$.

## Magnitude and unit vectors

The **magnitude** of $\mathbf{a}$ comes from the Pythagorean theorem:

$$|\mathbf{a}| = \sqrt{a_1^2 + a_2^2 + a_3^2}$$

A **unit vector** has length 1. To get the unit vector in the direction of $\mathbf{a}$, divide by its length: $\mathbf{u} = \frac{\mathbf{a}}{|\mathbf{a}|}$.

### Worked example 1: length and unit vector

Find $|\mathbf{a}|$ and the unit vector in the direction of $\mathbf{a} = \langle 3, -2, 6 \rangle$.

**Step 1. Square and add the components.** $3^2 + (-2)^2 + 6^2 = 9 + 4 + 36 = 49$.

**Step 2. Take the square root.** $|\mathbf{a}| = \sqrt{49} = 7$.

**Step 3. Divide by the length.**

$$\mathbf{u} = \frac{1}{7}\langle 3, -2, 6 \rangle = \left\langle \tfrac{3}{7}, -\tfrac{2}{7}, \tfrac{6}{7} \right\rangle$$

Check: $\frac{9 + 4 + 36}{49} = 1$, so $\mathbf{u}$ really has length 1.

## The dot product: definition and meaning

The **dot product** multiplies matching components and adds the results:

$$\mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2 + a_3 b_3$$

The answer is a **number**, not a vector. The key fact is that it also has a geometric formula, where $\theta$ is the angle between the vectors:

$$\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}|\,|\mathbf{b}|\cos\theta$$

So the dot product measures how much two vectors point the same way:

- $\mathbf{a} \cdot \mathbf{b} > 0$: the angle is acute (less than 90°).
- $\mathbf{a} \cdot \mathbf{b} = 0$: the vectors are **perpendicular** (orthogonal).
- $\mathbf{a} \cdot \mathbf{b} < 0$: the angle is obtuse (more than 90°).

Also notice that $\mathbf{a} \cdot \mathbf{a} = |\mathbf{a}|^2$, which is a handy shortcut for lengths.

## How to find the angle between two vectors

Solve the geometric formula for $\cos\theta$:

$$\cos\theta = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}|\,|\mathbf{b}|}$$

### Worked example 2: the angle between two vectors

Find the angle between $\mathbf{a} = \langle 1, 1, 0 \rangle$ and $\mathbf{b} = \langle 1, 0, 1 \rangle$.

**Step 1. Dot product.** $\mathbf{a} \cdot \mathbf{b} = (1)(1) + (1)(0) + (0)(1) = 1$.

**Step 2. Lengths.** $|\mathbf{a}| = \sqrt{1 + 1 + 0} = \sqrt{2}$ and $|\mathbf{b}| = \sqrt{2}$.

**Step 3. Cosine of the angle.**

$$\cos\theta = \frac{1}{\sqrt{2}\cdot\sqrt{2}} = \frac{1}{2}$$

**Step 4. Inverse cosine.** $\theta = \arccos\frac{1}{2} = \frac{\pi}{3}$, or $60^\circ$.

### Worked example 3: testing for perpendicular vectors

Are $\mathbf{a} = \langle 2, 1, -1 \rangle$ and $\mathbf{b} = \langle 1, -1, 1 \rangle$ perpendicular?

$$\mathbf{a} \cdot \mathbf{b} = (2)(1) + (1)(-1) + (-1)(1) = 2 - 1 - 1 = 0$$

The dot product is 0 and neither vector is zero, so yes, they are perpendicular. No angle calculation needed.

## Projections: the shadow of one vector on another

The dot product also tells you how much of $\mathbf{a}$ points along $\mathbf{b}$. The **scalar projection** (component) and **vector projection** are

$$\text{comp}_{\mathbf{b}}\,\mathbf{a} = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{b}|}, \qquad \text{proj}_{\mathbf{b}}\,\mathbf{a} = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{b}|^2}\,\mathbf{b}$$

For $\mathbf{a} = \langle 4, 2 \rangle$ and $\mathbf{b} = \langle 3, 4 \rangle$: $\mathbf{a} \cdot \mathbf{b} = 12 + 8 = 20$ and $|\mathbf{b}| = 5$. The component is $\frac{20}{5} = 4$, and the projection is $\frac{20}{25}\langle 3, 4 \rangle = \left\langle \frac{12}{5}, \frac{16}{5} \right\rangle$, which has length 4 as expected. In physics, work done by a constant force $\mathbf{F}$ over a displacement $\mathbf{d}$ is exactly $W = \mathbf{F} \cdot \mathbf{d}$.

## The cross product: definition and right-hand rule

The **cross product** of two 3D vectors is a **vector**. The easiest way to compute it is a 3 by 3 determinant:

$$\mathbf{a} \times \mathbf{b} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3 \end{vmatrix} = \langle a_2 b_3 - a_3 b_2,\ a_3 b_1 - a_1 b_3,\ a_1 b_2 - a_2 b_1 \rangle$$

What it means geometrically:

- **Direction:** $\mathbf{a} \times \mathbf{b}$ is perpendicular to both $\mathbf{a}$ and $\mathbf{b}$. Point your right-hand fingers along $\mathbf{a}$, curl them toward $\mathbf{b}$, and your thumb points along $\mathbf{a} \times \mathbf{b}$.
- **Length:** $|\mathbf{a} \times \mathbf{b}| = |\mathbf{a}|\,|\mathbf{b}|\sin\theta$, which is the **area of the parallelogram** with sides $\mathbf{a}$ and $\mathbf{b}$.
- **Order matters:** $\mathbf{b} \times \mathbf{a} = -(\mathbf{a} \times \mathbf{b})$.
- **Parallel vectors** have cross product $\mathbf{0}$, since $\sin 0 = 0$.

### Worked example 4: computing a cross product

Find $\mathbf{a} \times \mathbf{b}$ for $\mathbf{a} = \langle 1, 2, 3 \rangle$ and $\mathbf{b} = \langle 4, 5, 6 \rangle$.

**Step 1. First component** (cover the $\mathbf{i}$ column): $a_2 b_3 - a_3 b_2 = (2)(6) - (3)(5) = 12 - 15 = -3$.

**Step 2. Second component** (cover the $\mathbf{j}$ column): $a_3 b_1 - a_1 b_3 = (3)(4) - (1)(6) = 12 - 6 = 6$.

**Step 3. Third component** (cover the $\mathbf{k}$ column): $a_1 b_2 - a_2 b_1 = (1)(5) - (2)(4) = 5 - 8 = -3$.

$$\mathbf{a} \times \mathbf{b} = \langle -3, 6, -3 \rangle$$

**Step 4. Check with dot products.** $\langle -3, 6, -3 \rangle \cdot \langle 1, 2, 3 \rangle = -3 + 12 - 9 = 0$ and $\langle -3, 6, -3 \rangle \cdot \langle 4, 5, 6 \rangle = -12 + 30 - 18 = 0$. The result is perpendicular to both, as it should be.

The parallelogram spanned by $\mathbf{a}$ and $\mathbf{b}$ has area $|\langle -3, 6, -3 \rangle| = \sqrt{9 + 36 + 9} = \sqrt{54} = 3\sqrt{6}$.

> **Tip:** always run the two dot product checks. A sign error in the middle component is the classic slip, and the check catches it in seconds.

### Worked example 5: area of a triangle in space

Find the area of the triangle with corners $P(1, 0, 0)$, $Q(0, 2, 0)$ and $R(0, 0, 3)$.

**Step 1. Two side vectors from $P$.**

$$\overrightarrow{PQ} = \langle -1, 2, 0 \rangle, \qquad \overrightarrow{PR} = \langle -1, 0, 3 \rangle$$

**Step 2. Cross product.**

$$\overrightarrow{PQ} \times \overrightarrow{PR} = \langle (2)(3) - (0)(0),\ (0)(-1) - (-1)(3),\ (-1)(0) - (2)(-1) \rangle = \langle 6, 3, 2 \rangle$$

**Step 3. Length.** $\sqrt{36 + 9 + 4} = \sqrt{49} = 7$. That is the parallelogram's area.

**Step 4. Halve it.** The triangle's area is $\frac{7}{2}$.

As a bonus, $\langle 6, 3, 2 \rangle$ is perpendicular to the plane through $P$, $Q$ and $R$, so that plane is $6x + 3y + 2z = 6$. (Check: all three points satisfy it.)

## Dot product vs cross product: quick reference

| | Dot product $\mathbf{a} \cdot \mathbf{b}$ | Cross product $\mathbf{a} \times \mathbf{b}$ |
| --- | --- | --- |
| Result | A number | A vector |
| Component formula | $a_1 b_1 + a_2 b_2 + a_3 b_3$ | 3 by 3 determinant |
| Geometric formula | $\lvert\mathbf{a}\rvert\lvert\mathbf{b}\rvert\cos\theta$ | length $\lvert\mathbf{a}\rvert\lvert\mathbf{b}\rvert\sin\theta$ |
| Equals zero when | vectors are perpendicular | vectors are parallel |
| Order | $\mathbf{a} \cdot \mathbf{b} = \mathbf{b} \cdot \mathbf{a}$ | $\mathbf{b} \times \mathbf{a} = -\mathbf{a} \times \mathbf{b}$ |
| Dimensions | any | 3D only |
| Used for | angles, projections, work | normal vectors, areas, torque |

## Common mistakes with vectors

1. **Treating the dot product as a vector.** $\langle 1, 2 \rangle \cdot \langle 3, 4 \rangle = 11$, a single number.
2. **Forgetting to divide by both lengths** when finding an angle. Dividing only by $|\mathbf{a}|$ gives a cosine that can exceed 1.
3. **Getting the middle component of the cross product backwards.** It is $a_3 b_1 - a_1 b_3$, which is the negative of the 2 by 2 minor. Check with dot products.
4. **Swapping the order of a cross product** and losing a sign.
5. **Forgetting to halve** for a triangle's area.
6. **Subtracting points in the wrong order.** $\overrightarrow{PQ}$ is $Q - P$, end minus start.

## Build fluency with quick reps

Dot and cross products are pure arithmetic, so speed and accuracy come only from repetition. Everything later in Calculus 3, from [partial derivatives](/blog/partial-derivatives) to the [gradient](/blog/gradient-and-directional-derivatives), leans on them. The interactive lesson below throws fresh vectors at you, checks every component instantly, and shows exactly where a sign slipped.

## Frequently asked questions

### What is the difference between the dot product and the cross product?

The dot product of two vectors is a number (a scalar) that measures how much they point the same way. The cross product is a new vector perpendicular to both, whose length measures how far apart they point. Dot products work in any dimension, cross products only in three.

### How do you find the angle between two vectors?

Use $\cos\theta = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}||\mathbf{b}|}$, then take the inverse cosine. The result is always between $0$ and $\pi$ radians (0 and 180 degrees).

### What does a dot product of zero mean?

If neither vector is the zero vector, a dot product of zero means the vectors are perpendicular (orthogonal), because $\cos 90^\circ = 0$. A positive dot product means the angle is acute, and a negative one means it is obtuse.

### How do you find the area of a triangle with the cross product?

Make two vectors along two sides of the triangle from a shared corner, take their cross product and find its length. That length is the area of the parallelogram, so the triangle's area is half of it.

### Is the cross product commutative?

No. Swapping the order flips the direction: $\mathbf{b} \times \mathbf{a} = -(\mathbf{a} \times \mathbf{b})$. The length stays the same, but the vector points the opposite way, which matches the right-hand rule.
