Cost Minimization

Hal R. Varian
January, 1992

Minimizing costs

Let's solve a cost minimization problem for a Cobb-Douglas function.  First we set up the Lagrangian,

L= w1 x1 + w2 x2 - 
   lambda*((x1^(1/4))*(x2^(3/4))-y)

Now differentiate the Lagrangian with respect to x1, x2, and lambda, set the derivatives equal to zero, and solve for each of these variables.

solution=Solve[{D[L,x1]==0, D[L,x2]==0, D[L,lambda]==0},
{x1,x2,lambda}][[1]]

Now substitute into the expression for costs to derive the cost function

c[w1_,w2_,y_] := w1*x1 + w2*x2 /.solution

c[w1,w2,y]

Let's check Shephard's lemma to make sure it works

Simplify[{D[c[w1,w2,y],w2],D[c[w1,w2,y],w1]}]

The CES cost function

Here's a CES cost function with rho=1

L=w1 x1 + w2 x2 - lambda*(y - x1^(-1) - x2^(-1))

solution=Simplify[Solve[{D[L,x1]==0, D[L,x2]==0, D[L,lambda]==0},
{x1,x2,lambda}]][[1]]

Again, we substitute into the cost function and verify Shephard's lemma:

c[w1_,w2_,y_] := w1 x1 + w2 x2 /. solution

c[w1,w2,y]

{D[c[w1,w2,y],w1],D[c[w1,w2,y],w2]}

CES with rho=2

Here's the Lagrangian for a  CES cost function with rho=2

L=w1 x1 + w2 x2 - lambda*(y - 1/(x1*x1) - 1/(x2*x2))

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

Unfortunately, Mathematica finds this system of equations difficult to solve, so we'll have to resort to some tricks.  In general, if Mathematica finds a system of equations difficult to solve, try some transformations to make the system look like a system of polynomials---or, even better, a system of linear equations.  In this case, we'll introduce auxiliary variables z1=1/x1 and z2=1/x2.  With these additions, the system we want to solve is

transFOC=FOC/.{x1->1/z1,x2->1/z2}
solution=Solve[Evaluate[transFOC],{z1,z2,lambda}][[1]]

The demand functions and the cost function are

{x1,x2} = Simplify[{1/z1,1/z2}/.solution]

c[w1_,w2_,y_] := (w1 /z1 + w2 /z2)/.solution

Simplify[c[w1,w2,y]]