Multivariable calculus
Gradient of the Gaussian Bump e^(-x^2-y^2)
For f(x, y) = e^(-x^2-y^2) the gradient is (-2x e^(-x^2-y^2), -2y e^(-x^2-y^2)), which is -2f times the position vector (x, y). It always points straight back toward the origin, where the bump peaks at height 1, and its length 2r e^(-r^2) is largest on the circle of radius 1 over root 2.
Chain rule on the exponent
Let , so . The exponential is its own derivative, so each partial is times the matching partial of the exponent.
Notice that is just again, so the whole gradient can be written as . Since everywhere, the sign of the gradient is entirely decided by the minus two.
Every arrow points home
The vector points away from the origin, so points toward it. The gradient gives the direction of fastest increase, and on a bump centred at the origin the fastest way up is always straight toward the summit. The picture and the algebra agree.
With , the length of the gradient is a function of the radius alone.
That length is zero at the peak, grows outward, then collapses again. Setting its derivative to zero gives , where the slope is steepest at . That circle is the visible rim of the bump.
Sample it at , where the gradient must point along the negative axis.
The mistake: sign slips and a phantom product rule
Three wrong answers show up repeatedly, and each has a quick tell.
- , with the minus sign lost. This claims the fastest way up is away from the peak, which is backwards.
- , splitting the exponential. The exponent is a single sum, and keeps both factors in both components.
- Applying the product rule to and while computing the first partial. That is second-derivative work; the first partial has no product to differentiate yet.
Fastest audit: at the origin the gradient must be , because is the maximum. Every version above passes that. So test at instead, where the correct component is negative and the sign-slip version is positive.
Frequently asked questions
Where is steepest?
On the circle , that is radius . There the gradient has length . Inside that circle the surface is flattening toward the peak, and outside it is flattening toward zero.
Why is the gradient parallel to the position vector?
Because depends only on . Any radially symmetric function has circles as level curves, and the gradient must be perpendicular to those circles, which leaves only the radial direction available, up to sign.