Partial derivatives and the gradient

Find the steepest way up a surface.

So far, functions have had one input. A height on a map has two: how far east and how far north. On a hill, the slope depends on which way you're facing. So what does "the derivative" mean now?

The dots are height lines on a map of two hills. Drag the amber point around, then press Climb to follow the arrow all the way up.
  • Drag the point onto a hilltop. What happens to the arrow?
  • Put the point where the height lines are bunched together, then where they're far apart.
  • Check that the arrow always crosses the height lines square on.

Partial derivatives

A partial derivative is the slope in one direction, treating the other variable as a constant. There's nothing new to learn beyond the notation:

\[ \frac{\partial h}{\partial x} \text{ is the slope going east} \qquad\qquad \frac{\partial h}{\partial y} \text{ is the slope going north} \]

For \(f = x^2 y\): treat \(y\) as a number to get \(\frac{\partial f}{\partial x} = 2xy\), and treat \(x\) as a number to get \(\frac{\partial f}{\partial y} = x^2\).

The gradient

Put them together into a vector, and something remarkable happens: it points straight uphill, and its length is how steep that is.

\[ \nabla h = \left(\frac{\partial h}{\partial x},\; \frac{\partial h}{\partial y}\right) \]

Height doesn't change along a height line, so that direction has zero slope. The steepest direction is at right angles to it, which is why the arrow always crosses the lines square on.

Force is the downhill direction of potential energy: \(\mathbf{F} = -\nabla U\). A ball rolls down the steepest way, and a charge is pushed down the voltage hill. This is how you'll think about fields.

Problems

For \(h = x^2 + y^2\), find \(\nabla h\) at \((1, 2)\), and how steep it is there.

Answer

\(\nabla h = (2x, 2y) = (2, 4)\), with steepness \(\sqrt{20} \approx 4.47\).

For \(f = x^2 y\), find \(\nabla f\) at \((2, 3)\).

Answer

\((2xy, x^2) = (12, 4)\)

For \(f = \sin x \cos y\), find both partial derivatives.

Answer

\(\frac{\partial f}{\partial x} = \cos x\cos y\) and \(\frac{\partial f}{\partial y} = -\sin x\sin y\).

A 2D spring has energy \(U = \frac{1}{2}k(x^2 + y^2)\). What force does it give?

Answer

\(\mathbf{F} = -\nabla U = -k(x, y)\): straight back to the middle, and stronger the further out you go.

Learn more

An unhandled error has occurred. Reload ๐Ÿ—™