At a constrained optimum of min f(x) subject to g(x) ≤ c, the Karush–Kuhn–Tucker conditions require stationarity of the Lagrangian, primal feasibility, dual feasibility, and complementary slackness. When the constraint is active, stationarity forces ∇f(x*) = λ∇g(x*) for some λ ≥ 0 — the objective's gradient and the constraint's gradient must be anti-parallel, not merely nearby.
The multiplier λ has a direct interpretation: it is the rate at which the optimal objective value would improve if the budget c were relaxed by one unit, df*/dc = −λ. This is why a plot of f(x*(c)) against c has slope exactly −λ — the sensitivity curve is not a coincidence but the definition of the shadow price.
Projected gradient descent alternates an unconstrained gradient step with a projection back onto the feasible set. For convex regions the projection is well defined and the iterates converge to the true KKT point; naively clipping only the final unconstrained answer ignores every gradient evaluated along the boundary and generally lands somewhere else entirely.
min f(x) s.t. g(x) ≤ c (and optionally a·x = b)
Stationarity: ∇f(x*) = λ∇g(x*), λ ≥ 0
Complementary slackness: λ·(g(x*) − c) = 0
Shadow price: d f(x*(c)) / dc = −λ