EconGraphs Logo BETA
Note: This work is under development and has not yet been professionally edited.
If you catch a typo or error, or just have a suggestion, please submit a note here. Thanks!
course home page

Lecture 6: Utility Maximization Subject to a Budget Constraint


Click here for the quiz on this reading.

If there is one thing people expect you to learn in Econ 50, it’s the mathematical technique of constrained optimization using the method of Lagrange multipliers. This is the moment we’ve been building up to for the past two weeks, and it’s probably the most widely used optimization technique in all of economics. And it’s the way we go about solving the central problem of how a consumer maximizes their utility subject to a budget constraint.

In its most general sense, a constrained optimization problem has three elements:

With this general framework, we can say that $X^\star$ is an optimal choice if:

In the context of consumer choice, this has a good intuitive interpretation: a bundle $X^\star$ is optimal if:

A bit more informally, we can say that if $X^\star$ is an optimal choice, then any other choice which is better isn’t affordable, and any other choice which is affordable isn’t better.

To get a feel for this, try playing with the following diagram. The diagram shows a budget set, and as you drag the bundle $X$ around the choice space, it shows the set of bundles preferred to $X$. As you drag $X$ around, the graph will indicate if the point is affordable, and whether there is any overlap between the purple “preferred” region and the green budget set. Try to find the optimal point by dragging the bundle until both the green check marks light up!

See interactive graph online here.

You’ll notice that at the optimal bundle, the indifference curve is tangent to the budget line: that is, at the optimal choice, the consumer’s marginal rate of substitution (MRS), which is the slope of their indifference curve, is equal to the price ratio, which is the slope of their budget line.

In this lecture we’ll first develop an intuition for what this situation means in an economic context; we’ll then develop the mathematical techniques required to solve for the optimal bundle using multivariable calculus.

Intuitive and visual approach: the “gravitational pull” towards optimality

The central constrained optimization problem for a consumer is to find the utility-maximizing bundle in their budget set.

For now, we’ll restrict ourselves to strictly monotonic preferences, which means that more of every good is always preferred. It follows logically from this that the optimal bundle for such preferences must always lie along the constraint, since for any bundle in the interior of the budget set, there must always be a strictly preferred bundle which is also affordable. Therefore, we can reduce our constrained optimization problem to finding the utility-maximizing bundle along their budget line.

To visualize this problem, we can think about plotting the budget line and the utility function in the same 3D graph. In the left-hand graph below, we visualize the constraint as a kind of “fence” over the utility function “hill.” In the right-hand graph, we show the utility you reach at different points along the budget constraint. You can drag the point left and right; the relevant bundle is shown below. Note that the left-hand side of this graph represents the vertical intercept of your budget constraint (where you’re spending all your money on good 2), and the right-hand side represents the horizontal intercept of your budget constraint (where you’re spending all your money on good 1).

See interactive graph online here.

The usual way we would find the peak of a curve like this would be to analyze it using (univariate) calculus. In particular, if we let $m_1$ be the amount of money spent on good 1, and ($m - m_1$) be the amount spent on good 2, then the utility as a function of the amount spent on good 1 is \(\hat u(m_1) = u(x_1(m_1),x_2(m_1))\) What happens if we spend a little more money on good 1? Mathematically, by the chain rule, we have \(\frac{d \hat u(m_1)}{dm_1} = \frac{\partial u}{\partial x_1} \times \frac{dx_1}{dm_1} + \frac{\partial u}{\partial x_2} \times \frac{dx_2}{dm_1}\) Since each dollar spent on good 1 increases the consumption of good 1 by $1/p_1$ units of good 1, and decreases consumption of good 2 by $1/p_2$ units of good 2, we can write this perhaps more simply as \(\frac{d \hat u(m_1)}{dm_1} = {MU_1 \over p_1} - {MU_2 \over p_2}\) We sometimes call the term $MU_i/p_i$ the “bang for your buck for good $i$:” that is, the additional utility you get from another dollar spent on good $i$. Thus, the first term is the utility gain per each dollar spent on good 1, and the second term is the utility loss per dollar not spent on good 2.

If this is positive, then you get more “bang for your buck” from good 1 than good 2, so you increase your utility by moving to the right along the budget line; if it’s negative, the opposite holds. That is,

\({MU_1 \over p_1} > {MU_2 \over p_2} \iff \text{ buy more good 1, less good 2}\) \({MU_1 \over p_1} < {MU_2 \over p_2} \iff \text{ buy less good 1, more good 2}\)

Example

The graph above is built from the following example: suppose your preferences over apples (good 1) and bananas (good 2) may be represented by the utility function \(u(x_1,x_2) = x_1^{3 \over 4}x_2^{1 \over 4}\) For this utility function, the marginal utilities are given by \(\begin{aligned} MU_1(x_1,x_2) &= \tfrac{3}{4}x_1^{-{1 \over 4}}x_2^{1 \over 4}\\ MU_2(x_1,x_2) &= \tfrac{1}{4}x_1^{3 \over 4}x_2^{-{3 \over 4}} \end{aligned}\) For the budget constraint, let’s assume:

Now let’s examine the point at which you spend half your money on each good. This would mean buying the bundle $(6,12)$. At this point, your marginal utility from apples is \(MU_1(6,12) = \tfrac{3}{4}6^{-{1 \over 4}}12^{1 \over 4} \approx 0.9 \frac{\text{utils}}{\text{apple}}\)and your marginal utility from bananas is \(MU_2(6,12) = \tfrac{1}{4}6^{3 \over 4}12^{-{3 \over 4}} \approx 0.15 \frac{\text{utils}}{\text{banana}}\) If you spent one more dollar on apples, you could buy 1/4 more pounds of apples (since apples cost $p_1 = 4$ dollars/pound). This would increase your utility by approximately \(\text{Utility gain} = {1 \over 4} \text{ apples} \times 0.9 \frac{\text{utils}}{\text{apple}} = +0.225 \text{ utils}\) At the same time, if you spent one less dollar on bananas, you would have to buy 1/2 fewer pounds of bananas (since bananas cost $p_2 = 2$ dollars per pound). This would decrease your utility by approximately \(\text{Utility loss} = {1 \over 2} \text{ bananas} \times 0.15 \frac{\text{utils}}{\text{banana}} = -0.075 \text{ utils}\) Since the utility gain from buying a dollar more apples is greater than the utility loss from buying a dollar fewer bananas your utility at this point is increasing as you move to the right along the budget constraint.

The MRS and the Price Ratio

Recall that in “Good 1 - Good 2 space,” any slope represents a tradeoff between good 1 and good 2, and is measured in units of good 2 per unit of good 1. We have two slopes which are of interest to us:

We found above that you should spend more money on good 1 if you got more “bang for your buck” from good 1 than good 2: \({MU_1 \over p_1} > {MU_2 \over p_2}\) Note that we can rearrange this to read \({MU_1 \over MU_2} > {p_1 \over p_2}\) But note that the left-hand side of this equation is just the MRS, while the right-hand side of this equation is the price ratio. Therefore, another way of thinking about the consumer problem is to say:

Visually, if the MRS is not equal to the price ratio at some bundle along the budget line, then the indifference curve passing through that point cuts through the budget line, meaning that there’s a region of affordable bundles which are strictly preferred to that point. If the MRS is greater than the price ratio, then that region must lie to the right of the point; if the MRS is less than the price ratio, then that region must lie to the left of that point:

See interactive graph online here.

Example, continued

In our example, the MRS at the point $(6, 12)$ would be \(MRS(6, 12) = {MU_1(6,12) \over MU_2(6,12)} = {0.9 \text{ utils/apple} \over 0.15 \text{ utils/banana}} = 6\ {\text{bananas} \over \text{apple}}\) Likewise, the price ratio was \({p_1 \over p_2} = {4 \text{ dollars/apple} \over 2 \text{ dollars/banana}} = 2\ {\text{bananas} \over \text{apple}}\)

Since you’re willing to give up 6 bananas per apple, and their market prices mean you only need to give up 2 bananas per apple, you’re better off buying more apples and fewer bananas.

Of course, the MRS changes as you move along the budget line: in particular, because preferences are “well-behaved” (strictly monotonic and strictly convex), the MRS is decreasing as you increase $x_1$ and decrease $x_2.$

We can, in fact, plot the indifference curve/budget line diagram, the total utility along the budget line, and a new graph showing the MRS vs the price ratio along the budget line all together. Note that the ideal point here is at (9, 6). Everywhere to the left of that point, the MRS is greater than the price ratio drawing the consumer to the right; everywhere to the right of that point, the MRS is less than the price ratio, drawing the consumer to the left.

See interactive graph online here.

The “gravitational pull” argument outlined above applies to any point along any budget constraint. It tells you, relative to that point, which direction along the constraint corresponds to increasing utility.

In the example above, we can see that at the optimal point, the MRS equals the price ratio, meaning the indifference curve passing through the optimal bundle is tangent to the budget line at that bundle. This isn’t always the case; indeed, Monday’s lecture will be dedicated to analyzing situations in which optimal choices aren’t characterized by such a tangency condition. But when it is, we can use calculus to find the optimal solution; it’s those procedures of multivariate calculus, and in particular the method of Lagrange multipliers, that we’ll spend the rest of the class analyzing.

When calculus works: optimal choices characterized by a tangency condition

Suppose that the optimal bundle is, in fact, at a point like the one above: where a nice, smooth, bowed indifference curve is just tangent to a nice linear budget constraint. In this case, mathematically, the optimal bundle will be characterized by two equations:\(\begin{aligned} \text{Tangency condition: }\ \ \ & MRS(x_1,x_2) = \frac{p_1}{p_2}\\ \text{Budget constraint: }\ \ \ & p_1x_1 + p_2x_2 = m \end{aligned}\)Since the optimal bundle occurs when both of these conditions hold, we can think of the optimal bundle as being “the point along the budget constraint at which the MRS is equal to the price ratio.”

Example, continued

In the example above with $u(x_1,x_2) = x_1^{3 \over 4}x_2^{1 \over 4}$, the marginal rate of substitution is \(MRS = {MU_1 \over MU_2} = \frac{\tfrac{3}{4}x_1^{-{1 \over 4}}x_2^{1 \over 4}}{\tfrac{1}{4}x_1^{3 \over 4}x_2^{-{3 \over 4}}} = {3x_2 \over x_1}\) As we saw before, the price ratio was \({p_1 \over p_2} = {4 \over 2} = 2\) Therefore the tangency condition is \(\begin{aligned} MRS &= {p_1 \over p_2}\\ {3x_2 \over x_1} &= 2\\ x_2 &= \tfrac{2}{3}x_1 \end{aligned}\) The budget constraint is $4x_1 + 2x_2 = 48$; so the two conditions characterizing the optimal bundle are \(\begin{aligned} \textbf{Tangency condition: } & x_2 = \tfrac{2}{3}x_1\\ \textbf{Constraint: } & 4x_1 + 2x_2 = 48 \end{aligned}\) The optimum occurs at the intersection of these two lines. We can see that if we plot the tangency condition in the diagram:

See interactive graph online here.

Mathematical technique: The Lagrange method

In fact, the double condition of the tangency condition and the budget constraint is a result of a more general mathematical technique: the technique of Lagrange multipliers.

In a constrained optimization problem, we call the function we’re trying to maximize (or minimize) the objective function, and we call the equation describing the boundary of the feasible set the constraint. We can then write this problem formally as \(\begin{aligned} \max_{x_1,x_2}\ & f(x_1,x_2) & \text{Objective function}\\ \text{s.t. } & g(x_1,x_2) = k & \text{Constraint} \end{aligned}\) To solve this problem, we create a new function called a Lagrangian, which we construct in a specific way: the Lagrangian is the objective function plus an expression which is equal to zero when the constraint is met: \(\mathcal{L}(x_1,x_2,\lambda) = f(x_1,x_2) + \lambda(k - g(x_1,x_2))\) In the context of the consumer optimization problem, the objective function is the utility function $u(x_1,x_2)$, and the constraint is the budget constraint $p_1x_1 + p_2x_2 = m.$ Specifically, we can rewrite the budget constraint as \(m - p_1x_1 -p_2x_2\) and construct the Lagrangian as follows: \(\mathcal{L}(x_1,x_2,\lambda) = u(x_1,x_2) + \lambda(m - p_1x_1 - p_2x_2)\) Here we can begin to see the logic of the Lagrangian. Since $p_1x_1$ is the amount of money spent on good 1, and $p_2x_2$ is the amount of money spent on good 2, we can interpret $m - p_1x_1 - p_2x_2$ as “money left over to spend on other things.” Obviously, the consumer would like to have money left over to spend on other things. But the consumer also likes these goods, as evidenced by the utility function. So essentially the Lagrangian explicitly sums up the values of the two competing uses of the consumer’s money.

Notice that we multiplied $(m - p_1x_1 - p_2x_2)$ by a constant, represented by the Greek letter $\lambda.$ This constant is called the Lagrange multiplier. Why do we need it? Well, think about the units of the two terms. Since $u(x_1,x_2)$ is measured in utils, and $m - p_1x_1 - p_2x_2$ is measured in dollars we can’t just add them together; we need to measure everything in the same units. The Lagrange multiplier $\lambda$, which is measured in utils per dollar, serves as a kind of “exchange rate” between utility and money.

We now have a function in three variables: $x_1$, $x_2$, and $\lambda.$ The critical points of this function occur when the partial derivatives with respect to all three variables are equal to zero. (You can think of this a little bit like the way you can find the critical point of a univariate function $f(x)$ by looking at the points where $f^\prime(x) = 0.$) The next step of the Lagrange procedure is to construct the first-order conditions by setting all three of those partial derivatives equal to zero: \(\begin{aligned} {\partial \mathcal{L} \over \partial x_1} &= MU_1 - \lambda p_1 = 0\\ {\partial \mathcal{L} \over \partial x_2} &= MU_2 - \lambda p_2 = 0\\ {\partial \mathcal{L} \over \partial \lambda} &= m - p_1x_1 - p_2x_2 = 0 \end{aligned}\) Solving the first two FOCs for $\lambda$ gives us \(\lambda = {MU_1 \over p_1} = {MU_2 \over p_2}\) Using the interpretation we developed above, we can see that $\lambda$ must be equal to the “bang for the buck” from the last unit of either good you spend money on. In other words, $\lambda$ is not just measured in units of utils per dollar: when the consumer is optimizing, it represents the additional utility the consumer could get by spending an additional dollar on either good.

We can also see this by noting that the derivative of the Lagrangian with respect to $m$ is $\lambda$: \({d \over dm}\left[u(x_1,x_2) + \lambda(m - p_1x_1 - p_2x_2)\right] = \lambda\) That is, if we gave the consumer one more dollar, their utility would increase by approximately $\lambda.$

Cross-multiplying, we can see that the above condition is simply \({MU_1 \over MU_2} = {p_1 \over p_2}\) which is the “tangency condition” $MRS = p_1/p_2.$ The third FOC, of course, just gives us our budget constraint back. Therefore, the end result of the Lagrange method may be characterized by the tangency condition and the budget constraint, just as we derived before!

Example, concluded

OK, let’s look at how this applies to the problem we were looking at before. We will, of course, get the exact same result; but we can see where it comes from.

We can write down the utility maximization problem in terms of the objective function and the constraint: \(\begin{aligned} \text{Objective function: } & u(x_1,x_2) = x_1^{3 \over 4}x_2^{1 \over 4}\\ \text{Constraint: } & 4x_1 + 2x_2 = 48 \end{aligned}\) Therefore we can construct the Lagrangian as \(\mathcal{L}(x_1,x_2,\lambda) = x_1^{3 \over 4}x_2^{1 \over 4} + \lambda(48 - 4x_1 - 2x_2)\) Taking the first-order conditions gives us \(\begin{aligned} {\partial \mathcal{L} \over \partial x_1} &= \underbrace{\tfrac{3}{4}x_1^{-{1 \over 4}}x_2^{1 \over 4}}_{MU_1} - \lambda \times \underbrace{4}_{p_1} = 0 & \Rightarrow \lambda = \frac{\tfrac{3}{4}x_1^{-{1 \over 4}}x_2^{1 \over 4}}{4}\\ {\partial \mathcal{L} \over \partial x_2} &= \underbrace{\tfrac{1}{4}x_1^{3 \over 4}x_2^{-{3 \over 4}}}_{MU_2} - \lambda \times \underbrace{2}_{p_2} = 0 & \Rightarrow \lambda = \frac{\tfrac{1}{4}x_1^{3 \over 4}x_2^{-{3 \over 4}}}{2}\\ {\partial \mathcal{L} \over \partial \lambda} &= 48 - 4x_1 - 2x_2 = 0 \end{aligned}\) Setting the two values of $\lambda$ equal to each other – that is, ensuring that the last dollars spent on each good got the same “bang for the buck” – gives us the tangency condition we found before: \(\begin{aligned} \frac{\tfrac{3}{4}x_1^{-{1 \over 4}}x_2^{1 \over 4}}{4} &= \frac{\tfrac{1}{4}x_1^{3 \over 4}x_2^{-{3 \over 4}}}{2}\\ \tfrac{3}{2}x_2 &= x_1\\ x_2 &= \tfrac{2}{3}x_1 \end{aligned}\) From there, we plug it into the budget constraint and get the same exact result as before.

More than two goods

So why do we use the Lagrange method at all, instead of either the univariate (substitution) method or just skipping to the tangency condition and the budget constraint?

There are two important answers. The first is that while the univariate method works with just two goods, it breaks down with more than two goods – and when we do this “for real,” we are of course dealing with more than two goods! That is, if we have $n$ goods, the problem we’d be solving would be \(\begin{aligned} \max_{x_1,x_2}\ & u(x_1,x_2,x_3,\cdots,x_n)\\ \text{s. t. }\ & p_1x_1 + p_2x_2 + p_3x_3 + \cdots + p_nx_n \le m \end{aligned}\)the Lagrangian would be\(\begin{aligned}\mathcal{L}(x_1,x_2,x_3, \cdots, x_n,\lambda) &= u(x_1,x_2,x_3, \cdots, x_n)\\ & + \lambda(m - p_1x_1 - p_2x_2 - p_3x_3 - \cdots - p_nx_n)\end{aligned}\)and the first order conditions would be\(\begin{aligned} {\partial \mathcal{L} \over \partial x_1} &= MU_1 - \lambda p_1 = 0\\ {\partial \mathcal{L} \over \partial x_2} &= MU_2 - \lambda p_2 = 0\\ {\partial \mathcal{L} \over \partial x_3} &= MU_3 - \lambda p_3 = 0\\ \vdots \\ {\partial \mathcal{L} \over \partial x_n} &= MU_n - \lambda p_n = 0\\ {\partial \mathcal{L} \over \partial \lambda} &= m - p_1x_1 - p_2x_2 - p_3x_3 - \cdots - p_nx_n = 0 \end{aligned}\)and the first $n$ conditions would resolve to\(\lambda = {MU_1 \over p_1} = {MU_2 \over p_2} = {MU_3 \over p_3} = \cdots = {MU_n \over p_n}\) This system of equations can then be used to solve for the optimal bundle, no matter how many goods are involved. However, the intuition remains the same: the “bang for the buck” from every good, represented by $\lambda$, must be equal when the consumer is optimizing; otherwise, they could reallocate their money and get more utility.

The second reason is that the value of $\lambda$ itself has economic meaning. In the case of the consumer optimization problem, it tells us the “exchange rate” between utils and money when the consumer is optimizing. More generally, for any constrained optimization problem, it tells us the relationship between the objective function and the constraint; which lies at the heart of the tension between our unlimited wants and our scare resources.

To visualize this, we can actually use the fact that the Lagrange method can be used with only one good. Here the solution is trivial, but the interpretation of the Lagrange multiplier is perhaps even clearer than it would otherwise be.

Suppose you’re trying to maximize \(\begin{aligned} \max_{x}\ & u(x)\\ \text{s. t. }\ & px \le m \end{aligned}\) If $u^\prime(x) > 0$ (that is, if more of good 1 is always better), then the answer is clearly just “spend $m$ on good 1.”

But let’s see how the Lagrangian works here. We have \(\mathcal{L}(x,\lambda) = u(x) + \lambda(m - px)\) Look at what happens if we plot this Lagrangian. If $\lambda = 0$, we just have the utility function. As we increase $\lambda$, the value at the point along the constraint $x=m/p$ (showed by the green vertical line) remains the same, but the slope gets flatter and flatter. When $\lambda$ is exactly equal to the utility gain from spending your last dollar on good 1 (i.e., $MU(36)/p$), the Lagrangian is flat at the optimal point:

See interactive graph online here.

So, way of thinking about the Lagrangian is that it punishes the consumer for spending money: as $x$ increases, $\mathcal{L}(x,\lambda)$ increases by $u^\prime(x)$ but decreases by $\lambda p$: that is, each additional unit gives you some amount of marginal utility, but it costs $p$ dollars, and each dollar you don’t have any more costs you $\lambda$ utils. Furthermore, if you were to get just one more dollar, your utility would increase by (approximately) $\lambda.$

Summary and next steps

So, it seems like we did a lot in this lecture, but in fact we just did the same thing over and over and over again: we saw that, at least for a certain class of problem, the utility-maximizing bundle is found at the point along the constraint where the indifference curve is just tangent to the constraint. We analyzed this three ways:

However, this happy story unfortunately doesn’t always work. Next week we’ll conclude our study of constrained optimization by looking at situations in which the optimal bundle is not characterized by a tangency condition, so the Lagrange method won’t work…and things will start to get really hard…


Reading Quiz

That's it for today! Click here to take the quiz on this reading.

Copyright (c) Christopher Makler / econgraphs.org