Multivariable calculus
Gradient of x^2 + y^2: Vector, Steps, and Geometry
For f(x, y) = x^2 + y^2 the gradient is the vector with components 2x and 2y, written grad f = (2x, 2y). At the point (3, 4) it equals (6, 8), a vector of length 10 pointing directly away from the origin. That is the compass direction in which this paraboloid climbs fastest.
Differentiate once per variable, then stack the results
The gradient is not a new kind of derivative. It is the partial derivatives you already know, collected into one vector. Compute with frozen, then with frozen.
The term contributes nothing, because with held fixed it is just a number, and the derivative of a number is zero. Swapping roles gives the other component.
Now list them in variable order, first and second. That order is a convention, but it is the one every later formula assumes.
At this evaluates to , which has length .
The mistake: giving the gradient a third component
The graph of is a paraboloid sitting in three dimensions, so students often write the gradient as a three-component vector, something like , and try to make it point up the hillside in space.
The gradient of a function of two variables has exactly two components, one per input variable. It lives in the -plane, the floor plan, not on the surface. Read it as a set of walking directions: stand at on the floor and head in the direction , and the surface above you rises as fast as it possibly can.
- Number of components equals number of input variables, so two here.
- is a vector, never a scalar. Writing loses the direction.
- The vector is a normal to the surface , which is a different object with a different job.
What the vector says about this paraboloid
Notice that , so the gradient at any point is a positive multiple of the position vector. It points radially outward from the origin, and it gets longer the further out you go.
That matches the level curves. Setting gives , a circle of radius , and a radial vector is perpendicular to every circle centred at the origin. The gradient is always perpendicular to the level curve through the point.
The magnitude carries the steepness. Walking from in the unit direction gives the directional derivative
No other unit direction beats , which is exactly what it means for the gradient to point along steepest ascent.
Frequently asked questions
Where is the gradient of x^2 + y^2 the zero vector?
Only at the origin. Setting and forces and . That single critical point is the bottom of the bowl, the global minimum with .
Why does a surface in three dimensions have a two-component gradient?
Because takes two inputs. The gradient answers the question of which way to move in the input plane, and the input plane is two dimensional. The height is the output, not an input, so it gets no component of its own.