Choice

Hal Varian
January 1992

Slutsky equation

Let's check the Slutsky equation for the CES demand functions when rho=-1.  First we'll calculate the CES demands, etc.

u[x1_,x2_] := 1/x1 + 1/x2

L= u[x1,x2] - lambda*(p1 x1 + p2 x2 - m)

firstOrder=Evaluate[{D[L,x1]==0,D[L,x2]==0,D[L,lambda]==0}]

Alas, Mathematica cannot solve this system directly.  However, we can use the same trick that we used before.  We define two auxiliary variables, y1 and y2, and then solve the entire system of equations.

firstOrder=Union[firstOrder/.{x1^(-2)->y1^2,x2^(-2)->y2^2},
{y1==1/x1,y2==1/x2}]
solution=Solve[firstOrder,{lambda,x1,x2,y1,y2}][[1]]
x1[p1_,p2_,m_]:=Simplify[x1/.solution]
x1[p1,p2,m]
x2[p1_,p2_,m_] := Simplify[x2/.solution]
x2[p1,p2,m]

Indirect utility and expenditure

Here's the indirect utility function:

v[p1_,p2_,m] := Simplify[u[x1,x2]/.solution]
v[p1,p2,m]

To solve for the expenditure function, solve for income as a function of utility:

solution2=Solve[v[p1,p2,m]==u,m][[1]]
e[p1_,p2_,m_] := m/.solution2
e[p1,p2,m]

Hicksian demands and Slutsky equation

The Hicksian demand function  for good 1will be the derivative of this expenditure function with respect to p1.  We'll evaluate it at u=v[p1,p2,m]:

h[p1_,p2_,u_] := D[e[p1,p2,m],p1]

slopeOfHicksianDemand=
  Simplify[D[h[p1,p2,u],p1]/.{u->v[p1,p2,m]}]

We want to compare this to the Slutsky equation:

slutskyTerm=Simplify[D[x1[p1,p2,m],p1] + 
               D[x1[p1,p2,m],m]*x1[p1,p2,m]]

Slutsky wins again...

Integrability

Here we'll solve the integrability equations for the linear demand function:

Linear demand

x[p_,m_] := a p + b m + c

Mathematica wants the integrability equation and the boundary condition in order to solve for mu.

solution=DSolve[{mu'[p]==a p + b mu[p] + c,mu[q]==m},
         mu[p],p][[1]]

Here's the standard form for the money metric utility function

mm[p_,q_,m_] := mu[p]/.solution
mm[p,q,m]

Let's see if we can figure out what the indifference curves for this indirect utility function looks like.  There are several ways to do this; one way is to solve for the Hicksian demands.  We'll put the parameters into the utility function since we want to see how the indifference curve changes as these parameters change.

h1[p_,q_,m_,a_,b_,c_] := 
      Evaluate[x[p,income]/.{income->mm[p,q,m]}]
h1[p,q,m,a,b,c]

This is one Hicksian demand; the other one comes from the budget constraint:

h2[p_,q_,m_,a_,b_,c_] := Evaluate[(income - 
                         p x[p,income])/.{income->mm[p,q,m]}]
h2[p,q,m,a,b,c]

Now we'll fix q and m, so that utility is held fixed,  pick some values for (a,b,c) and then plot these functions as p varies.

hh1[p_] := Simplify[Evaluate[h1[p,1,10,-10,1,1]]]
hh2[p_] := Simplify[Evaluate[h2[p,1,10,-10,1,1]]]

Simplify[{hh1[p],hh2[p]}]

ParametricPlot[{hh1[p],hh2[p]},{p,0,1.5},AxesOrigin->{0,0},
  PlotRange->{0,12},AspectRatio->1]

Note that the indifference curve crosses the vertical axis.  This makes no  economic sense; it is a good warning to be careful in calculating welfare conclusions using this linear demand function.

Log-Linear demand

Suppose that demand takes the form

x[p_,m_] := p^a m^b E^c

We estimate the demand function and find that a=-0.2, b=1.2, and c=0.0.   Initially, the consumer faces prices p=2 and has income of 1.  If the price rises to p=3, how much income would the consumer need to make her as well off as she was before the price increase?

We'll answer this question using integrability.  Before the price change, e[2,u]=1.  We want to know what e[3,u] equals.  First we find a numerical solution to the integrability equation.

a=-0.2
b=1.2
c=0.0
dsolution=
  NDSolve[{e'[p]==(p^a)* (e[p]^b), e[2]==1},e,{p,1,4}]

We can plot the function e[p] that Mathematica found for us as follows.  Note that e[2]=1, as required by the boundary condition.

Plot[Evaluate[e[p]/.dsolution],{p,1,4}]

To find the value of e[3,u], just substitute 3 into e:

e[3]/.dsolution

Solving for the direct utility function

Given a normalized indirect utility function, we can find the direct utility function just by solving a minimization problem.  Let's try the Cobb-Douglas case.

L = p1*p2 - lambda*(p1 x1 + p2 x2 - 1)
solution=Solve[{D[L,p1]==0,D[L,p2]==0,D[L,lambda]==0},
         {p1,p2,lambda}][[1]]
u[x1_,x2_] := p1*p2 /.solution
u[x1,x2]