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.
By the PracticeCalculus team Published 7 min read
On this page
- What is a vector?
- Magnitude and unit vectors
- The dot product: definition and meaning
- How to find the angle between two vectors
- Projections: the shadow of one vector on another
- The cross product: definition and right-hand rule
- Dot product vs cross product: quick reference
- Common mistakes with vectors
- Build fluency with quick reps
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
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":
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:
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.
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:
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:
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:
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.
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?
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
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:
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.
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.
Step 2. Cross product.
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
- Treating the dot product as a vector. \langle 1, 2 \rangle \cdot \langle 3, 4 \rangle = 11, a single number.
- Forgetting to divide by both lengths when finding an angle. Dividing only by |\mathbf{a}| gives a cosine that can exceed 1.
- 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.
- Swapping the order of a cross product and losing a sign.
- Forgetting to halve for a triangle's area.
- 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 to the gradient, leans on them. The interactive lesson below throws fresh vectors at you, checks every component instantly, and shows exactly where a sign slipped.
Practice it now
The dot product
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson