Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 39 · Line and Surface Integrals

Vector Fields

Learn what a vector field is, how to read and plot one, how flow lines follow it, and how gradient fields come from scalar functions. Python plots included.

Wind speed and direction at every point of a map. The gravitational pull at every point of space. The velocity of water at every point of a river. Each is a vector field: a rule that attaches a vector to every point.

Vector fields are the objects you integrate in the rest of this track. Before doing that, you need to be comfortable reading, plotting and thinking about them.

Definition

A vector field in the plane is a function that assigns to each point (x, y) a vector:

Text
F(x, y) = ⟨P(x, y), Q(x, y)⟩ = P(x, y) i + Q(x, y) j

P and Q are ordinary scalar functions called the components. In space, a vector field is F(x, y, z) = ⟨P, Q, R⟩.

The field is continuous or differentiable when its component functions are. We will assume smooth fields throughout.

Reading a few fields

Field What it looks like
F = ⟨x, y⟩ Points directly away from the origin; longer far out. A source.
F = ⟨-x, -y⟩ Points toward the origin. A sink.
F = ⟨-y, x⟩ Circulates counterclockwise around the origin; the length equals the distance r.
F = ⟨1, 0⟩ Constant: the same vector everywhere, like a uniform wind.

To read a field at a point, just evaluate it. For F = ⟨-y, x⟩ at (2, 1) we get ⟨-1, 2⟩.

Plotting with arrows

The standard picture draws a small arrow at each grid point, in the direction of F there. Matplotlib's quiver does this.

Python Four classic vector fields

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Gradient fields

Any scalar function f(x, y) produces a vector field, its gradient:

Text
∇f = ⟨∂f/∂x, ∂f/∂y⟩

At each point ∇f points in the direction of steepest increase of f and is perpendicular to the level curve through that point. A field F that equals ∇f for some f is called a conservative field, and f is its potential function. (A later lesson studies these in detail.)

For f = x² + y², ∇f = ⟨2x, 2y⟩, which points away from the origin: uphill on a bowl.

Python A scalar function and its gradient field

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the red arrows cross the contour lines at right angles and point uphill.

Flow lines

A flow line (or integral curve) is a path r(t) = ⟨x(t), y(t)⟩ whose velocity at every moment equals the field there:

Text
r'(t) = F(r(t))

It is the path a small leaf would follow if F were the velocity of a stream. For F = ⟨-y, x⟩, the flow lines are circles about the origin: indeed x(t) = cos t, y(t) = sin t gives r'(t) = ⟨-sin t, cos t⟩ = ⟨-y, x⟩.

You can trace flow lines numerically with Euler's method: from a starting point, repeatedly take a small step in the direction of the field.

Text
p_{k+1} = p_k + h F(p_k)
Python Tracing flow lines with Euler's method

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Euler's method is only an approximation. For long times or fast-changing fields, smaller steps or better methods are needed.

Fields in three dimensions

In space, F = ⟨P, Q, R⟩ is harder to draw, but the same ideas apply:

  • Gravity from a point mass: F = -k r / |r|³, pointing toward the mass and weakening with distance squared.
  • The same shape with a plus sign describes the electric field of a positive point charge.
  • Fluid velocity in 3D: flow lines are the paths of tiny particles.

Because the field F = r/|r|³ is so important, keep an eye on it. It returns in the divergence theorem.

A vector field has a different value at each point, but a single vector has no "position" of its own. Draw arrows from their base points, and remember that the arrow lengths in a quiver plot are scaled for readability.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What does a vector field assign to each point?

    A vector field F(x, y) = ⟨P, Q⟩ gives a vector at every point, as opposed to a scalar field, which gives a number.
  2. 2. What does the field F = ⟨-y, x⟩ do?

    At (1, 0) it gives ⟨0, 1⟩ (up), at (0, 1) it gives ⟨-1, 0⟩ (left): a counterclockwise circulation.
  3. 3. The gradient of f at a point is:

    The gradient is normal to level curves and points in the direction of steepest increase.
  4. 4. A flow line r(t) of a field F satisfies:

    The velocity of the moving point equals the field vector at its current position.

Summary

  • A vector field attaches a vector ⟨P, Q⟩ (or ⟨P, Q, R⟩) to each point.
  • Arrow plots (quiver plots) show direction and relative size.
  • The gradient ∇f of a scalar function is a vector field perpendicular to level curves.
  • Flow lines satisfy r'(t) = F(r(t)); Euler's method traces them numerically.
  • Vector fields are the integrands for line and surface integrals.

Next: Line Integrals