Maximization With Constraint: The Art of Doing Your Best With Limits
Imagine you are a student with ₹100 to spend on lunch. You love pizza (₹20 a slice) and you love juice (₹10 a glass). You want the most satisfying meal — the maximum "happiness" — but you cannot spend more than ₹100. That is a constrained maximization problem.
Without the ₹100 limit, you would eat infinite pizza and drink infinite juice. But reality imposes a boundary. The question becomes: given your limited budget, which combination of pizza and juice gives you the greatest possible satisfaction?
This is the core of every constrained maximization problem: you have something you want to maximize (happiness, profit, area, speed) and a restriction that limits your choices (money, materials, time, a physical law). The trick is to find the best possible outcome within that restriction, not the best possible outcome in an imaginary world with no limits.
The Precise Statement
A constrained maximization problem has three parts:
-
The Objective Function — the thing you want to maximize. Call it f(x,y). In our example, f is your "satisfaction" from x slices of pizza and y glasses of juice.
-
The Constraint — the rule that limits your choices. Usually written as g(x,y)=c (or ≤c). Here: 20x+10y=100 (you must spend exactly ₹100).
-
The Decision Variables — the things you control. Here: x (pizza slices) and y (glasses of juice).
The problem is:
Maximize f(x,y)subject to g(x,y)=c
You are searching over all pairs (x,y) that satisfy the constraint, and picking the one that makes f largest.
The constraint reduces the set of possible choices. Without it, you would just find where f is biggest everywhere. With it, you must stay on the curve (or inside the region) defined by g(x,y)=c.
The Key Insight: Tangency
Here is the conceptual leap. Imagine you draw a map of your satisfaction — contour lines where f is constant (like elevation lines on a hiking map). Each contour is a curve: "all combinations of pizza and juice that give 10 units of happiness," then 11, then 12, and so on.
Now draw the budget line: 20x+10y=100, a straight line.
You want the highest possible contour that still touches the budget line. That happens where the budget line is tangent to a contour — just barely kissing it. If the budget line cuts through a contour, you can slide along it to a higher contour. The optimum is the point where you cannot improve without leaving the budget.
Tangency means the slope of the contour (the marginal rate of substitution in economics) equals the slope of the budget line (the price ratio). In general, it means the gradient of f is parallel to the gradient of g: ∇f=λ∇g, where λ is the Lagrange multiplier.
The Method: Lagrange Multipliers
The tangency condition leads to a systematic method. To maximize f(x,y) subject to g(x,y)=c:
- Form the Lagrangian:
L(x,y,λ)=f(x,y)−λ(g(x,y)−c)
- Set all partial derivatives to zero:
∂x∂L=0,∂y∂L=0,∂λ∂L=0
- Solve the system. The third equation just gives back g(x,y)=c. The first two enforce ∇f=λ∇g. …