Review / Chapter 2 — Vector Calculus

The Gradient

Chapter 2 — Vector Calculus

The gradient is the multivariable cousin of the ordinary derivative. Given a scalar field \(f(x,y,z)\), the gradient packages its three partial derivatives into a single vector field that tells you, at every point, the direction and rate of steepest increase of \(f\).

Definition (Cartesian)

In Cartesian coordinates,

\[\vec{\nabla} f = \left(\frac{\partial f}{\partial x},\ \frac{\partial f}{\partial y},\ \frac{\partial f}{\partial z}\right).\]

You can think of \(\vec{\nabla}\) ("del" or "nabla") as a vector-valued differential operator \(\vec{\nabla} = \left(\partial_x,\partial_y,\partial_z\right)\). The gradient is what happens when you apply it to a scalar.

Geometric meaning

Two key facts about \(\vec{\nabla} f\) at a point \(P\):

  1. Direction: \(\vec{\nabla} f\) points in the direction of steepest ascent of \(f\) at \(P\).
  2. Magnitude: \(|\vec{\nabla} f|\) equals the slope of \(f\) in that steepest direction.

Equivalently, the directional derivative of \(f\) along a unit vector \(\hat{u}\) is \(\hat{u}\cdot\vec{\nabla} f\). That's maximized when \(\hat{u}\) points along \(\vec{\nabla} f\), and is zero when \(\hat{u}\) is tangent to a level set of \(f\).

A scalar field shown as level curves, with gradient arrows pointing perpendicular to the level curves in the direction of steepest ascent.
Gradient arrows point perpendicular to level curves of \(f\), toward higher values. Longer arrows mean steeper slope.

The electrostatics connection

The electric field is minus the gradient of the potential:

\[\vec{E} = -\vec{\nabla} V.\]

The minus sign is because positive charges experience a force that pushes them downhill in potential, toward lower \(V\). If you know \(V(x,y,z)\), you can read off \(\vec{E}\) by taking three partial derivatives — no integration required.

The gradient theorem

For any smooth scalar field \(f\) and any curve \(C\) from \(P_1\) to \(P_2\),

\[\int_C \vec{\nabla} f \cdot d\vec{r} = f(P_2) - f(P_1).\]

This is the multivariable fundamental theorem of calculus: the line integral of a gradient depends only on the endpoints. Applied to \(\vec{E} = -\vec{\nabla} V\), it reproduces \(\int_{P_1}^{P_2}\vec{E}\cdot d\vec{r} = V(P_1) - V(P_2) = -\Delta V\).

Worked example

Suppose \(V(x,y) = -c\,xy\). Then

\[\vec{\nabla} V = (-cy,\ -cx,\ 0),\qquad \vec{E} = -\vec{\nabla} V = (cy,\ cx,\ 0).\]

That's exactly the field from the lecture-notes example: \(\vec{E}=(cy,cx,0)\). The gradient recovers \(\vec{E}\) from \(V\) in one step.

Practice Problems

Problem 1easy
Compute \(\vec{\nabla} f\) for \(f(x,y,z) = x^2 y + z^3\).
Hint
Take partials with respect to each variable in turn.
Solution

\(\partial_x f = 2xy\), \(\partial_y f = x^2\), \(\partial_z f = 3z^2\).

Answer: \(\vec{\nabla} f = (2xy,\ x^2,\ 3z^2)\).

Problem 2easy
A potential is \(V(x,y,z) = V_0 - E_0 z\) with constants \(V_0,E_0 > 0\). Find \(\vec{E}\).
Hint
\(\vec{E} = -\vec{\nabla} V\).
Solution

Only the \(z\)-partial is nonzero: \(\partial_z V = -E_0\), so \(\vec{\nabla} V = (0,0,-E_0)\).

Answer: \(\vec{E} = (0,0,E_0)\) — a uniform field pointing in the \(+\hat{z}\) direction.

Problem 3medium
For a point charge \(q\) at the origin, \(V(r) = \frac{1}{4\pi\epsilon_0}\frac{q}{r}\). Use the gradient to recover \(\vec{E}\).
Hint
In spherical coordinates for a radial \(V(r)\), \(\vec{\nabla} V = \frac{dV}{dr}\,\hat{r}\). Or compute \(\partial_x(1/r)\) with \(r=\sqrt{x^2+y^2+z^2}\).
Solution

\(\frac{dV}{dr} = -\frac{1}{4\pi\epsilon_0}\frac{q}{r^2}\), so \(\vec{\nabla} V = -\frac{1}{4\pi\epsilon_0}\frac{q}{r^2}\hat{r}\).

Answer: \(\vec{E} = -\vec{\nabla} V = \frac{1}{4\pi\epsilon_0}\frac{q}{r^2}\hat{r}\), the Coulomb field.

Problem 4medium
At a point \(P\), \(\vec{\nabla} f = (3,0,4)\). What is the directional derivative of \(f\) at \(P\) along \(\hat{u} = (1/\sqrt{2})(1,1,0)\)? In which direction does \(f\) increase fastest, and how fast?
Hint
Directional derivative is \(\hat{u}\cdot\vec{\nabla} f\); steepest direction is \(\vec{\nabla} f / |\vec{\nabla} f|\).
Solution

\(\hat{u}\cdot\vec{\nabla} f = (1/\sqrt{2})(3+0) = 3/\sqrt{2}\). \(|\vec{\nabla} f| = \sqrt{9+16}=5\), direction \((3/5,0,4/5)\).

Answer: directional derivative \(3/\sqrt{2}\); steepest rate \(5\) along \((3,0,4)/5\).

Problem 5hard
Show that \(\vec{\nabla}(fg) = f\,\vec{\nabla} g + g\,\vec{\nabla} f\) for scalar fields \(f,g\).
Hint
Apply the ordinary product rule component-by-component.
Solution

For each coordinate \(x_i\), \(\partial_i(fg) = f\,\partial_i g + g\,\partial_i f\). Stacking the three components gives exactly \(f\vec{\nabla} g + g\vec{\nabla} f\).

Answer: follows from applying the scalar product rule to each partial derivative.