---
title: Vectors in three dimensions
heading: The cross product, and the force on a wire
eyebrow: A9 · Lesson 1 · Vectors in 3D
xp: 40
---

::: hook
Run a current along a wire through a magnetic field and the wire is pushed sideways: not along the current, not along the field, but perpendicular to both. That's how every electric motor turns. The direction and size of that push come from the **cross product**, the one operation on vectors that only makes sense in three dimensions. With the dot product from A7 and a few facts about lines and planes, it's the toolkit for everything in this course.
:::

::: play
- Two vectors $\mathbf{a}$ and $\mathbf{b}$ lie flat in the $xy$-plane. Their cross product points straight out of the screen (along $z$), with length equal to the area of the parallelogram they span.
- Turn $\mathbf{b}$ past $\mathbf{a}$. What happens to the sign of the cross product?
- When is the area largest? When is it zero?
:::
:::

```sim plot
view: complex
range: 4
slider: la = 1..3 step 0.1 = 2.5
slider: lb = 1..3 step 0.1 = 2
slider: th = -180..180 step 5 = 60 °
arrow: la | label: a
arrow: lb*(1∠th) | color: ch2 | label: b
arrow: lb*(1∠th) | from: la | dashed | color: ch2
arrow: la | from: lb*(1∠th) | dashed
readout: (a × b) along z = la*lb*sin(th°) | digits: 3
readout: parallelogram area = abs(la*lb*sin(th°)) | digits: 3
```

::: predict
## A wire carries current along $+x$ through a magnetic field along $+y$. Which way is the force on it?

- [ ] Along $+x$
- [ ] Along $+y$
- [x] Along $+z$
- [ ] There's no force

::: reveal
Along $+z$. The force is $I\mathbf{L} \times \mathbf{B}$, and $\hat{\mathbf{x}} \times \hat{\mathbf{y}} = \hat{\mathbf{z}}$: perpendicular to both the current and the field, by the right-hand rule. Point your fingers along the current, curl them toward the field, and your thumb gives the force.
:::
:::

::: nameit
## Vectors in 3D

$\mathbf{a} = (a_1, a_2, a_3)$ has length $|\mathbf{a}| = \sqrt{a_1^2 + a_2^2 + a_3^2}$. The dot product works as in A7: $\mathbf{a}\cdot\mathbf{b} = a_1b_1 + a_2b_2 + a_3b_3 = |\mathbf{a}||\mathbf{b}|\cos\theta$.

## The cross product

$\mathbf{a} \times \mathbf{b}$ is a **vector**:

- perpendicular to both $\mathbf{a}$ and $\mathbf{b}$, in the direction given by the right-hand rule;
- of length $|\mathbf{a}||\mathbf{b}|\sin\theta$, the area of the parallelogram they span.

In components,

$$\mathbf{a} \times \mathbf{b} = \begin{vmatrix}\hat{\mathbf{x}} & \hat{\mathbf{y}} & \hat{\mathbf{z}}\\a_1 & a_2 & a_3\\b_1 & b_2 & b_3\end{vmatrix} = (a_2b_3 - a_3b_2,\; a_3b_1 - a_1b_3,\; a_1b_2 - a_2b_1)$$

It's **anticommutative**, $\mathbf{b} \times \mathbf{a} = -\mathbf{a} \times \mathbf{b}$, and parallel vectors give zero.

## Where it appears

- **Magnetic force** on a charge: $\mathbf{F} = q\mathbf{v} \times \mathbf{B}$; on a wire, $\mathbf{F} = I\mathbf{L} \times \mathbf{B}$.
- **Torque:** $\boldsymbol\tau = \mathbf{r} \times \mathbf{F}$, the twist that turns a motor's rotor.
- **Area and orientation:** the normal to a surface patch, which flux (lesson 31) needs.

## Lines and planes

A **line** through $\mathbf{r}_0$ along $\mathbf{v}$: $\mathbf{r}(t) = \mathbf{r}_0 + t\mathbf{v}$.

A **plane** through $\mathbf{r}_0$ with normal $\mathbf{n} = (a, b, c)$: $\mathbf{n}\cdot(\mathbf{r} - \mathbf{r}_0) = 0$, or $ax + by + cz = d$ with $d = \mathbf{n}\cdot\mathbf{r}_0$. The distance from a point $\mathbf{r}_1$ to it is $\frac{|\mathbf{n}\cdot\mathbf{r}_1 - d|}{|\mathbf{n}|}$.
:::

::: example
## Find $(1, 2, 3) \times (4, 5, 6)$ and check it.

::: solution
1. **Cross the components.**
   $$\begin{aligned} x &: 2 \cdot 6 - 3 \cdot 5 = -3 \\ y &: 3 \cdot 4 - 1 \cdot 6 = 6 \\ z &: 1 \cdot 5 - 2 \cdot 4 = -3 \end{aligned}$$
   so the product is $(-3, 6, -3)$.
2. **Check perpendicularity.**
   $$\begin{aligned} &(1, 2, 3)\cdot(-3, 6, -3) \\ &= -3 + 12 - 9 \\ &= 0 \end{aligned}$$
3. **Find its length.** The length is the area of the parallelogram the two vectors span:
   $$\begin{aligned} |(-3, 6, -3)| &= \sqrt{54} \\ &= 7.35 \end{aligned}$$

**Answer:** $(1, 2, 3) \times (4, 5, 6) = (-3, 6, -3)$, perpendicular to $(1, 2, 3)$, with length 7.35.
:::
:::

::: example
## A 0.5 m wire along $+x$ carries 2 A in a 0.1 T field along $+y$. What force does it feel?

::: solution
1. **Write the force on the wire.**
   $$\mathbf{F} = I\mathbf{L} \times \mathbf{B}$$
2. **Put in the vectors.**
   $$\begin{aligned} \mathbf{F} &= 2(0.5\,\hat{\mathbf{x}}) \times (0.1\,\hat{\mathbf{y}}) \\ &= 0.1\,\hat{\mathbf{z}}\ \text{N} \end{aligned}$$
3. **Read the direction.** $\hat{\mathbf{z}}$ points straight up, out of the plane of current and field.

**Answer:** the wire feels 0.1 N straight up, out of the plane of current and field.
:::
:::

::: example
## Find the volume of the box (parallelepiped) with edges $(1, 0, 0)$, $(1, 2, 0)$ and $(0, 1, 3)$.

::: solution
1. **Set up the triple product.** The volume is the absolute value of the triple product $\mathbf{a}\cdot(\mathbf{b}\times\mathbf{c})$, which equals the determinant with the three vectors as rows:
   $$\det\begin{bmatrix}1 & 0 & 0\\1 & 2 & 0\\0 & 1 & 3\end{bmatrix}$$
2. **Expand along the first row.**
   $$\begin{aligned} \det &= 1 \cdot (2 \cdot 3 - 0 \cdot 1) \\ &= 6 \end{aligned}$$
3. **See what each part does.** The cross product $\mathbf{b}\times\mathbf{c}$ gives the area of the base with its direction; dotting with $\mathbf{a}$ picks out the height. A zero result would mean the three edges lie in one plane.

**Answer:** the box has a volume of 6.
:::
:::

::: check
given: a1 = 2 | 3; a2 = 1 | -2; b1 = 1 | 4; b2 = 4 | -3
answer: a1*b2 - a2*b1

## What is the $z$-component of $(\given{a1}, \given{a2}, 0) \times (\given{b1}, \given{b2}, 0)$?

::: right
Right. $a_1b_2 - a_2b_1$ = {answer}, the signed area of the parallelogram.
:::

::: misses
- [a1*b1 + a2*b2] That's the dot product.
- [a2*b1 - a1*b2] That's $\mathbf{b} \times \mathbf{a}$: the order flips the sign.
- [any] Not yet. $a_1b_2 - a_2b_1$.
:::
:::

::: check
given: a2 = 2 | -1; a3 = 3 | 1; b2 = 5 | -3; b3 = 6 | -2
answer: a2*b3 - a3*b2

## What is the $x$-component of $(1, \given{a2}, \given{a3}) \times (4, \given{b2}, \given{b3})$?

::: right
Right. $a_2b_3 - a_3b_2$ = {answer}.
:::

::: misses
- [a3*b2 - a2*b3] Check the order: $a_2b_3 - a_3b_2$.
- [any] Not yet. Cover the $x$ column of the determinant.
:::
:::

::: check
given: q = 1.6e-19 | 3.2e-19; v = 1e5 | 2e6; B = 0.1 | 0.5; th = 30 | 60
answer: q*v*B*sin(th*pi/180)
unit: N
tolerance: 0.5%

## A charge of {q} C moves at {v} m/s at {th}° to a {B} T field. How large is the magnetic force?

::: right
Right. $qvB\sin\theta$ = {answer}.
:::

::: misses
- [q*v*B*cos(th*pi/180)] The cross product uses $\sin\theta$: parallel motion feels no force.
- [q*v*B] Include $\sin\theta$.
- [any] Not yet. $|q\mathbf{v} \times \mathbf{B}| = qvB\sin\theta$.
:::
:::

::: check
given: I = 2 | 10; L = 0.2 | 0.5; B = 0.05 | 0.3
answer: I*L*B
unit: N
tolerance: 0.5%

## A {L} m wire carries {I} A at right angles to a {B} T field. What force does it feel?

::: right
Right. $ILB$ = {answer}.
:::

::: misses
- [I*B/L] Force grows with the length of wire in the field.
- [any] Not yet. $|I\mathbf{L} \times \mathbf{B}|$ at 90°.
:::
:::

::: check
given: a = 1 | 2; b = 3 | -1; c = 2 | 4; x0 = 1 | 2; y0 = 0 | 3; z0 = -1 | 5
answer: a*x0 + b*y0 + c*z0

## The plane through $(\given{x0}, \given{y0}, \given{z0})$ with normal $(\given{a}, \given{b}, \given{c})$ is $\given{a}x + \given{b}y + \given{c}z = d$. What is $d$?

::: right
Right. $d = \mathbf{n}\cdot\mathbf{r}_0$ = {answer}.
:::

::: misses
- [any] Not yet. Substitute the point: $d = ax_0 + by_0 + cz_0$.
:::
:::

::: check
given: d = 6 | 10; x1 = 3 | 5; y1 = 1 | 2; z1 = 4 | 0
answer: abs(2*x1 + y1 + 2*z1 - d)/3
tolerance: 0.5%

## How far is the point $(\given{x1}, \given{y1}, \given{z1})$ from the plane $2x + y + 2z = \given{d}$?

::: right
Right. $\frac{|2x_1 + y_1 + 2z_1 - d|}{|(2, 1, 2)|} = \frac{|\cdots|}{3}$ = {answer}.
:::

::: misses
- [abs(2*x1 + y1 + 2*z1 - d)] Divide by the normal's length, 3.
- [any] Not yet. $\frac{|\mathbf{n}\cdot\mathbf{r}_1 - d|}{|\mathbf{n}|}$.
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 1 | 4

## Take $\mathbf{u} = (\given{a}, 1, 0)$ and $\mathbf{v} = (0, \given{b}, 1)$.

::: part
answer: a*b
tolerance: 0.5%

### What is the $z$ component of $\mathbf{u}\times\mathbf{v}$?

::: misses
- [-a*b] Check the order: $u_xv_y - u_yv_x$.
- [any] $(\mathbf{u}\times\mathbf{v})_z = u_xv_y - u_yv_x$.
:::
:::

::: part
answer: sqrt(1 + a^2 + (a*b)^2)
tolerance: 0.5%

### What is $|\mathbf{u}\times\mathbf{v}|$, the area of the parallelogram they span?

::: misses
- [any] $\mathbf{u}\times\mathbf{v} = (1, -a, ab)$.
:::
:::
:::

::: check
kind: derivation
vars: I = 0.5..5, L = 0.1..2, B = 0.01..1, t = 0..1.5

## A wire of length $L$ carries current $I$ at angle $t$ (radians) to a field $B$.

::: step
answer: I*L*B*sin(t)

### What is the size of the force on it?
:::

::: step
answer: I*L*B

### What is the largest force over all angles?
:::

::: right
Right. $F = ILB\sin\theta$, largest when the wire crosses the field at right angles.
:::
:::

::: explain
## Why is $\mathbf{a} \times \mathbf{b}$ zero when $\mathbf{a}$ and $\mathbf{b}$ are parallel, and largest when they're perpendicular?

::: model
Its length is $|\mathbf{a}||\mathbf{b}|\sin\theta$, the area of the parallelogram the two vectors span. Parallel vectors make a flat parallelogram with no area, so the cross product vanishes; that's why a charge moving along a magnetic field feels no force. As the angle opens, the parallelogram gets taller, and the area is greatest at 90°, where the sides stand at right angles. The dot product does the opposite, measuring how much the vectors line up.
:::
:::

::: practice

::: check
given: a = 2 | 3; b = 4 | 1
answer: sqrt(a^2 + b^2 + 4)
tolerance: 0.5%

## What is the length of $(\given{a}, \given{b}, 2)$?

::: misses
- [any] $\sqrt{a^2 + b^2 + 2^2}$.
:::
:::

::: check
given: r = 0.1 | 0.3; F = 5 | 20
answer: r*F
unit: N·m
tolerance: 0.5%

## A force of {F} N pushes at right angles to a lever {r} m long. What torque does it produce, in N·m?

::: misses
- [any] $|\mathbf{r} \times \mathbf{F}| = rF$ at 90°.
:::
:::

::: check
given: x0 = 1 | 2; vx = 3 | -1; t = 2 | 5
answer: x0 + t*vx

## The line $\mathbf{r}(t) = (\given{x0}, 0, 1) + t(\given{vx}, 2, 0)$. What is $x$ at $t$ = {t}?

::: misses
- [any] $x_0 + tv_x$.
:::
:::
:::
