Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

📚 The CoCalc Library - books, templates and other resources

Views: 96159
License: OTHER
Kernel: SageMath 8.6

Optimal Saving - A constrained Optimization Problem

Notebook for the Public Finance course, UCSC, AY 2018/2019 by Duccio Gamannossi degl' Innocenti. You can find more information on the course here.

Maximization of intertemporal consumption - definition of the problem

This simple problem entails an individual in a two-period setting. In the first period, the individual works and earns an income ww that he allocates between consumption c1c_1 and savings ss. So it is c1+s=wc_1+s=w.

In the second period, the individual is not working but can sustain his consumption c2c_2 with his previous savings plus the return obtained for investing them s(1+r),r≥0s(1+r), r \geq 0. So it is c2=s(1+r)c_2=s(1+r).

The individual intertemporal utility

The individual wants to allocate his consumption c1,c2c_1, c_2 so to maximize his intertemporal utility U(c1,c2)=u(c1)+δu(c2)U(c_1, c_2) = u(c_1) + \delta u(c_2) where c1≥0,c2≥0c_1\geq 0, c_2\geq 0 , u′≥0,u′′<0u'\geq 0, u''<0. By setting 0≤δ≤10 \leq \delta \leq 1 we represent his preference for current consumption over future one (impatience).

var("delta, r") u = function('u') U = function('U'); U(c1, c2) = u(c1) + delta*u(c2) html("U="+latex(U(c1, c2, delta)))

The intertemporal maximization problem can be stated as:

maxc1,c2U(c1,c2) s.t. c1+s=w and c2=s(1+r)max_{c_1,c_2}U(c_1,c_2) \mbox{ } s.t. \mbox{ } c_1+s=w \mbox{ } and \mbox{ }c_2=s(1+r)

Here are presented three strategies to solve this problem (based on the methods outlined in the optimization review):

  • A - Substitution

  • B - Lagrangean Optimization

  • C - The Equimarginal Principle

A - Substitution

In a problem with only two goods to choose between c1,c2{c_1, c_2}, chosing the amount of money you wish to spend on the first good c1c_1 defines how much money you have left (i.e. w−c1w-c_1) and, given the price of the second good (i.e. δ(1+r)\delta (1+r)), the quantity c2c_2. So, in a two-goods setting the choice actually boils down to choose one of the two.

Analytically, in order to characterize the solution to the problem using substitution:

  1. Use the constraints of the problem to identify the relationship between the two goods (that is, the budget constraint). Let's express c2c_2 as a function of c1c_1 (the other case leads exactly to the same result).

  2. Substitute c2c_2 in the objective function (i.e. UU) with the expression obtained in point 1 so to restate the problem as an unconstrained single-variable one (the constraint is now embeeded into the objective function due to the substitution).

  3. Solve the problem as an uncostrained maximization one by computing the FOC=dUdc1FOC=\frac{dU}{dc_1} and imposing FOC=0FOC=0 .

Algebraically, it is:

1. Identify the relationship between the two goods

Define the second constraint

var('s') cnstr_2=s*(1+r) html("c_2="+latex(cnstr_2))

Solve the first constraint for ss so to identify s1s_1 (The savings implied by the first constraint)

var('w') s_1=solve(c1+s==w, s)[0].rhs() html("s_{1}="+latex(s_1))

Substitute s1s_1 in the second constraint so to express c2c_2 as a function of c1c_1

c_2_cnstr_2_sub=cnstr_2.substitute(s=s_1) html("c_2="+latex(c_2_cnstr_2_sub))
2. Substitute c2c_2 in the objective function
function('U_sub'); U_sub(c1) = U(c1, c_2_cnstr_2_sub) html("U_{sub}="+latex(U_sub(c1)))
3. Solve the problem as an uncostrained maximization one
FOC_sub = diff(U_sub(c1), c1) FOC_sub = FOC_sub.substitute({FOC_sub.operands()[0]:diff(u(c2),c2)*-delta*(1+r)}) html("FOC_{sub}=" + latex(FOC_sub.full_simplify())+ "=0")

That, with a bit of algebra, implies:

FOC_sub_0 = FOC_sub==0 FOC_sub_0_ratio = FOC_sub_0.subtract_from_both_sides(diff(u(c1),c1)).divide_both_sides(diff(u(c1), c1)).divide_both_sides(-delta*(r + 1)) html("FOC_{sub}=" + latex(FOC_sub_0_ratio))

B - Lagrangean Optimization

An alternative method for optimization is the Lagrangean method, which allows us to embed the budget constraint in the maximization and that is better suited to deal with problems involving more than two goods.

Analytically, in order to characterize the solution to the problem using the Lagrangean method:

  1. Use the constraints of the problem to restate the budget constraint. Collect the terms of the budget constraint on one side - we will refer to this expression as BCcollectBC_{collect}.

  2. Define the Lagrangean Function L\mathcal{L}, by adding the collected terms of point 1 multiplied by the lagrangean multiplier λ\lambda to the objective function of the problem

L(c1,c2,λ)=U(c1,c2)+λ(w−c1−c21+r)\mathcal{L}(c_1, c_2, \lambda) = U(c_1,c_2) + \lambda(w-c_1-\frac{c_2}{1+r})
Notice that, when the constraint is fulfilled and the individual uses his entire budget, the additional term becomes zero (including the multiplier $\lambda$). Furthermore, the additional term implies that, whenever the budget constraint is not binding, there is margin for an improvement of the objective function by reallocation. Crucially, adding the budget constraint to the objective function does not alter the problem at the optimum. So, the combination of $c_1, c_2$ that maximizes $\mathcal{L}$ also maximizes $U$. To sum up, the addition of the constraint as in the $Lagrangean$ identifies a maximum that is both satisfying the constraint and that identifies a maximum for the underlying objective function $U$.
  1. Evaluate the FOC of this new problem L(c1,c2,λ)\mathcal{L}(c_1, c_2, \lambda) (relative to the variables c1,c2,λc_1, c_2, \lambda) and solve the system FOCs=0FOCs=0 to characterize the solution.

1. Use the constraints to restate the budget constraint
BC_collect = c2==c_2_cnstr_2_sub RHS = BC_collect.subtract_from_both_sides(c2).rhs() html("BC_{collect}=" + latex(RHS))
2. Define the Lagrangean Function L\mathcal{L}
var('l', latex_name='\lambda') L(c1, c2, delt, r, l) = U(c1, c2) + l*(RHS) html(LatexExpr("\mathcal{L}=") + latex(L(c1, c2, delt, r, l)))
3. Evaluate the FOC
DLDc1 = diff(L(c1, c2, delt, r, l), c1) html(LatexExpr("\\frac{\partial \mathcal{L}}{\partial c_1}=") + latex(DLDc1) + "=0")
DLDc2 = diff(L(c1, c2, delt, r, l), c2) html(LatexExpr("\\frac{\partial \mathcal{L}}{\partial c_2}=") + latex(DLDc2) + "=0")
DLDl = diff(L(c1, c2, delt, r, l), l) html(LatexExpr("\\frac{\partial \mathcal{L}}{\partial \lambda}=") + latex(DLDl) + "=0")

The system {∂L∂c1=0\frac{\partial \mathcal{L}}{\partial c_1}=0, ∂L∂c2=0\frac{\partial \mathcal{L}}{\partial c_2}=0, ∂L∂λ=0\frac{\partial \mathcal{L}}{\partial \lambda}=0} provides a characterization of the solution.

In particular, ∂L∂λ=0\frac{\partial \mathcal{L}}{\partial \lambda}=0 implies a binding budged constraint. Moreover, by inspecting ∂L∂c1=0\frac{\partial \mathcal{L}}{\partial c_1}=0 and ∂L∂c2=0\frac{\partial \mathcal{L}}{\partial c_2}=0 we can see that :

Equation ∂L∂c1=0\frac{\partial \mathcal{L}}{\partial c_1}=0 can be re-arranged

l_DLDc1 = solve(DLDc1==0, l)[0] html(latex(l_DLDc1))

similarly, for equation ∂L∂z=0\frac{\partial \mathcal{L}}{\partial z}=0 it is

l_DLDc2 = solve(DLDc2==0, l)[0] html(latex(l_DLDc2))

and, equating λ\lambda and re-arranging, we get:

FOC_l_2_3 = l_DLDc2.rhs() ==l_DLDc1.rhs() FOC_l_2_3 = FOC_l_2_3.divide_both_sides(diff(u(c1), c1)).divide_both_sides(delta) html("FOC_{\mathcal{L}_{2-3}=}" + latex(FOC_l_2_3))

the same condition stated in FOCsubFOC_{sub}. These conditions are particular case of:

C - The Equimarginal principle

The Equimarginal principle states that maximization of a given objective function is attained when the allocation of resources among different alternatives is such that the utility derived from the last unit of money spent on each is equal. In our setting, the individual will maximize his objective function when the marginal utility per euro spent is the same across the goods he can buy.

Given that the price of consumption in the first period is pc1=1p_{c_1}=1 while the price of cunsumption in the second period is pc2=1/(1+r)p_{c_2}=1/(1+r), for the Equimarginal Principle it is:

MRSc2c1=∂∂c2u(c2)∂∂c1u(c1)=pc2pc1  ⟹  MRSc2c1=δ∂∂c2u(c2)∂∂c1u(c1)=1(r+1)  ⟹  MRSc2c1=∂∂c2u(c2)∂∂c1u(c1)=1δ(r+1)MRS_{c_2c_1} =\frac{\frac{\partial}{\partial c_{2}}u\left(c_{2}\right)}{\frac{\partial}{\partial c_{1}}u\left(c_{1}\right)} = \frac{p_{c_2}}{p_{c1}} \implies MRS_{c_2c_1} = \frac{\delta\frac{\partial}{\partial c_{2}}u\left(c_{2}\right)}{\frac{\partial}{\partial c_{1}}u\left(c_{1}\right)} = \frac{1}{{\left(r + 1\right)}} \implies MRS_{c_2c_1} = \frac{\frac{\partial}{\partial c_{2}}u\left(c_{2}\right)}{\frac{\partial}{\partial c_{1}}u\left(c_{1}\right)} = \frac{1}{{\delta\left(r + 1\right)}}

So, the solution will be such that:

  1. the individual is using all of his income

  2. c1∗,c2∗c_1^*, c_2^* satisfy the equimarginal principle