---
title: Vector fields
heading: An arrow at every point in space
eyebrow: A9 · Lesson 23 · Vector fields
xp: 40
---

::: hook
A voltage is one number at each point. An electric field is an arrow at each point: a direction and a strength. So is a magnetic field, the flow of current in a conductor, and the wind on a weather map. Learning to read a picture of arrows at a glance, to see where they spread out, where they swirl and where they're strong, is most of what it takes to understand Maxwell's equations later.

::: play
- The arrows show the field $\mathbf{F} = (a x - b y + c,\ a y + b x)$, with lengths in proportion to its strength. The curves follow the field from a few starting points, like dust in a stream.
- Raise $a$ alone. Then $b$ alone. Then $c$ alone. Describe each pattern in a word or two.
- Mix $a$ and $b$. What shape do the curves make now?
:::
:::

```sim plot
view: flow
x: x = -2..2 m
y: y = -2..2 m
slider: a = -1..1 step 0.1 = 0.5
slider: b = -1..1 step 0.1 = 0
slider: c = -1..1 step 0.1 = 0
dx: a*x - b*y + c
dy: a*y + b*x
arrows: scaled
grid: 14
start: 0.3, 0.2 | forward
start: -0.4, 0.5 | forward
start: 0.1, -0.6 | forward
```

::: predict
## With $b$ alone (a = c = 0), the field is $\mathbf{F} = (-by,\ bx)$. What do the curves do?

- [ ] Spread straight out from the center
- [x] Go around the center in circles
- [ ] Run in parallel straight lines
- [ ] Spiral into the center

::: reveal
They circle the center. At every point $(-by, bx)$ is square to the line from the center, so the flow goes around and never in or out. That swirl is what a magnetic field looks like around a wire. With $a$ alone the arrows point straight out, like the field of a positive charge, and with $c$ alone everything moves the same way, like the field between parallel plates. Mixing $a$ and $b$ gives a spiral.
:::
:::

::: nameit
## Reading a vector field

A **vector field** assigns a vector to every point: $\mathbf{F}(x, y) = \big(F_x(x, y),\ F_y(x, y)\big)$ in a plane, or three parts in space. Two ways to draw one:

- **Arrows** on a grid, each showing the field there. Their lengths usually have to be scaled down to fit, and where the field varies a lot, short arrows can be hard to see.
- **Field lines**, curves that are tangent to the field everywhere. Their direction shows the field's direction, and how tightly they bunch shows its strength. A field line through a point is found the way lesson A8.1 found solution curves: follow the arrows in small steps.

**Three basic patterns** appear again and again:

| Pattern | Example | Looks like |
|---|---|---|
| uniform | $(c, 0)$ | parallel lines, the same everywhere: the field between charged plates |
| source | $(x, y)$ | arrows spreading out: the field of a positive charge (a sink if reversed) |
| rotation | $(-y, x)$ | circles: the magnetic field around a wire |

Most fields you'll meet are combinations of these, varying from place to place. Lesson 33 measures how much a field spreads out at a point (its **divergence**), and lesson 34 how much it swirls (its **curl**).

**Physical fields.** In electromagnetics the important fields are $\mathbf{E}$ (volts per meter), $\mathbf{B}$ (teslas), and the current density $\mathbf{J}$ (amperes per square meter): how much current flows through each bit of a conductor's cross section. Electric field lines start on positive charges and end on negative ones. Magnetic field lines never end: they always close on themselves.
:::

::: example
## Describe $\mathbf{F} = (-y, x)$.

::: solution
1. **Sample a few points.** At $(1, 0)$ it's $(0, 1)$; at $(0, 2)$ it's $(-2, 0)$.
2. **Spot the pattern.** Every arrow is perpendicular to the line from the origin and as long as the distance from it.

**Answer:** a rigid counterclockwise rotation, like the velocity of a spinning disk.
:::
:::

::: example
## Describe $\mathbf{F} = (x, y)$.

::: solution
1. **Direction.** Each arrow points straight away from the origin.
2. **Length.** Each arrow's length equals its distance $r$ from the origin.
3. **Overall picture.** The field spreads outward everywhere, a source spread evenly through space (its divergence is 2 everywhere).

**Answer:** an outward spread from the origin, growing with distance, with divergence 2 everywhere.
:::
:::

::: example
## Describe the field $\mathbf{F} = (y, x)$.

::: solution
1. **Along the diagonals.** On the line $y = x$ it points away from the origin along that line; on $y = -x$ it points toward the origin. Elsewhere it bends between the two.
2. **Field lines.** They're the hyperbolas
   $$x^2 - y^2 = C$$
   so flow comes in along one diagonal and leaves along the other.
3. **Curl and divergence.** It's the gradient of $\phi = xy$, so it has no curl, and $\nabla\cdot\mathbf{F} = 0$ too.

**Answer:** a flow along the hyperbolas $x^2 - y^2 = C$, in along one diagonal and out along the other, both irrotational and source-free, like the electric field near the saddle point between two equal charges.
:::
:::

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

## How strong is the field $\mathbf{F} = (\given{a}x - \given{b}y,\ \given{a}y + \given{b}x)$ at $(\given{x0}, \given{y0})$?

::: right
Right. $\mathbf{F} = (\given{a}\cdot\given{x0} - \given{b}\cdot\given{y0},\ \given{a}\cdot\given{y0} + \given{b}\cdot\given{x0})$, and its length is {answer}.
:::

::: misses
- [abs(a*x0 - b*y0) + abs(a*y0 + b*x0)] The parts combine like the sides of a right triangle, not by adding.
- [sqrt((a*x0 + b*y0)^2 + (a*y0 + b*x0)^2)] Check the sign of the $-by$ term.
- [any] Not yet. Find both parts at the point, then $\sqrt{F_x^2 + F_y^2}$.
:::
:::

::: check
kind: match

## Match each field with its pattern.

- $(2, 0)$ :: parallel lines, the same everywhere
- $(x, y)$ :: spreading out from the center
- $(-y, x)$ :: circling the center
- $(-x, -y)$ :: pouring into the center

::: right
Right. Uniform, source, rotation and sink: the building blocks of most fields.
:::
:::

::: check
kind: choice

## A field line diagram shows lines bunched tightly together near a point, and spread far apart elsewhere. Where is the field strongest?

- [x] Where the lines are bunched
- [ ] Where the lines are spread out
- [ ] It's the same everywhere along a line
- [ ] You can't tell from field lines

::: right
Right. The density of field lines shows the strength: lines crowded together mean a strong field.
:::

::: misses
- [2] Spread-out lines mean a weak field.
- [3] Strength varies along a line: lines closer together means stronger.
- [4] Field-line density shows the strength.
:::
:::

::: check
given: a = 2..6 int; x0 = 1 | 3; y0 = 2 | 4
answer: arg(a*x0 + j*a*y0)*180/pi
unit: °
tolerance: 0.5%

## The field $\mathbf{F} = (\given{a}x,\ \given{a}y)$ at $(\given{x0}, \given{y0})$ points at what angle from the $x$ axis?

::: right
Right. A source field points straight away from the center: at $(\given{x0}, \given{y0})$ that's {answer}.
:::

::: misses
- [arg(a*y0 + j*a*x0)*180/pi] You swapped x and y: the angle is $\tan^{-1}(F_y/F_x)$.
- [arg(-a*x0 - j*a*y0)*180/pi] That's pointing in. This field points out.
- [any] Not yet. Find $F_x$ and $F_y$ at the point, then the angle.
:::
:::

::: check
kind: parts
given: x = 1 | 3; y = 2 | 4

## Consider the field $\mathbf{F} = (-y, x)$ at $(\given{x}, \given{y})$.

::: part
answer: sqrt(x^2 + y^2)
tolerance: 0.5%

### What is $|\mathbf{F}|$ there?

::: misses
- [any] $\sqrt{y^2 + x^2}$: it grows with distance from the origin.
:::
:::

::: part
answer: 2
tolerance: 0.5%

### What is the $z$ component of its curl?

::: misses
- [0] $\frac{\partial}{\partial x}x - \frac{\partial}{\partial y}(-y) = 1 + 1$.
- [any] $\frac{\partial F_2}{\partial x} - \frac{\partial F_1}{\partial y}$.
:::
:::
:::

::: check
kind: derivation
vars: x = 0.5..3, y = 0.5..3

## The field of a long wire points along $\hat\theta$ with size $\frac1r$: $\mathbf{B} \propto \frac{(-y, x)}{x^2 + y^2}$.

::: step
answer: 1/sqrt(x^2 + y^2)

### What is $|\mathbf{B}|$, in these units?
:::

::: step
answer: 2*pi

### What is $\oint\mathbf{B}\cdot d\mathbf{l}$ around a circle of radius $r$? (Field $\frac1r$ times length $2\pi r$.)
:::

::: right
Right. The circulation is $2\pi$ for every circle: Ampère's law in miniature.
:::
:::

::: explain
## How can a field-line drawing show both the direction and the strength of a field, when lines have no length to scale?

::: model
The direction is shown by the lines themselves: at each point the field is tangent to the line through it. The strength is shown by how close together the lines are. If lines are drawn so that each carries the same amount of field, a strong region needs many lines through a small area, so they bunch up, and a weak region has them spread far apart.
:::
:::

::: practice

::: check
given: x0 = 1 | 3; y0 = 2 | 4
answer: -y0
tolerance: 0.5%

## What is the $x$ part of $\mathbf{F} = (-y, x)$ at $(\given{x0}, \given{y0})$?

::: misses
- [x0] That's the y part.
- [y0] Mind the minus sign.
- [any] $F_x = -y$.
:::
:::

::: check
given: k = 1..5 int; r = 2..4 int
answer: k*r
tolerance: 0.5%

## How strong is the rotation field $\mathbf{F} = \given{k}(-y, x)$ at distance {r} m from the center?

::: misses
- [k] The rotation gets stronger farther out: $|\mathbf{F}| = kr$.
- [k/r] That's how a wire's magnetic field falls off. This field grows with r.
- [any] $|\mathbf{F}| = k\sqrt{x^2 + y^2}$.
:::
:::

::: check
kind: choice

## Electric field lines begin and end on charges. What about magnetic field lines?

- [ ] They begin on north poles and end on south poles, with nothing inside the magnet
- [x] They never end: they close on themselves
- [ ] They end on currents
- [ ] They go off to infinity in both directions

::: right
Right. There are no magnetic charges, so every magnetic field line is a closed loop (or runs on forever).
:::

::: misses
- [1] Inside a magnet the lines continue from south back to north, closing the loop.
- [3] Lines circle currents; they don't end on them.
- [4] Magnetic field lines close on themselves.
:::
:::
:::
