First- and second-order optimality
Turn derivatives into local certificates, and recognize the cases where a Hessian test leaves the question open.
On this page
The question for today
What you’ll understand
- Derive necessary conditions from directional Taylor expansions.
- Apply a positive-definite Hessian as a sufficient local certificate.
- Resolve a degenerate Hessian using higher-order terms or explicit directions.
A nonlinear optimizer can return a point with a tiny gradient while missing the behavior we actually care about. The point might be a minimum, a maximum, a saddle, or a nearly flat location that is far from any useful answer. Optimality conditions organize those possibilities. We begin with unconstrained, twice continuously differentiable functions on an open neighborhood of the candidate. Keeping that domain assumption visible prevents a common mistake: demanding a zero gradient at a constrained boundary where some directions are forbidden.
Why every direction matters
Fix a candidate and restrict the objective to a straight line through it. If the candidate is a local minimum in an open domain, the scalar restriction has a minimum at line parameter zero for every direction. Its first derivative must vanish. Since that derivative is the inner product of the gradient with the chosen direction, the gradient must be the zero vector. This argument establishes necessity; it does not reverse itself simply because solving the gradient equation was difficult.
When the gradient vanishes, the second-order Taylor term becomes the first available local signal. A direction of negative quadratic curvature produces a lower value for sufficiently small nonzero movements, so a local minimum must have a positive-semidefinite Hessian. Both signs of the line parameter are allowed in this unconstrained argument. At a feasible boundary, or on a curved constraint manifold, one must instead identify feasible tangent and critical directions before using an analogous curvature test.
A strict curvature gap is sufficient
If the gradient is zero and the Hessian is positive definite, its smallest eigenvalue is positive. Continuity and the Taylor remainder then make the positive quadratic term dominate all smaller-order errors in a sufficiently small neighborhood. The result is a strict local minimum with quadratic growth. This is a local statement: the same objective can contain a deeper well outside that neighborhood, and inspecting the Hessian only at the candidate cannot exclude it.
Positive semidefiniteness without a strict gap is inconclusive. The functions , , and all have zero first and second derivatives at zero, yet respectively give a strict minimum, a strict maximum, and neither. Higher-order terms matter precisely in directions where the quadratic model is flat. Conversely, a negative Hessian eigenvalue is a decisive rejection of local minimality, even when other directions have positive curvature.
Read numerical certificates honestly
In computation, gradients and eigenvalues are rarely exactly zero. Report the residual norm, the estimated smallest curvature, the norm convention, and the tolerances. A numerically positive eigenvalue smaller than the uncertainty of the derivative evaluation is weak evidence. Directional derivative checks and Hessian-vector products help investigate an implementation, but a few sampled directions cannot prove that a large matrix has no negative eigenvalue. Exact symbolic examples are useful training because they expose what each test can and cannot conclude.
Convexity supplies a separate global bridge: for a differentiable convex objective on a convex domain, a zero gradient gives a global minimizer. Nonlinear optimization usually lacks that bridge. In this module, a solver's convergence from a broad set of initial points will mean convergence toward an appropriate stationarity condition, when the algorithm's hypotheses hold. It will not silently mean that the best possible value over the whole domain has been located.
Work it through
A flat Hessian with a definite answer
Classify the origin for and . Explain why their Hessians alone cannot distinguish them.
Both gradients vanish at the origin. Both Hessians there equal , which is positive semidefinite but not positive definite. Thus both pass the same necessary second-order test, and neither satisfies the strict sufficient Hessian test.
For f, both terms are nonnegative and their sum is zero only when both coordinates vanish. Therefore every nonzero point, even outside a small neighborhood, has a larger value than the origin. The origin is a strict global minimum despite the flat quadratic y direction.
For h, points have value for every nonzero t, while points have positive value. Both types approach the origin, so it is a saddle and cannot be a local minimum.
The zero Hessian direction must be examined beyond quadratic order. A positive-semidefinite Hessian is necessary here but does not settle local minimality.
The living notebook
Explore the model
Interactive lab · function
Inspect the sign of one curvature
Pause, Reset, then set coefficient a=1 and position x=0. Predict the tangent slope and the bowl's orientation. Repeat from Reset with both a=−1 and x=0. Both slopes are zero, but the curvature reverses. This instrument shows only y=ax²; the quartic flat directions in the worked example require the written calculation.
- y at chosen x
- 0.608
- Tangent slope · 2ax
- 1.35
- Signed area · ax³/3
- 0.182
This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forZero slope is shared by maxima and minima; the sign of quadratic curvature adds information without resolving a zero-curvature direction.
Pause & reason
Check your understanding
Your turn
Try it yourself
Classify the origin for . Is the Hessian positive definite there?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Complete the square in the quadratic part before deciding what the quartic term does along its zero direction.
Compare with the solution
The expression is . It is nonnegative and vanishes only if y=0 and then x=0, so the origin is a strict global minimum. The Hessian is , with eigenvalues zero and eight. It is not positive definite. Along x=−y the quadratic part vanishes, but y⁴ still rises; this proves minimality by a direct argument rather than by the strict Hessian criterion.
Keep the idea
Take it with you
- Interior local minima have zero gradient and nonnegative curvature in every direction.
- A positive-definite Hessian at a stationary point gives a strict local certificate under C² regularity.
- Flat quadratic directions and global claims demand additional arguments.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.