The Central Idea
Suppose
\[ z=f(x,y). \]The partial derivatives
\[ f_x \qquad\text{and}\qquad f_y \]give the local rates of change along the coordinate directions.
The gradient packages those coordinate rates into the vector
\[ \boxed{ \nabla f(x,y) = \langle f_x(x,y),f_y(x,y)\rangle }. \]The Gradient Symbol
The symbol
\[ \nabla \]is called nabla or del.
Thus
\[ \nabla f \]is read “the gradient of \(f\).”
Gradient in Two Variables
For
\[ f(x,y), \]the gradient is
\[ \boxed{ \nabla f = \left\langle \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right\rangle }. \]It is a vector-valued function built from a scalar-valued function.
Gradient in Three Variables
For
\[ f(x,y,z), \]the gradient is
\[ \boxed{ \nabla f = \left\langle f_x,f_y,f_z \right\rangle }. \]The idea extends naturally to even more input variables.
The Gradient Is a Vector Field
Because
\[ \nabla f(x,y) \]assigns a vector to each point in the domain, the gradient defines a vector field.
Each vector records local information about how the scalar function changes near its base point.
Example: Basic Gradient
Let
\[ f(x,y)=x^2+3xy+y^2. \]Then
\[ f_x=2x+3y \]and
\[ f_y=3x+2y. \]Therefore,
\[ \boxed{ \nabla f(x,y) = \langle2x+3y,\ 3x+2y\rangle }. \]Evaluating a Gradient at a Point
For
\[ f(x,y)=x^2+3xy+y^2, \]evaluate the gradient at \((1,2)\):
\[ \nabla f(1,2) = \langle2(1)+3(2),\ 3(1)+2(2)\rangle. \]Thus,
\[ \boxed{ \nabla f(1,2)=\langle8,7\rangle }. \]What the Components Mean
If
\[ \nabla f(a,b)=\langle A,B\rangle, \]then
\[ A=f_x(a,b) \]is the coordinate rate in the \(x\)-direction, and
\[ B=f_y(a,b) \]is the coordinate rate in the \(y\)-direction.
The gradient combines them into one geometric object.
Connection to Directional Derivatives
In the previous lesson, we found that for a differentiable function,
\[ D_{\mathbf{u}}f = f_xu_1+f_yu_2. \]Since
\[ \nabla f = \langle f_x,f_y\rangle, \]we can write
\[ \boxed{ D_{\mathbf{u}}f = \nabla f\cdot\mathbf{u} }. \]The Dot-Product Form
If \(\theta\) is the angle between \(\nabla f\) and the unit direction \(\mathbf{u}\), then
\[ \nabla f\cdot\mathbf{u} = \|\nabla f\|\|\mathbf{u}\|\cos\theta. \]Because \(\|\mathbf{u}\|=1\),
\[ \boxed{ D_{\mathbf{u}}f = \|\nabla f\|\cos\theta }. \]Why the Gradient Gives the Greatest Increase
Since
\[ -1\le\cos\theta\le1, \]the directional derivative is largest when
\[ \cos\theta=1. \]This occurs when
\[ \theta=0, \]meaning the direction of travel is the same as the direction of \(\nabla f\).
Direction of Steepest Ascent
If
\[ \nabla f(a,b)\neq\mathbf{0}, \]then the direction of greatest increase is
\[ \boxed{ \frac{\nabla f(a,b)} {\|\nabla f(a,b)\|} }. \]The gradient itself points in the steepest-ascent direction.
Maximum Directional Derivative
The largest possible directional derivative at a point is
\[ \boxed{ \|\nabla f(a,b)\| }. \]Thus the magnitude of the gradient gives the maximum instantaneous rate of increase per unit distance in input space.
Direction of Steepest Descent
The smallest directional derivative occurs when
\[ \cos\theta=-1. \]This means the direction of travel is opposite the gradient.
Therefore, the direction of steepest descent is
\[ \boxed{ -\frac{\nabla f(a,b)} {\|\nabla f(a,b)\|} }. \]Minimum Directional Derivative
The most negative directional derivative is
\[ \boxed{ -\|\nabla f(a,b)\| }. \]So the gradient magnitude controls both the steepest increase and the steepest decrease.
Example: Steepest Ascent
Let
\[ f(x,y)=x^2+4y^2. \]Then
\[ \nabla f = \langle2x,8y\rangle. \]At \((1,1)\),
\[ \nabla f(1,1)=\langle2,8\rangle. \]Therefore the direction of steepest ascent is
\[ \frac{\langle2,8\rangle}{\sqrt{2^2+8^2}} = \frac{\langle2,8\rangle}{\sqrt{68}}. \]Simplifying,
\[ \boxed{ \mathbf{u}_{\max} = \left\langle \frac{1}{\sqrt{17}}, \frac{4}{\sqrt{17}} \right\rangle }. \]Maximum Rate in the Previous Example
The gradient magnitude is
\[ \|\nabla f(1,1)\| = \sqrt{2^2+8^2} = \sqrt{68} = 2\sqrt{17}. \]Therefore,
\[ \boxed{ \max D_{\mathbf{u}}f(1,1) = 2\sqrt{17} }. \]Level Curves Revisited
A level curve is defined by
\[ f(x,y)=c. \]Along a level curve, the output remains constant.
Therefore, motion tangent to the level curve produces no first-order change in \(f\).
The Gradient Is Normal to Level Curves
If \(\mathbf{t}\) is a tangent direction to a smooth level curve, then
\[ D_{\mathbf{t}}f=0. \]But
\[ D_{\mathbf{t}}f = \nabla f\cdot\mathbf{t}. \]Hence,
\[ \nabla f\cdot\mathbf{t}=0. \]Therefore,
\[ \boxed{ \nabla f \perp \text{the level curve} }. \]Geometric Meaning of Orthogonality
If a contour map represents elevation, the contour itself traces points of equal height.
Walking along the contour produces zero first-order height change.
The gradient points directly across the contour in the locally steepest uphill direction.
Example: Circular Level Curves
Consider
\[ f(x,y)=x^2+y^2. \]Its level curves are
\[ x^2+y^2=c, \]which are circles.
The gradient is
\[ \nabla f=\langle2x,2y\rangle. \]This vector points radially outward, exactly perpendicular to each circle.
Example: Elliptical Level Curves
Let
\[ f(x,y)=4x^2+y^2. \]Its level curves satisfy
\[ 4x^2+y^2=c. \]The gradient is
\[ \boxed{ \nabla f=\langle8x,2y\rangle }. \]At every noncritical point, the gradient is normal to the corresponding ellipse.
Level Surfaces in Three Variables
For
\[ f(x,y,z)=c, \]the level set is typically a surface.
The gradient
\[ \boxed{ \nabla f = \langle f_x,f_y,f_z\rangle } \]is normal to that surface wherever the gradient is nonzero.
Example: Spherical Level Surfaces
Let
\[ f(x,y,z)=x^2+y^2+z^2. \]Then
\[ \nabla f = \langle2x,2y,2z\rangle. \]The level surfaces
\[ x^2+y^2+z^2=c \]are spheres, and the gradient points radially outward, normal to each sphere.
Gradient of a Linear Function
Consider
\[ f(x,y)=ax+by+c. \]Then
\[ \boxed{ \nabla f=\langle a,b\rangle }. \]The gradient is constant everywhere because the surface is a plane with constant slopes.
Gradient of a Constant Function
If
\[ f(x,y)=C, \]then
\[ f_x=0, \qquad f_y=0. \]Therefore,
\[ \boxed{ \nabla f=\mathbf{0} }. \]A constant function has no local first-order change in any direction.
Zero Gradient
If
\[ \nabla f(a,b)=\mathbf{0}, \]then all coordinate partial derivatives vanish at the point.
Consequently,
\[ D_{\mathbf{u}}f(a,b)=0 \]for every unit direction \(\mathbf{u}\), provided the usual differentiability conditions hold.
Critical Points
Points where
\[ \nabla f=\mathbf{0} \]are important candidates for local maxima, local minima, and saddle points.
A zero gradient does not by itself determine which kind of point occurs. Later optimization methods provide the classification tools.
Example: Finding Critical Points
Let
\[ f(x,y)=x^2+y^2-4x+6y. \]Then
\[ \nabla f = \langle2x-4,2y+6\rangle. \]Set the gradient equal to zero:
\[ 2x-4=0, \qquad 2y+6=0. \]Therefore,
\[ \boxed{ (x,y)=(2,-3) }. \]Gradient Magnitude
In two variables,
\[ \boxed{ \|\nabla f\| = \sqrt{f_x^2+f_y^2} }. \]In three variables,
\[ \boxed{ \|\nabla f\| = \sqrt{f_x^2+f_y^2+f_z^2} }. \]Gradient Magnitude as Sensitivity
A large value of
\[ \|\nabla f\| \]means the output can change rapidly in some direction near the point.
A small value means all directional rates are relatively limited.
A zero value means every first-order directional rate is zero.
Contour Spacing and Gradient Magnitude
On a contour map with equal changes in \(f\) between successive contours:
- closely spaced contours suggest a larger gradient magnitude;
- widely spaced contours suggest a smaller gradient magnitude.
The gradient points approximately across the contours in the direction of increasing contour values.
Example: Temperature Field
Suppose
\[ T(x,y) \]gives temperature across a region.
Then
\[ \nabla T(x,y) \]points in the direction of the fastest local temperature increase.
Its magnitude gives the maximum temperature increase per unit distance.
Example: Terrain Elevation
If
\[ h(x,y) \]is elevation, then
\[ \nabla h \]points directly uphill in the steepest local direction.
The vector
\[ -\nabla h \]points directly downhill.
Example: Cost Function
Suppose
\[ C(x,y) \]is a cost function.
Then
\[ \nabla C = \langle C_x,C_y\rangle \]summarizes first-order cost sensitivity to both inputs.
The negative gradient points in the local direction of fastest cost reduction.
Gradient Descent
The observation that
\[ -\nabla f \]points toward steepest local decrease motivates gradient descent.
A basic iteration has the form
\[ \boxed{ \mathbf{x}_{k+1} = \mathbf{x}_k - \alpha_k\nabla f(\mathbf{x}_k) }. \]The step size \(\alpha_k>0\) controls how far the method moves at each iteration.
Gradient Ascent
To increase a function instead of decrease it, move in the gradient direction:
\[ \boxed{ \mathbf{x}_{k+1} = \mathbf{x}_k + \alpha_k\nabla f(\mathbf{x}_k) }. \]This is the corresponding idea of gradient ascent.
The Gradient and Local Linear Approximation
Near \((a,b)\), a differentiable function satisfies
\[ f(a+\Delta x,b+\Delta y) \approx f(a,b) + f_x(a,b)\Delta x + f_y(a,b)\Delta y. \]In vector form,
\[ \boxed{ \Delta f \approx \nabla f(a,b) \cdot \langle\Delta x,\Delta y\rangle }. \]This is the bridge to tangent planes and linear approximation.
Gradient and the Differential
The total differential is
\[ df=f_x\,dx+f_y\,dy. \]Using the gradient,
\[ \boxed{ df = \nabla f\cdot \langle dx,dy\rangle }. \]The gradient therefore acts as the coefficient vector of the local linear change.
Example: Linear Change Estimate
Let
\[ f(x,y)=x^2+xy. \]Then
\[ \nabla f = \langle2x+y,x\rangle. \]At \((2,1)\),
\[ \nabla f(2,1) = \langle5,2\rangle. \]For a small change
\[ \langle\Delta x,\Delta y\rangle = \langle0.01,-0.02\rangle, \]the estimated output change is
\[ \Delta f \approx 5(0.01)+2(-0.02)=0.01. \]Gradient and Normal Vectors
For a level curve
\[ f(x,y)=c, \]the gradient provides a normal vector.
For a level surface
\[ f(x,y,z)=c, \]the gradient likewise provides a normal vector to the surface.
This fact will be used directly in tangent-plane equations.
Example: Normal to a Level Curve
Consider the level curve
\[ x^2+2y^2=6. \]Define
\[ F(x,y)=x^2+2y^2. \]Then
\[ \nabla F = \langle2x,4y\rangle. \]At \((2,1)\),
\[ \boxed{ \nabla F(2,1)=\langle4,4\rangle }. \]This vector is normal to the curve at that point.
Example: Tangent Direction from the Gradient
If
\[ \nabla F(2,1)=\langle4,4\rangle, \]then a tangent vector
\[ \mathbf{t}=\langle a,b\rangle \]must satisfy
\[ \langle4,4\rangle\cdot\langle a,b\rangle=0. \]One choice is
\[ \boxed{ \mathbf{t}=\langle1,-1\rangle }. \]Gradient of a Composite Expression
Consider
\[ f(x,y)=e^{x^2+y^2}. \]By the chain rule,
\[ f_x=2xe^{x^2+y^2} \]and
\[ f_y=2ye^{x^2+y^2}. \]Therefore,
\[ \boxed{ \nabla f = e^{x^2+y^2}\langle2x,2y\rangle }. \]Gradient with Logarithms
Let
\[ f(x,y)=\ln(x^2+y^2). \]Then
\[ \boxed{ \nabla f = \left\langle \frac{2x}{x^2+y^2}, \frac{2y}{x^2+y^2} \right\rangle } \]wherever \(x^2+y^2>0\).
Gradient with Trigonometric Functions
Consider
\[ f(x,y)=\sin(xy)+\cos x. \]Then
\[ f_x=y\cos(xy)-\sin x \]and
\[ f_y=x\cos(xy). \]Therefore,
\[ \boxed{ \nabla f = \langle y\cos(xy)-\sin x,\, x\cos(xy) \rangle }. \]Units of the Gradient
Each gradient component inherits the units of a partial derivative.
If \(f\) is measured in dollars and both input coordinates are measured in meters, then
\[ \nabla f \]has components measured in dollars per meter.
When the input variables have different units, each component retains its own corresponding output-per-input unit.
Gradient Components Can Have Different Units
Suppose
\[ C(q,t) \]is cost in dollars, where \(q\) is units produced and \(t\) is hours.
Then
\[ C_q \]has units dollars per unit produced, while
\[ C_t \]has units dollars per hour.
This matters when interpreting gradient magnitude or geometric direction: coordinate scaling and units must be handled thoughtfully.
Common Error: Forgetting That the Gradient Is a Vector
The gradient is not
\[ f_x+f_y. \]It is the ordered vector
\[ \boxed{ \nabla f=\langle f_x,f_y\rangle }. \]The distinction preserves directional information.
Common Error: Evaluating Before Differentiating
A reliable workflow is to first compute
\[ \nabla f(x,y), \]then substitute the requested point.
Substituting too early can erase variables needed for differentiation.
Common Error: Confusing the Gradient with a Unit Direction
The gradient
\[ \nabla f \]generally does not have length \(1\).
Its direction gives steepest ascent, while its magnitude gives the maximum rate.
The corresponding unit direction is
\[ \frac{\nabla f}{\|\nabla f\|}. \]Common Error: Saying the Gradient Is Tangent to a Level Curve
At a regular point where
\[ \nabla f\neq\mathbf{0}, \]the gradient is normal, not tangent, to the level curve.
Common Error: Assuming Zero Gradient Guarantees an Extremum
A zero gradient identifies a critical point, but the point may be:
- a local maximum;
- a local minimum;
- a saddle point;
- or another degenerate critical configuration.
Additional analysis is required.
Common Error: Ignoring the Domain
The gradient is meaningful only where the relevant partial derivatives exist.
For example,
\[ f(x,y)=\ln(x^2+y^2) \]is not defined at \((0,0)\), so no gradient exists there.
A Reliable Procedure for Computing a Gradient
- Write the scalar function clearly.
- Compute the partial derivative with respect to each input variable.
- Place those partial derivatives in coordinate order.
- Write the resulting vector as \(\nabla f\).
- Evaluate at the requested point if needed.
- Check the domain and differentiability assumptions.
A Reliable Procedure for Steepest Ascent
- Compute \(\nabla f\).
- Evaluate it at the point.
- If the gradient is nonzero, normalize it.
- The normalized gradient gives the direction of steepest ascent.
- The gradient magnitude gives the maximum directional derivative.
A Reliable Procedure for Steepest Descent
- Compute and evaluate \(\nabla f\).
- Reverse its direction.
- Normalize if a unit direction is requested.
- The minimum directional derivative is \(-\|\nabla f\|\).
Example: Full Gradient Workflow
Let
\[ f(x,y)=x^2y+3xy^2. \]First compute
\[ f_x=2xy+3y^2, \] \[ f_y=x^2+6xy. \]Therefore,
\[ \boxed{ \nabla f = \langle2xy+3y^2,\ x^2+6xy\rangle }. \]Evaluate the Full Workflow
At \((1,2)\),
\[ \nabla f(1,2) = \langle 2(1)(2)+3(2^2),\, 1^2+6(1)(2) \rangle. \]Thus,
\[ \boxed{ \nabla f(1,2) = \langle16,13\rangle }. \]Steepest Ascent in the Full Workflow
The gradient magnitude is
\[ \|\nabla f(1,2)\| = \sqrt{16^2+13^2} = \sqrt{425} = 5\sqrt{17}. \]Therefore the unit steepest-ascent direction is
\[ \boxed{ \mathbf{u}_{\max} = \frac{1}{5\sqrt{17}} \langle16,13\rangle }. \]The maximum directional derivative is
\[ \boxed{ 5\sqrt{17} }. \]Practice 1: Basic Gradient
Find \(\nabla f\) for
\[ f(x,y)=x^2+5xy-2y^2. \]Practice 2: Evaluate a Gradient
For
\[ f(x,y)=x^3+y^3-3xy, \]find
\[ \nabla f(1,2). \]Practice 3: Gradient Magnitude
If
\[ \nabla f(a,b)=\langle6,8\rangle, \]find
\[ \|\nabla f(a,b)\|. \]Practice 4: Steepest Ascent
Let
\[ f(x,y)=x^2+y^2. \]Find the unit direction of steepest ascent at \((3,4)\).
Practice 5: Maximum Rate
For the function
\[ f(x,y)=x^2+y^2, \]find the maximum directional derivative at \((3,4)\).
Practice 6: Steepest Descent
Let
\[ f(x,y)=x^2+4y^2. \]Find the unit direction of steepest descent at \((1,1)\).
Practice 7: Level-Curve Normal
Find a normal vector to the level curve
\[ x^2+3y^2=7 \]at the point \((2,1)\).
Practice 8: Three Variables
Find the gradient of
\[ f(x,y,z)=x^2y+yz^2+3xz. \]Practice 9: Interpretation
Suppose \(T(x,y)\) measures temperature and
\[ \nabla T(a,b)=\langle3,4\rangle. \]State the maximum local rate of temperature increase and the corresponding unit direction.
Practice 10: Identify the Error
A student computes
\[ f_x=2x+y, \qquad f_y=x+2y \]and writes
\[ \nabla f=3x+3y. \]Explain the error and give the correct gradient.
Practice Answers
Practice 1
We have
\[ f_x=2x+5y \]and
\[ f_y=5x-4y. \]Therefore,
\[ \boxed{ \nabla f = \langle2x+5y,\ 5x-4y\rangle }. \]Practice 2
First,
\[ \nabla f = \langle3x^2-3y,\ 3y^2-3x\rangle. \]At \((1,2)\),
\[ \boxed{ \nabla f(1,2) = \langle-3,9\rangle }. \]Practice 3
\[ \|\nabla f(a,b)\| = \sqrt{6^2+8^2} = 10. \]Therefore,
\[ \boxed{10}. \]Practice 4
For
\[ f=x^2+y^2, \]we have
\[ \nabla f=\langle2x,2y\rangle. \]At \((3,4)\),
\[ \nabla f=\langle6,8\rangle. \]Its magnitude is \(10\), so
\[ \boxed{ \mathbf{u}_{\max} = \left\langle \frac35,\frac45 \right\rangle }. \]Practice 5
The maximum directional derivative is the gradient magnitude:
\[ \boxed{10}. \]Practice 6
We have
\[ \nabla f=\langle2x,8y\rangle. \]At \((1,1)\),
\[ \nabla f=\langle2,8\rangle. \]The steepest-descent direction is opposite this vector:
\[ \boxed{ \mathbf{u}_{\min} = \left\langle -\frac{1}{\sqrt{17}}, -\frac{4}{\sqrt{17}} \right\rangle }. \]Practice 7
Define
\[ F(x,y)=x^2+3y^2. \]Then
\[ \nabla F=\langle2x,6y\rangle. \]At \((2,1)\),
\[ \boxed{ \nabla F(2,1)=\langle4,6\rangle }. \]Any nonzero scalar multiple of this vector is also normal.
Practice 8
The partial derivatives are
\[ f_x=2xy+3z, \] \[ f_y=x^2+z^2, \] \[ f_z=2yz+3x. \]Therefore,
\[ \boxed{ \nabla f = \langle 2xy+3z,\, x^2+z^2,\, 2yz+3x \rangle }. \]Practice 9
The maximum local rate is
\[ \|\nabla T\| = \sqrt{3^2+4^2} = 5. \]The corresponding unit direction is
\[ \boxed{ \left\langle \frac35,\frac45 \right\rangle }. \]Practice 10
The gradient is a vector, not the sum of the two partial derivatives.
Therefore,
\[ \boxed{ \nabla f = \langle2x+y,\ x+2y\rangle }. \]What to Remember
The gradient is the central vector of local scalar change.
- For \(f(x,y)\), \(\nabla f=\langle f_x,f_y\rangle\).
- For \(f(x,y,z)\), \(\nabla f=\langle f_x,f_y,f_z\rangle\).
- Directional derivatives satisfy \(D_{\mathbf{u}}f=\nabla f\cdot\mathbf{u}\).
- The gradient points in the direction of greatest increase.
- The negative gradient points in the direction of greatest decrease.
- The gradient magnitude is the maximum directional derivative.
- The gradient is normal to smooth level curves and level surfaces.
- A zero gradient identifies an important critical point but does not by itself classify it.
The core geometric relationship is
\[ \boxed{ \text{gradient} = \text{steepest-ascent direction} + \text{maximum local rate information} }. \]Where We Go Next
The gradient organizes the local rates of change and provides a normal direction to level sets. Those same first derivatives also determine the best local linear model of a multivariable function.
The next lesson, Tangent Planes and Linear Approximation, uses the gradient and partial derivatives to construct tangent planes, estimate nearby function values, and formalize the first-order geometry of differentiable multivariable functions.