Constrained Optimization when Calculus Doesn't Work
Christopher Makler
Stanford University Department of Economics
Econ 50: Lecture 7
Special case: a price of zero!
The story so far, in two graphs
If we superimpose the budget line on the utility "hill" the nature of the problem becomes clear:
Question: mathematically, how does the utility change as you spend more money on good 1?
Tangency condition: set MRS = price ratio
Constraint:
Two equations, two unknowns;
solve like you always have!
Question for Today
What happens when that doesn't work?
Let's think about times in univariate calculus when the maximum of a function doesn't occur where \(f'(x)=0\).
This is the nice case when the maximum is found when \(f'(x) = 0\). What do you notice about it?
Now suppose you wanted to maximize a similar function,
but on a constrained domain:
specifically, \(1 \le x \le 5\).
What's the maximum
of this function?
How could you program an algorithm to find it...?
What do you get for this function if you set the derivative equal to 0?
What's the maximum
of this function?
How could you program an algorithm to find it...?
What do you get for this function if you set the derivative equal to 0?
What's the maximum
of this function?
How could you program an algorithm to find it...?
In each of these cases, we can find a candidate maximum by following a simple rule:
move in the direction the function is increasing,
until either the function starts decreasing or you can't move any more.
We use the derivative to point us in the right direction;
but we then have to apply logic to find the maximum of the function.
Last Time: The MRS, the price ratio, and the “Gravitational Pull" towards Optimality
What does it mean if you get more "bang for your buck" from good 1 than good 2?
The consumer receives more utility per additional unit of good 1 than the price reflects, relative to good 2.
The consumer receives more
"bang for the buck"
(utils per dollar)
from good 1 than good 2.
Regardless of how you look at it, the consumer would be
better off moving to the right along the budget line --
i.e., consuming more of good 1 and less of good 2.
The consumer is more willing to give up good 2
to get good 1
than the market requires.
Indifference curve is
steeper than the budget line
Indifference curve is
flatter than the budget line
Moving to the right
along the budget line
would increase utility
Moving to the left
along the budget line
would increase utility
More willing to give up good 2
than the market requires
Less willing to give up good 2
than the market requires

The “Gravitational Pull" Towards Optimality
POINT A
POINT B
Corner Solutions
Interior Solution:
Corner Solution:
Optimal bundle contains
strictly positive quantities of both goods
Optimal bundle contains zero of one good
(spend all resources on the other)
If only consume good 1: \(MRS \ge {p_1 \over p_2}\) at optimum
If only consume good 2: \(MRS \le {p_1 \over p_2}\) at optimum
What's the relationship between the MRS and the price ratio in each of these two cases?
Where does the "gravitational pull" take us...?
Tangency condition: set MRS = price ratio
Constraint:
What bundle do we get if we set the MRS equal to the price ratio?
What bundle do we get if we set the MRS equal to the price ratio?
What does this mean you should do with your $100?!
What would Lagrange find...?

You: Lagrange, I'd like you to find me a maximum please.
Lagrange: Here you go.
You: but that has a negative quantity of good 2! That's impossible!
Lagrange:
Lagrange will only find you
the point along the mathematical description of the constraint where the slope of the constraint is equal to the slope of the level set of the objective function passing through that point.
It doesn't care about your petty insistence on positivity.
Quasilinear Utility Maximization
- Solve for the optimum using Lagrange (set MRS = price ratio)
- If the result is in the first quadrant, you're done.
- If it's not, go to the closest corner.
- Compare the MRS and the price ratio at each corner. What does the "gravitational pull" argument say?
With a quasilinear utility function (and some others), the Lagrange method will sometimes work, and sometimes you'll have a corner solution.
METHOD 1
METHOD 2
What is the MRS at the left corner
(where you spend all your money on good 2)?
What is the MRS at the right corner
(where you spend all your money on good 1)?
\(MRS > {p_1 \over p_2}\) along
the entire budget line!
What bundle do we get if we set the MRS equal to the price ratio?
Think about what this really means:
you like every unit of good 2 four times as much as every unit of good 1, but good 2 is only twice as expensive. What would you do?
\(MRS < {p_1 \over p_2}\) along
the entire budget line!
Perfect Substitutes
- The MRS and the price ratio are each constant.
- If the MRS is greater than the price ratio, only buy good 1.
- If the MRS is less than the price ratio, only buy good 2.
- If they're equal, buy anything you like;
all your options will give you the same utility.
What does it mean if you get more "bang for your buck" from good 1 than good 2?
The consumer receives more utility per additional unit of good 1 than the price reflects, relative to good 2.
The consumer receives more
"bang for the buck"
(utils per dollar)
from good 1 than good 2.
Regardless of how you look at it, the consumer would be
better off moving to the right along the budget line --
i.e., consuming more of good 1 and less of good 2.
The consumer is more willing to give up good 2
to get good 1
than the market requires.
Monotonicity and Convexity
Concave utility: Lagrange finds the minimum utility along the budget line!
You know you'll be at a corner solution;
need to compare the utility at each corner.
Non-monotonic utility: your optimal bundle may involve not spending all your money!
Check to see whether your "satiation point" is affordable, and if so, no more math is needed!
Conditions for Calculus to Work
(as long as the budget line is a simple straight line)
avoids a satiation point within the constraint
At the left corner of the constraint, \(MRS > p_1/p_2\)
avoids a corner solution when \(x_1 = 0\)
Monotonicity (more is better)
At the right corner of the constraint, \(MRS < p_1/p_2\)
avoids a corner solution when \(x_2 = 0\)
ensures FOCs find a maximum, not a minimum
Convexity (variety is better)
Kinked Budget Constraints
- Nonlinear electricity rates
- Gift cards
- Quantity discounts
- "Buying" lower prices
(more on these in the lecture 5 notes!)
How to Solve a Kinked Constraint Problem
- Evaluate the MRS at the kink
- Compare it to the price ratio on either side of the kink
- If \(MRS > {p_1 \over p_2}\) to the right of the kink, the solution is to the right of the kink; use the equation for that line and maximize.
- If \(MRS < {p_1 \over p_2}\) to the left of the kink, the solution is to the left of the kink; use the equation for that line and maximize.
- If the MRS is between the price ratios, then the solution is at the kink.
- Note: if the price ratio to the left of the kink is greater than the price ratio to the left, it's more complicated...you could have two potential solutions! Maximize subject to each of the constraints and compare utility at the respective maxima.
Next Unit: Demand
- Solve for the optimal bundle as a function of prices and income
- Demand functions
- Demand curves
- See how the optimal bundle changes as prices an income change
- Movement along demand curve due to a change in own price
- Shift of demand curve due to change in prices of other goods
- Shift of demand curve due to change in income
- Decompose price change into income and substitution effects
Econ 50 | Spring 25 | Lecture 7
By Chris Makler
Econ 50 | Spring 25 | Lecture 7
Constrained Optimization when Calculus Doesn't Work
- 287