JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Hamilton-Jacobi and Viscosity Solutions

One fully nonlinear first-order equation, u_t + H(x, grad u) = 0, quietly ties together mechanics, optics, and optimal control. Its smooth solutions crease and die, yet a clever way of testing non-smooth candidates against gentle functions revives exactly one physical answer.

One equation behind mechanics, optics, and control

We close this rung with the equation that, more than any other, deserves the word grand. The Hamilton-Jacobi equation is the first-order PDE u_t + H(x, grad u) = 0, where the unknown u(x,t) is a single scalar and H — the Hamiltonian — is a given function of position and of the gradient grad u. It is a fully nonlinear equation: the gradient enters through the arbitrary function H, not just multiplied by smooth coefficients, so none of the linear machinery of the earlier rungs — superposition, Fourier modes, Green's functions — applies. A typical example is u_t + (1/2)|grad u|^2 = 0, where H(p) = (1/2)|p|^2.

Why does this one equation keep reappearing? In mechanics, Hamilton and Jacobi discovered that solving u_t + H(x, grad u) = 0 is equivalent to integrating the motion of a particle — u is the action, and its level sets advance along trajectories. In optics, the same equation with H = |grad u| (the eikonal equation, a stationary cousin) governs how a wavefront propagates and where light rays go. In optimal control, u is the minimum cost-to-go, and the equation becomes the dynamic-programming relation we meet at the end. Three subjects, one master equation.

Characteristics are rays — and rays cross

How do you actually solve a Hamilton-Jacobi equation? With the method of characteristics from early in this ladder — but with a beautiful twist. For a fully nonlinear first-order PDE the characteristics are not curves carrying a single value; they are strips carrying both the position x and the gradient p = grad u, and they evolve by Hamilton's equations dx/dt = H_p, dp/dt = -H_x. These are exactly the rays of optics and the trajectories of mechanics. You launch one ray from each starting point, march the ODEs, and build u by integrating along the ray. Solving the PDE is running mechanics.

But here is the catch this whole rung has been preparing you for. Rays bend, and bent rays cross. Where two rays carrying different gradients arrive at the same point, the gradient grad u tries to take two values at once — and a single-valued smooth u cannot exist there. Exactly as a smooth solution of a scalar conservation law steepens and forms a shock, a smooth solution of Hamilton-Jacobi develops a crease: a curve where u stays continuous but its slope jumps. (This is not a coincidence — in one space dimension, differentiating u_t + H(u_x) = 0 in x and setting w = u_x gives the conservation law w_t + H(w)_x = 0, so HJ creases are the integrated form of conservation-law shocks.) Past that moment, no classical solution exists.

A formula that lives through the crease: Hopf-Lax

Before inventing a whole new notion of solution, it pays to see one concrete escape hatch. For a convex Hamiltonian H(p) depending only on the gradient, with initial data u(x,0) = g(x), there is an explicit answer — the Hopf-Lax / Lax-Oleinik formula — that stays valid for all time, kinks and all. It says: to find u at a point, look back at every place you could have started from, charge a travel cost given by the Lagrangian (the convex dual of H), add the initial value g there, and take the cheapest combination.

Hamilton-Jacobi:   u_t + H(grad u) = 0,    u(x,0) = g(x)

Hopf-Lax formula (H convex, L = its dual):

   u(x,t) = min over y of  [ g(y) + t * L( (x - y)/t ) ]

  reading: cheapest start y + cost of travelling from y to x in time t
  the 'min' is what allows a crease where two minimizers tie
  example  H(p) = (1/2)p^2   =>   L(v) = (1/2)v^2  (free particle)
The Hopf-Lax formula: a minimum over starting points. The kink appears precisely where two different y achieve the same minimum — the solution stays continuous, its slope does not.

Stare at that `min` and the mystery dissolves. Where a single starting point y is cheapest, u is smooth and matches the classical ray solution. Where two different y tie for cheapest, the formula still returns one definite number for u, but the slope flips between them — that is the crease, produced automatically. The minimum is single-valued even where the ray picture is double-valued, so the Hopf-Lax formula quietly selects one solution through the singularity. The remaining job is to say, abstractly, which solution it selected — so the same selection works when no explicit formula is available.

The viscosity solution: testing with gentle functions

Here is the idea that earned a Fields Medal's worth of attention. We cannot plug a creased u into u_t + H(x, grad u) = 0, because at the crease grad u does not exist. So we never differentiate u directly. Instead, take any smooth test function phi that touches u at a point — say from above, with phi >= u nearby and phi = u at that point — and impose the equation on phi there. The trick: at a point where a smooth phi sits above u and touches it, all of u's would-be derivatives are pinned between those of the touching functions, so we can demand an inequality on phi and never on u.

Concretely, u is a viscosity solution if it is both a subsolution and a supersolution. Subsolution: whenever a smooth phi touches u from above (phi >= u, equal at x0), we require phi_t + H(x0, grad phi) <= 0 there. Supersolution: whenever a smooth phi touches from below (phi <= u, equal at x0), we require phi_t + H(x0, grad phi) >= 0. Where u happens to be smooth, you can use phi = u from both sides and the two inequalities collapse to the original equation — so a viscosity solution that is smooth is just a classical solution. At a crease the two one-sided tests do real work, and only the physically correct shape passes both.

Why it is the right notion, and what it costs

The payoff is exactly what a beginner should demand: a well-posed problem. Under mild conditions, a Hamilton-Jacobi equation with given initial data has one and only one viscosity solution, it depends continuously on the data, and — when there is an explicit formula — it agrees with Hopf-Lax. Weak solutions of nonlinear equations are usually a crowd; the genius of the viscosity definition is that the two one-sided tests are sharp enough to single out a unique member, the one a vanishing diffusion would have produced. That is why this notion, not bare weak differentiation, is the standard one for HJ.

Be honest about the costs and the fine print. First, the viscosity solution is generally only Lipschitz continuous, not differentiable — kinks are permanent features, not artefacts to be smoothed away, and any numerical scheme must capture them rather than blur them. Second, the sub/supersolution sign convention is glued to how you wrote the equation: flip the sign of H, or write H(x, grad u) - u_t = 0 instead, and the inequalities must flip too, or you will select the wrong solution. Third, the clean uniqueness theory above is sharpest for first-order HJ and for proper (monotone) second-order equations; for general second-order fully nonlinear PDEs the theory exists but is more delicate. The definition is a precision instrument — powerful, and easy to mis-aim.

Optimal control: where the equation comes from

To feel why all this matters, watch a Hamilton-Jacobi equation arise from a decision problem. Imagine steering a system — a rocket, a portfolio, a robot — to minimize a total cost, and let u(x,t) be the value function: the least cost achievable starting from state x with time t left. The principle of dynamic programming says something almost obvious: the best plan over a long horizon must begin with the best tiny first step, after which you face the same problem with slightly less time. Writing that self-consistency over an instant dt and letting dt -> 0 turns it into a PDE for u.

That PDE is the Hamilton-Jacobi-Bellman equation — a Hamilton-Jacobi equation whose Hamiltonian is itself a minimization over the controls you may choose, H(x, p) = min over controls a of [ running-cost(x,a) + p . dynamics(x,a) ]. The value function is almost never smooth — bargains tie, the optimal action switches abruptly across surfaces, creases form — so a classical solution would not even exist. The viscosity-solution framework is exactly what makes the value function the unique solution of the HJB equation, and reading off the minimizing control at each point recovers the optimal feedback strategy. This is why engineers, economists, and reinforcement-learning theorists all end up at the same fully nonlinear PDE.