pollev.com/chrismakler

Will you need a left-handed desk for exams?

Constrained Optimization When Calculus Works

Christopher Makler

Stanford University Department of Economics

Econ 50: Lecture 10

First Midterm Next Monday!

The homework due Saturday night has several old exam questions as optional exercises.
You don't have to do them all, but you should definitely review the solutions!

Section will be spent reviewing old exam questions.

I will run a review session on Sunday afternoon from 3-5pm, location TBD.

If you have special arrangements, do the paperwork today!

  • OAE: upload your form to the link on the web site
  • Traveling with a sports team - email me and copy your athletic coordinator

Choice space:
all possible options

Feasible set:
all options available to you

Optimal choice:
Your best choice(s) of the ones available to you

Constrained Optimization

Choice Space
(all colleges plus alternatives)

Feasible Set
(colleges you got into)

Your optimal choice!

Preferences

Preferences describe how the agent ranks all options in the choice space.

For example, we'll assume that you could rank all possible colleges
(and other options for what to do after high school) based upon your preferences.

Preference Ranking

Found a startup

Harvard

Stanford

Play Xbox in parents' basement

Cal

Choice space

Feasible set

Optimal
choice!

Found a startup

Stanford

Cal

Harvard

Play XBox in parents' basement

Optimal choice is the highest-ranking option in the feasible set.

Agenda for Today and Friday

Today: When Calculus Works

Wednesday: When Calculus Doesn't Work

Graphs: PPFs and indifference curves

Words: MRS vs MRT

Math: applying Lagrange

Graphs: PPFs and indifference curves

Words: MRS vs MRT

Math: applying Lagrange

Corner solutions

Kinks

Fish vs. Coconuts

  • Can spend your time catching fish (good 1) or collecting coconuts (good 2)
  • What is your optimal division of labor between the two?
  • Intuitively: if you're optimizing, you couldn't reallocate your time
    in a way that would make you better off.

Graphical Analysis:
PPFs and Indifference Curves

The story so far, in two graphs

Production Possibilities Frontier
Resources, Production Functions → Stuff

Indifference Curves
Stuff → Happiness (utility)

Both of these graphs are in the same "Good 1 - Good 2" space

Better to produce
more good 1
and less good 2.

MRS
>
MRT

Better to produce
less good 1
and more good 2.

MRS
<
MRT

Better to produce
more good 1
and less good 2.

MRS
>
MRT
MRS
<
MRT

“Gravitational Pull" Towards Optimality

Better to produce
more good 2
and less good 1.

These forces are always true.

In certain circumstances, optimality occurs where MRS = MRT.

Verbal Analysis: MRS, MRT, and the “Gravitational Pull" towards Optimality 

Marginal Rate of Transformation (MRT)

  • The  number of coconuts you need to give up in order to get another fish
  • Opportunity cost of fish in terms of coconuts

Marginal Rate of Substitution (MRS)

  • The number of coconuts you are willing to give up in order to get another fish
  • Willingness to "pay" for fish in terms of coconuts

Both of these are measured in
coconuts per fish

(units of good 2/units of good 1)

Marginal Rate of Transformation (MRT)

  • The  number of coconuts you need to give up in order to get another fish
  • Opportunity cost of fish in terms of coconuts

Marginal Rate of Substitution (MRS)

  • The number of coconuts you are willing to give up in order to get another fish
  • Willingness to "pay" for fish in terms of coconuts

Opportunity cost of marginal fish produced is less than the number of coconuts
you'd be willing to "pay" for a fish.

Opportunity cost of marginal fish produced is more than the number of coconuts
you'd be willing to "pay" for a fish.

Better to spend less time fishing
and more time making coconuts.

Better to spend more time fishing
and less time collecting coconuts.

MRS
>
MRT
MRS
<
MRT

Mathematical Analysis:
Lagrange Multipliers 

 We've just seen that, at least under certain circumstances, the optimal bundle is
"the point along the PPF where MRS = MRT."

CONDITION 1:
CONSTRAINT CONDITION

CONDITION 2:
TANGENCY
 CONDITION

This is just an application of the Lagrange method!

Example: Linear PPF, Cobb-Douglas Utility

Chuck has 150 hours of labor, and can produce 3 fish per hour or 2 coconuts per hour.

His preferences may be represented by the utility function \(u(x_1,x_2) = x_1^2x_2\)

To find the equation of his PPF, we invert the production functions and plug them in to the resource constraint:

L_1(x_1) = {1 \over 3}x_1
L_2(x_2) = {1 \over 2}x_2
{1 \over 3}x_1 + {1 \over 2}x_2 = 150
f_1(L_1) = 3L_1
f_2(L_2) = 2L_2
L_1 + L_2 = 150

Production function for fish

Production function for coconuts

Resource constraint

Example 1: Linear PPF, Cobb-Douglas Utility

Chuck has 150 hours of labor, and can produce 3 coconuts per hour or 2 fish per hour.

His preferences may be represented by the utility function \(u(x_1,x_2) = x_1^2x_2\)

\text{s.t. }
\mathcal{L}(x_1,x_2,\lambda)=
\displaystyle{\max_{x_1,x_2}}
x_1^2x_2
150 - {1 \over 3}x_1 - {1 \over 2}x_2
+ \lambda\ (
)

OBJECTIVE

FUNCTION

CONSTRAINT

x_1^2x_2
150 - {1 \over 3}x_1 - {1 \over 2}x_2 = 0
{1 \over 3}x_1 + {1 \over 2}x_2 = 150

UTILS

HOURS

What are the units?

UTILS

PER

HOUR

\mathcal{L}(x_1,x_2,\lambda)=
x_1^2x_2
150 - {1 \over 3}x_1 - {1 \over 2}x_2
+ \lambda\ (
)
\displaystyle{\partial \mathcal{L} \over \partial x_1} =

FIRST ORDER CONDITIONS

\displaystyle{\partial \mathcal{L} \over \partial x_2} =
\displaystyle{\partial \mathcal{L} \over \partial \lambda} =
2x_1x_2
x_1^2
150 - {1 \over 3}x_1 - {1 \over 2}x_2
=0
- \lambda\ \times
{1 \over 3}
{1 \over 2}
- \lambda\ \times
=0
=0
\displaystyle{\Rightarrow \lambda\ = \ \ \ \ \ \ \ \ \ \ \ \times}
{1 \over 3}x_1 + {1 \over 2}x_2 = 150
\displaystyle{\Rightarrow \lambda\ = \ \ \ \ \ \ \ \ \ \ \ \times}
2x_1x_2
x_1^2
3
2
MU_1
MU_2
MP_{L1}
MP_{L2}
\Rightarrow

Utility from last hour spent fishing

Utility from last hour spent collecting coconuts

Equation of PPF

\displaystyle{\lambda\ = \ \ \ \ \ \ \ \ \ \ \ \times}
{1 \over 3}x_1 + {1 \over 2}x_2 = 150
\displaystyle{ = \ \ \ \ \ \ \ \ \ \ \ \times}
2x_1x_2
x_1^2
3
2
MU_1
MU_2
MP_{L1}
MP_{L2}

Utility from last hour spent fishing

Utility from last hour spent collecting coconuts

Equation of PPF

{1 \over 3}x_1 + {1 \over 2}x_2 = 150
=
2x_1x_2
x_1^2
3
2
MU_1
MU_2
MP_{L1}
MP_{L2}

Equation of PPF

TANGENCY
CONDITION

MRS

MRT

CONSTRAINT

{1 \over 3}x_1 + {1 \over 2}x_2 = 150
=
2x_1x_2
x_1^2
3
2
x_2 = {1 \over 3}x_1
{1 \over 3}x_1 + {1 \over 2}\ \ \ \ \ \ \ \ \ = 150
({1 \over 3}x_1)
{1 \over 3}x_1 + {1 \over 6}x_1 = 150
{1 \over 2}x_1 = 150
x_1^* = 300
x_2 = {1 \over 3}
x_2^* = 100
(300)

TANGENCY
CONDITION

CONSTRAINT

PLUG INTO
CONSTRAINT

PLUG BACK INTO TANGENCY CONDITION

{1 \over 3}x_1 + {1 \over 2}x_2 = 150
x_2 = {1 \over 3}x_1
x_1^* = 300
x_2^* = 100

TANGENCY
CONDITION

CONSTRAINT

TANGENCY
CONDITION

CONSTRAINT

\displaystyle{\lambda\ = \ \ \ \ \ \ \ \ \ \ \ \times}
\displaystyle{ = \ \ \ \ \ \ \ \ \ \ \ \times}
2x_1x_2
x_1^2
3
2
MU_1
MU_2
MP_{L1}
MP_{L2}

Utility from last hour spent fishing

Utility from last hour spent collecting coconuts

Interpretation of the Lagrange Multplier

At the optimum, we have \(x_1^* = 300\) and \(x_2^* = 100\):

2 \times 300 \times 100 \times 3 = 180,000
300^2 \times 2 = 180,000

What does this mean?

{1 \over 3}x_1 + {1 \over 2}x_2 = 150
=
2x_1x_2
x_1^2
3
2
x_2 = {1 \over 3}x_1
{1 \over 3}x_1 + {1 \over 2}\ \ \ \ \ \ \ \ \ = 150
({1 \over 3}x_1)
{1 \over 3}x_1 + {1 \over 6}x_1 = 150
{1 \over 2}x_1 = 150
x_1^* = 300
x_2 = {1 \over 3}
x_2^* = 100
(300)

TANGENCY
CONDITION

CONSTRAINT

PLUG INTO
CONSTRAINT

PLUG BACK INTO TANGENCY CONDITION

\ \ \ \overline L\ \ \
\ \ \ \overline L\ \ \
\ \ \ \overline L\ \ \
\ \ \ \overline L\ \ \
\ \ 2\overline L\ \ \
\ (2\overline L)\
\ \ \tfrac{2}{3}\overline L\ \
x_1^*(\overline L) = 2 \overline L
x_2^*(\overline L) = \tfrac{2}{3}\overline L
u(x_1,x_2) = x_1^2x_2
= {8 \over 3} \overline L^3
V(\overline L) = u[x_1^*(\overline L),x_2^*(\overline L)] = (2 \overline L)^2(\tfrac{2}{3}\overline L)

How much utility do you get from that bundle?

What is the optimal bundle to produce if you have \(\overline L\) hours of labor available to you?

What is the marginal utility from another hour?

V'(L) = 8L^2
x_1^*(\overline L) = 2 \overline L
x_2^*(\overline L) = \tfrac{2}{3}\overline L
u(x_1,x_2) = x_1^2x_2
= {8 \over 3} \overline L^3
V(\overline L) = u[x_1^*(\overline L),x_2^*(\overline L)] = (2 \overline L)^2(\tfrac{2}{3}\overline L)

How much utility do you get from that bundle?

What is the optimal bundle to produce if you have \(\overline L\) hours of labor available to you?

What is the marginal utility from another hour?

V'(\overline L) = 8 \overline L^2

We found that when \(\overline L = 150\), \(\lambda = 180,000\)

8 \times 150^2 = 180,000
L_1 = {1 \over 100}x_1^2
L_2 = {1 \over 36}x_2^2
+
= 100
{1 \over 100}x_1^2
{1 \over 36}x_2^2

Remember this PPF...let's maximize the Cobb-Douglas utility function \(u(x_1,x_2) = a \ln x_1 + b \ln x_2\) subject to it...

Example 2: Curved PPF, Cobb-Douglas Utility

\text{s.t. }
\mathcal{L}(x_1,x_2,\lambda)=
\displaystyle{\max_{x_1,x_2}}
a \ln x_1 + b \ln x_2
100 - {1 \over 100}x_1^2 + {1 \over 36}x_2^2
+ \lambda\ (
)

OBJECTIVE

FUNCTION

CONSTRAINT

a \ln x_1 + b \ln x_2
100 - {1 \over 100}x_1^2 + {1 \over 36}x_2^2 = 0
{1 \over 100}x_1^2 + {1 \over 36}x_2^2 = 100

First order conditions:

\displaystyle{\partial \mathcal{L} \over \partial x_1} =
\displaystyle{\partial \mathcal{L} \over \partial x_2} =
{a \over x_1}
{b \over x_2}
- \lambda\ \times
{x_1 \over 50}
{x_2 \over 18}
- \lambda\ \times
=0
=0
\Rightarrow \lambda\ = {x_1^2 \over 50a}
\Rightarrow \lambda\ = {x_2^2 \over 18b}
{x_2^2 \over 18b} = {x_1^2 \over 50a}
x_2^2 = {9b \over 25a}x_1^2
x_2 = \sqrt{b \over a} \times {3 \over 5}x_1

T.C.

CONSTRAINT

{1 \over 100}x_1^2 + {1 \over 36}x_2^2 = 100

(let's square both sides to make substitution easier)

x_2^2 = {b \over a} \times {9 \over 25}x_1^2
{1 \over 100}x_1^2 + {1 \over 36}\left[{9b \over 25a}x_1^2\right] = 100
{1 \over 100}x_1^2 + {b \over 100a}x_1^2= 100
ax_1^2 + bx_1^2= 100^2 \times a
x_1^* = 100 \times \sqrt{a \over a + b}

[9/36 = 1/4]

[multiply both sides by \(100a\)]

x_1^2 = 100^2 \times {a \over a + b}

[factor out \((a + b)\) and divide both sides]

[take the square root]

x_2 = \sqrt{b \over a} \times {3 \over 5}x_1

TANGENCY CONDITION

CONSTRAINT

{1 \over 100}x_1^2 + {1 \over 36}x_2^2 = 100
x_2 = \sqrt{b \over a} \times {3 \over 5}x_1

TANGENCY CONDITION

{1 \over 100}x_1^2 + {1 \over 36}\left[{9b \over 25a}x_1^2\right] = 100
{1 \over 100}x_1^2 + {b \over 100a}x_1^2= 100
ax_1^2 + bx_1^2= 100^2 \times a
x_1^* = 100 \times \sqrt{a \over a + b}
x_1^2 = 100^2 \times {a \over a + b}
x_2^* = \sqrt{b \over a} \times {3 \over 5} \left( 100 \sqrt{a \over a + b}\right)
x_2^* = 60 \times \sqrt{b \over a + b}
x_1^* = 100 \times \sqrt{a \over a + b}
x_2^* = 60 \times \sqrt{b \over a + b}

Remember the setup...

x_1 = 10\sqrt{L_1}
x_2 = 6\sqrt{L_2}

We can rewrite our optimal bundle as

\overline L = 100
u(x_1,x_2) = a \ln x_1 + b \ln x_2
x_1 = 10\sqrt{{a \over a + b}100}
x_1 = 6\sqrt{{b \over a + b}100}
x_1 = 10\sqrt{{a \over a + b}\overline L}
x_1 = 6\sqrt{{b \over a + b}\overline L}

"Spend fraction \(a/(a+b)\) of your labor on good 1, and the rest on good 2."

x_2 = \sqrt{b \over a} \times {3 \over 5}x_1

Tangency Condition

pollev.com/chrismakler

Suppose your preferences may be represented by the utility function

\(u(x_1,x_2) = a \ln x_1 + b \ln x_2\).

What happens to the slope of the line representing the tangency condition if a increases?

x_2 = \sqrt{b \over a} \times {3 \over 5}x_1

Tangency Condition

Summary

  • Some decisions are made by balancing your marginal benefits and marginal costs
    • If you value something more than its opportunity cost, you should do more of it
    • If you value something less than its opportunity cost, you should do less of it
  • The Lagrange multiplier method is a mathematical implementation of this:
    • The tangency condition finds all value at which MRS = MRT: that is, bundles where your willingness to give up good 2 to get another unit of good 1 (MRS)
      is exactly equal to the opportunity cost of another unit of good 1 (MRT).
    • Adding the constraint condition finds the most affordable such bundle,
      given your current resources.
    • The Lagrange multiplier captures how much more utility you would get from an additional unit of resources.
  • Next time: situations in which your optimal choice is not characterized by this kind of balancing, and Lagrange fails to find the optimum

Econ 50 | Lecture 10

By Chris Makler

Econ 50 | Lecture 10

Constrained Optimization with Calculus

  • 246