04 Gradients and Optimization
A guided introduction to directional derivatives, gradients, tangent and normal geometry, unconstrained extrema, and Lagrange multipliers for constrained optimization.
Directional Change in a Chosen Direction
A scalar-valued function assigns a number to each point. Its partial derivatives describe change in coordinate directions, while a describes change along any chosen direction.
If is a , the of at is
For a differentiable function, compute it using
The direction must have length . If the problem gives a nonzero vector , normalize it first:
For example, let , evaluate the rate of change at , and use the direction of . The is , so . Since , the unit direction is . Therefore,
The function increases at a rate of units per unit distance in that direction.
Takeaway: Find the , normalize the given direction, and take their dot product.
The as a Rate and Direction
For a differentiable function of three variables,
For two variables, . The dot-product formula connects the to every :
Because has length , the Cauchy–Schwarz inequality gives
Thus:
The maximum rate of increase is , occurring in the direction of .
The maximum rate of decrease is , occurring in the direction of .
A zero occurs in directions perpendicular to .
If , the first-order information does not select a preferred direction. The point could still be a local maximum, local minimum, or saddle point, so further analysis is required.
Takeaway: The simultaneously encodes all first-order directional rates and identifies the direction of steepest ascent.
Level Sets, Normals, and Tangent Planes
A level curve of a function of two variables is defined by . If traces that curve, then . Differentiating gives
Therefore, the tangent vector is perpendicular to the . A tangent direction satisfies .
For a surface defined implicitly by , the at is a normal vector, provided . The tangent plane is
In coordinate form,
For a graph , write it as . A normal vector is , and the tangent-plane equation at is
This equation is also the first-order linear approximation to the function.
Takeaway: Tangent directions lie along a level set, while the supplies a perpendicular normal direction.
Finding and Classifying Unconstrained Extrema
To locate possible local extrema of a differentiable function of two variables, first solve . Also include interior points where a relevant partial derivative does not exist. These candidates are critical points.
For each , compute
The second-derivative test gives:
If and , the point is a local minimum.
If and , the point is a local maximum.
If , the point is a saddle point.
If , the test is inconclusive.
For a restricted domain, local analysis is not enough to find global extrema. Check interior critical points, boundary candidates, and corners when the boundary has corners. Then compare all objective values.
A zero alone does not prove that a point is an extremum. Classification requires the second-derivative test or another appropriate argument.
Takeaway: Critical points provide candidates; classification and boundary analysis determine which candidates are actual extrema.
One-Constraint Optimization with Lagrange Multipliers
A constrained optimization problem asks for the largest or smallest value of an objective function while one or more equations restrict the allowed points. With one constraint, the problem has the form
At a constrained extremum, movement is limited to tangent directions on the constraint surface. The derivative of the objective must be zero in every allowed tangent direction. Since is normal to the constraint surface, the objective must be parallel to it. This gives
Use the following procedure:
Identify the objective function and the constraint.
Compute and .
Solve together with .
Evaluate the objective at every candidate point.
Compare the values to identify the maximum and minimum.
For example, optimize subject to . With , the equations are
They imply . If , the product is ; if , the product is . Therefore,
at and , while
at and .
Takeaway: Lagrange equations locate constrained candidates, but evaluating and comparing the objective values is essential.
Multiple Constraints and Sensitivity
When two constraint equations restrict a function of three variables,
the allowed set is generally the intersection of two surfaces. A tangent direction is perpendicular to both constraint normals, so the objective must lie in their span:
Solve the complete system
The multipliers and are unknowns alongside the coordinates. After finding all candidates, evaluate the objective and compare the resulting values. As with one constraint, the usual method assumes suitable smoothness and that the relevant constraint gradients do not fail to provide the required normal directions.
A multiplier can also describe sensitivity. If the constrained optimum has value when the constraint level is , then under appropriate differentiability conditions,
Thus, a small increase in the constraint level changes the optimized value by approximately times that increase. This interpretation is called the of the constraint.
Takeaway: With multiple constraints, combine the constraint gradients and interpret multipliers as approximate marginal changes in the optimal value.
A Reliable Problem-Solving Checklist
Several checks prevent common errors in and optimization problems:
Normalize a direction before using it in a .
Include the constraint equation when solving Lagrange equations.
Find and evaluate every candidate rather than reporting the first one found.
Examine boundaries and corners when the domain is restricted.
Do not assume every Lagrange candidate is a maximum; compare objective values or use additional analysis.
Check the regularity condition, such as , when applying the standard one-constraint theorem.
Distinguish tangent vectors, which lie along a constraint, from constraint gradients, which are normal to it.
The central geometric connection is consistent throughout: gradients describe first-order change, gradients are normal to level sets, tangent directions are orthogonal to those normals, and constrained extrema occur when the objective is compatible with the available constraint normals.