<p>The Lagrangian can be written as</p>
<p><span class="math-container">$$L(C_1,C_{21},C_{31},C_{22},C_{32},S_1,S_{21},S_{22}) = p_1 \times u(C_1,C_{21},C_{31}) + p_2 \times u(C_1,C_{22},C_{32}) + \alpha(Y-C_1-S_{1})  + \lambda_2(Y+\epsilon +S_1 - C_{21} - S_{21}) + \lambda_3(Y+S_{21} - C_{31}) +  + \delta_2(Y-\epsilon +S_1 - C_{22} - S_{22}) + \delta_3(Y+S_{22} - C_{32}),$$</span></p>
<p>For which the set of first-order conditions is</p>
<p><span class="math-container">\begin{align}
\frac{\partial L}{\partial C_{1}} &amp;= p_1 \frac{\partial U}{\partial C_1} + p_2 \frac{\partial U}{\partial C_1} - \alpha = 0 \\ \frac{\partial L}{\partial C_{21}} &amp;= p_1 \frac{\partial U}{\partial C_{21}} - \lambda_2 =0\\ 
\frac{\partial L}{\partial C_{31}} &amp;= p_1 \frac{\partial U}{\partial C_{31}} - \lambda_3 =0\\ \frac{\partial L}{\partial C_{21}} &amp;= p_2 \frac{\partial U}{\partial C_{22}} - \delta_2 =0\\ 
\frac{\partial L}{\partial C_{32}} &amp;= p_2 \frac{\partial U}{\partial C_{32}} - \delta_3 =0\\
\frac{\partial L}{\partial S_1} &amp;= -\alpha + \lambda_2  + \delta_2=0\\ 
\frac{\partial L}{\partial S_{21}} &amp;= - \lambda_2 + \lambda_3 =0\\
\frac{\partial L}{\partial S_{22}} &amp;= - \delta_2 + \delta_3 =0.\\
\end{align}</span></p>

CC BY-SA 4.0
2024-06-04T07:30:51.957Z
2024-06-04T07:30:51.957Z
Jesper Hybel
<p>Suppose we want to maximise a expected utility function: <span class="math-container">$$E_1(u(C_1,C_2,C_3))
$$</span> subject to following constraints. There are two possible situations each with probability <span class="math-container">$\frac{1}{2}$</span>.
<span class="math-container">$$C_1 + S_1 = Y
$$</span></p>
<p><span class="math-container">\begin{cases}
C_{2,1} + S_{2,1} = Y + S_1 + \varepsilon \\
C_{3,1} = Y + S_{2,1} &amp; \text{with probability } \frac{1}{2}
\end{cases}</span> <br />
<span class="math-container">\begin{cases}
C_{2,2} + S_{2,2} = Y + S_1 - \varepsilon \\
C_{3,2} = Y + S_{2,2} &amp; \text{with probability } \frac{1}{2}
\end{cases}</span> <br />
<span class="math-container">$C_1, C_{2,1}, C_{2,2}, C_{3,1}, C_{3,2} &gt; 0$</span>.</p>
<p>How can we solve this model using lagrangian, when ignoring the inequality? I have never seen similar models before, so I'm stuck at the beginning of writing a Lagrangian.</p>
<p>Further, if we include liquidity constraint, that <span class="math-container">$S_1,S_{2,1},S_{2,2}\geq 0$</span>? I can convert these inequality constraints into <span class="math-container">$Y$</span> and <span class="math-container">$\varepsilon$</span>, and use KKT theorem? I really have no idea of it.</p>
<p>Here you can consider <span class="math-container">$C_i$</span> as consumption in <span class="math-container">$i$</span> time period, <span class="math-container">$C_{i,j}$</span> be consumption at <span class="math-container">$i$</span> period with <span class="math-container">$j$</span> situation(whether add or subtract <span class="math-container">$\varepsilon$</span>),and <span class="math-container">$S$</span> similarly defined.</p>

CC BY-SA 4.0
2024-06-02T08:51:46.130Z
Assuming that saving is positive is not usually part of the setup because it is assumed that agents can borrow. However, you then need some constraints on the final debt. For finite horizon, it is often assumed that the agent has no debt in the final period. This is already assumed because there is no $S_{3j}$ ... in the last period everything is consumed and it is assumed that $C_{3j}$ is positive so your debt cannot be negative in final period. So in short ... do not add positivity constraints on savings.
Jesper Hybel
CC BY-SA 4.0
2024-06-02T09:05:19.490Z
Without loss of generality, you can assume that epsilon only takes on positive values. If the shock is positive, the agent is incentivized to borrow for periods 1 and 3 financed by high income in the second period. The other way around if the shock is negative. You can just write out the expectation using the probabilities and then you get some sort of system of Euler equations. To get closed form solution you need to assume something about the utility function itself.
Jesper Hybel
CC BY-SA 4.0
2024-06-02T10:36:25.520Z
so supposing utility is $\ln(C_1)+\ln(C_2)+\ln(C_3)$the lagrangian would be $L=E_1[n(C_1)+\ln(C_2)+\ln(C_3)+\lambda_1(3Y-C_1-C_{2,1}-C_{3,1}+\epsilon)+\lambda_2(3Y-C_1-C_{2,2}-C_{3,2}-\epsilon)]$. And by writing it out, we have $\ln(C_1)+0.5\ln(C_{2,1})+0.5\ln(C_{2,2})+0.5\ln(C_{3,1})+0.5\ln(C_{3,2})+0.5\lambda_1(3Y-C_1-C_{2,1}-C_{3,1}+\epsilon)+0.5\lambda_2(3Y-C_1-C_{2,2}-C{3,2}-\epsilon)$. Then the FOCs are obtained by differentiate wrt $C_1,C_{2,1},C_{2,2},C_{3,1},C_{3,2}$ respectively?
Nonenicht
CC BY-SA 4.0
2024-06-02T10:40:34.530Z
Further, if we want to consider a situation where there's no way to borrow, so $S$ must all be non-negative, how should we solve this model? There should be a simpler intuitive way without using KKT?
Nonenicht
<macroeconomics><optimization><lagrangian>
A question about Lagrangian, KKT theorem, consumer's problem
Nonenicht
# A question about Lagrangian, KKT theorem, consumer's problem

(Asked by: username_0 on 2024-06-02)

Suppose we want to maximise a expected utility function: $$E\_1(u(C\_1,C\_2,C\_3))
$$ subject to following constraints. There are two possible situations each with probability $\frac{1}{2}$.
$$C\_1 + S\_1 = Y
$$

\begin{cases}
C\_{2,1} + S\_{2,1} = Y + S\_1 + \varepsilon \\
C\_{3,1} = Y + S\_{2,1} & \text{with probability } \frac{1}{2}
\end{cases}   
\begin{cases}
C\_{2,2} + S\_{2,2} = Y + S\_1 - \varepsilon \\
C\_{3,2} = Y + S\_{2,2} & \text{with probability } \frac{1}{2}
\end{cases}   
$C\_1, C\_{2,1}, C\_{2,2}, C\_{3,1}, C\_{3,2} > 0$.

How can we solve this model using lagrangian, when ignoring the inequality? I have never seen similar models before, so I'm stuck at the beginning of writing a Lagrangian.

Further, if we include liquidity constraint, that $S\_1,S\_{2,1},S\_{2,2}\geq 0$? I can convert these inequality constraints into $Y$ and $\varepsilon$, and use KKT theorem? I really have no idea of it.

Here you can consider $C\_i$ as consumption in $i$ time period, $C\_{i,j}$ be consumption at $i$ period with $j$ situation(whether add or subtract $\varepsilon$),and $S$ similarly defined.

**Tags:** macroeconomics, optimization, lagrangian
> **Comments:**
> **username_1**: Assuming that saving is positive is not usually part of the setup because it is assumed that agents can borrow. However, you then need some constraints on the final debt. For finite horizon, it is often assumed that the agent has no debt in the final period. This is already assumed because there is no $S_{3j}$ ... in the last period everything is consumed and it is assumed that $C_{3j}$ is positive so your debt cannot be negative in final period. So in short ... do not add positivity constraints on savings.  
> **username_1**: Without loss of generality, you can assume that epsilon only takes on positive values. If the shock is positive, the agent is incentivized to borrow for periods 1 and 3 financed by high income in the second period. The other way around if the shock is negative. You can just write out the expectation using the probabilities and then you get some sort of system of Euler equations. To get closed form solution you need to assume something about the utility function itself.  
> **username_0**: so supposing utility is $\ln(C_1)+\ln(C_2)+\ln(C_3)$the lagrangian would be $L=E_1[n(C_1)+\ln(C_2)+\ln(C_3)+\lambda_1(3Y-C_1-C_{2,1}-C_{3,1}+\epsilon)+\lambda_2(3Y-C_1-C_{2,2}-C_{3,2}-\epsilon)]$. And by writing it out, we have $\ln(C_1)+0.5\ln(C_{2,1})+0.5\ln(C_{2,2})+0.5\ln(C_{3,1})+0.5\ln(C_{3,2})+0.5\lambda_1(3Y-C_1-C_{2,1}-C_{3,1}+\epsilon)+0.5\lambda_2(3Y-C_1-C_{2,2}-C{3,2}-\epsilon)$. Then the FOCs are obtained by differentiate wrt $C_1,C_{2,1},C_{2,2},C_{3,1},C_{3,2}$ respectively?  
> **username_0**: Further, if we want to consider a situation where there's no way to borrow, so $S$ must all be non-negative, how should we solve this model? There should be a simpler intuitive way without using KKT?  

---

## 1 answers

### Answer by username_1 on 2024-06-04. Score: 1 | Accepted answer

The Lagrangian can be written as

$$L(C\_1,C\_{21},C\_{31},C\_{22},C\_{32},S\_1,S\_{21},S\_{22}) = p\_1 \times u(C\_1,C\_{21},C\_{31}) + p\_2 \times u(C\_1,C\_{22},C\_{32}) + \alpha(Y-C\_1-S\_{1}) + \lambda\_2(Y+\epsilon +S\_1 - C\_{21} - S\_{21}) + \lambda\_3(Y+S\_{21} - C\_{31}) + + \delta\_2(Y-\epsilon +S\_1 - C\_{22} - S\_{22}) + \delta\_3(Y+S\_{22} - C\_{32}),$$

For which the set of first-order conditions is

\begin{align}
\frac{\partial L}{\partial C\_{1}} &= p\_1 \frac{\partial U}{\partial C\_1} + p\_2 \frac{\partial U}{\partial C\_1} - \alpha = 0 \\ \frac{\partial L}{\partial C\_{21}} &= p\_1 \frac{\partial U}{\partial C\_{21}} - \lambda\_2 =0\\
\frac{\partial L}{\partial C\_{31}} &= p\_1 \frac{\partial U}{\partial C\_{31}} - \lambda\_3 =0\\ \frac{\partial L}{\partial C\_{21}} &= p\_2 \frac{\partial U}{\partial C\_{22}} - \delta\_2 =0\\
\frac{\partial L}{\partial C\_{32}} &= p\_2 \frac{\partial U}{\partial C\_{32}} - \delta\_3 =0\\
\frac{\partial L}{\partial S\_1} &= -\alpha + \lambda\_2 + \delta\_2=0\\
\frac{\partial L}{\partial S\_{21}} &= - \lambda\_2 + \lambda\_3 =0\\
\frac{\partial L}{\partial S\_{22}} &= - \delta\_2 + \delta\_3 =0.\\
\end{align}


---

