<p>This is the problem we want to solve:</p>
<p><span class="math-container">\begin{eqnarray*} \max_{x_1, x_2} &amp; x_1 +\ln x_2 \\ \text{s.t.} &amp; \ p_1 x_1 + p_2x_2 \leq w \\ \text{and} &amp; \ x_1\geq 0, x_2&gt;0 \end{eqnarray*}</span></p>
<p>Here <span class="math-container">$w&gt;0$</span>, <span class="math-container">$p_1&gt;0$</span> and <span class="math-container">$p_2&gt;0$</span>.</p>
<p>First set up the Lagrangian function:</p>
<p><span class="math-container">$\mathcal{L}(x_1, x_2)= x_1 +\ln x_2 - \lambda(p_1 x_1 + p_2x_2 - w) + \mu_1x_1$</span></p>
<p>First-order necessary conditions are:</p>
<p><span class="math-container">$\dfrac{\partial\mathcal{L}}{\partial x_1} = 1 - \lambda p_1 + \mu_1 = 0$</span></p>
<p><span class="math-container">$\dfrac{\partial\mathcal{L}}{\partial x_2} = \dfrac{1}{x_2} - \lambda p_2 = 0$</span></p>
<p><span class="math-container">$p_1 x_1 + p_2x_2 \leq w, \ \lambda \geq 0, \ \lambda(p_1 x_1 + p_2x_2 - w) = 0$</span></p>
<p><span class="math-container">$x_1 \geq 0, \ \mu_1 \geq 0, \ \mu_1x_1 = 0$</span></p>
<p><span class="math-container">$x_2&gt;0$</span></p>
<p>Since <span class="math-container">$\mathcal{L}$</span> is concave, if <span class="math-container">$(x_1^d, x_2^d)$</span> satisfies the first-order conditions, it is also a solution of the utility maximization problem.</p>
<p>Solving the above system we get the optimal values of <span class="math-container">$x_1^d$</span>, <span class="math-container">$x_2^d$</span>as:</p>
<p><span class="math-container">\begin{eqnarray*} (x_1^d, x_2^d)(p_1, p_2, w)=\begin{cases} \left(\frac{w-p_1}{p_1},\frac{p_1}{p_2}\right) &amp; \text{if } p_1 \leq w \\ \left(0,\frac{w}{p_2}\right) &amp; \text{if } p_1 &gt; w \end{cases}  \end{eqnarray*}</span></p>
<hr />
<p><em>Added Later</em></p>
<p>This is how we can solve the following system:</p>
<p><span class="math-container">$\dfrac{\partial\mathcal{L}}{\partial x_1} = 1 - \lambda p_1 + \mu_1 = 0$</span></p>
<p><span class="math-container">$\dfrac{\partial\mathcal{L}}{\partial x_2} = \dfrac{1}{x_2} - \lambda p_2 = 0$</span></p>
<p><span class="math-container">$p_1 x_1 + p_2x_2 \leq w, \ \lambda \geq 0, \ \lambda(p_1 x_1 + p_2x_2 - w) = 0$</span></p>
<p><span class="math-container">$x_1 \geq 0, \ \mu_1 \geq 0, \ \mu_1x_1 = 0$</span></p>
<p><span class="math-container">$x_2&gt;0$</span></p>
<p>Based on the above system, we can divide it into the following
possibilities for the solution:</p>
<ul>
<li><span class="math-container">$p_1 x_1 + p_2x_2 &lt; w$</span> This would imply that <span class="math-container">$\lambda = 0$</span>, but that would mean that <span class="math-container">$\mu_1=-1$</span> which is not consistent with the system. So, there is no solution to the above system where <span class="math-container">$p_1 x_1 + p_2x_2 &lt; w$</span>.</li>
<li><span class="math-container">$p_1 x_1 + p_2x_2 = w$</span> In this case there are two possibilities:
<span class="math-container">$x_1&gt;0$</span> and the other is <span class="math-container">$x_1=0$</span>. Both of them are possible depending on the values of <span class="math-container">$p_1$</span>, <span class="math-container">$p_2$</span> and <span class="math-container">$w$</span>:</li>
</ul>
<p>For the case of <span class="math-container">$x_1&gt;0$</span>, we get <span class="math-container">$\mu_1=0$</span>, and that would imply that <span class="math-container">$\lambda=\frac{1}{p_1}$</span>. So, <span class="math-container">$x_2=\frac{p_1}{p_2}$</span> and the corresponding value of <span class="math-container">$x_1= \frac{w-p_1}{p_1}$</span>. Clearly, this is the only solution to the above system when <span class="math-container">$p_1&lt; w$</span>.</p>
<p>For the case of <span class="math-container">$x_1=0$</span>, <span class="math-container">$x_2= \frac{w}{p_2}$</span> and the corresponding value of <span class="math-container">$\lambda=\frac{1}{w}$</span> and therefore, <span class="math-container">$\mu_1 = \frac{p_1-w}{p_1}$</span>. Clearly, this is the only solution to the above system when <span class="math-container">$p_1 \geq w$</span>.</p>
<hr />
<p>To see how to solve a similar problem with <span class="math-container">$u(x, y) = 2\sqrt{x} + y$</span>, you may refer to: <a href="https://youtu.be/l8vHgCv70h0" rel="nofollow noreferrer">https://youtu.be/l8vHgCv70h0</a></p>
<p>Related posts (Alternative way of finding demand for <span class="math-container">$u(x, y) = 2\sqrt{x} + y$</span>): <a href="https://qr.ae/pGJuvH" rel="nofollow noreferrer">https://qr.ae/pGJuvH</a></p>

CC BY-SA 4.0
2022-05-27T07:03:47.067Z
Thank you very much for the detailed answer. The examples were also very helpful. Essentially, solving with KKT conditions involves trying out different cases and finding out the ones in which the system holds true. 

I should probably open a new post about this, but would you happen to know if this problem can be solved with non-linear/linear programming?
Additionally, what if I end up with multiple solutions within the same domain, like in the case of u(x1,x2)=x1^2+x2^2 with a corner solution? Should I evaluate all three and take the max for a utility, or is there a more rigorous method?
Victor Yerz
CC BY-SA 4.0
2022-05-27T09:11:58.973Z
Most welcome. The objective function is non-linear, so it is not a linear programming problem. KT Method discussed in this answer is a way to solve non-linear programming problems (including the other ways you saw). For solving a utility maximisation problem with $u = x_1^2+x_2^2$, the quick way is using the graph, but if you want to see the K-T method then you can refer to this: https://youtu.be/eFe25HVJSWg Since K-T conditions are no longer sufficient for the optimum when the objective function is $u = x_1^2+x_2^2$, you may get more solutions to the K-T conditions including the optimal one.
Amit
CC BY-SA 4.0
2022-05-26T19:07:32.797Z
2022-05-27T01:52:22.063Z
2022-05-27T01:52:22.063Z
Amit
<p>In the <a href="https://economics.stackexchange.com/questions/24713/concave-utility-functions-corner-solution-explanation">following post</a> an example is given of the corner solution for a concave utility function. I tried solving it but got stuck. I have no idea how these types of problems are solved so if you could please point me in the right direction.</p>
<p>Here's my work so far:</p>
<p><span class="math-container">$U(x_1, x_2)=x_1+\ln(x_2)$</span></p>
<p>s.t.</p>
<p><span class="math-container">$x_1p_1+x_2p_2\leq w$</span></p>
<p><span class="math-container">$x_1\geq0;\; x_2\geq0$</span></p>
<p><span class="math-container">\begin{alignat*}{3} % #1
L(x_1, x_2,x_3,&amp;\lambda,\mu_1,\mu_2)=x_1+\ln(x_2) +\\
+&amp;\lambda[w-(x_1p_1+x_2p_2)]+\mu_1x_1+\mu_2x_2
\end{alignat*}</span></p>
<p><span class="math-container">$\frac{\partial L}{\partial x_1}=1-\lambda p_1+\mu_1 \leq 0$</span></p>
<p><span class="math-container">$\frac{\partial L}{\partial x_2}=\frac{1}{x_2}-\lambda p_2+\mu_2 \leq 0$</span></p>
<p><span class="math-container">$\frac{\partial L}{\partial \lambda}=w-(x_1p_1+x_2p_2) \leq 0$</span></p>
<p><span class="math-container">$\frac{\partial L}{\partial \mu_1}=x_1 \leq 0$</span></p>
<p><span class="math-container">$\frac{\partial L}{\partial \mu_2}=x_2 \leq 0$</span></p>
<p>Assuming the top constraints are binding. We can say:</p>
<p><span class="math-container">$\lambda = \frac{1+\mu_1}{p_1}$</span></p>
<p><span class="math-container">$\lambda = \frac{\frac{1}{x_2}+\mu_2}{p_2}$</span></p>
<p><span class="math-container">$\frac{p_2(1+\mu_1)}{p_1}=\frac{1}{x_2}+\mu_2$</span></p>
<p><span class="math-container">$\frac{p_2+p_2\mu_1-\mu_2p_1}{p_1}=\frac{1}{x_2}$</span></p>
<p><span class="math-container">$x_2=\frac{p_1}{p_2+p_2\mu_1-\mu_2p_1}$</span></p>
<p>putting this into the budget constraint I get:</p>
<p><span class="math-container">$x_1p_1+\frac{p_1p_2}{p_2+p_2\mu_1-\mu_2p_1}=w$</span></p>
<p><span class="math-container">$x_1=\frac{w}{p_1}-\frac{p_2}{p_2+p_2\mu_1-\mu_2p_1}$</span></p>
<p><span class="math-container">$x_2=\frac{p_1}{p_2+p_2\mu_1-\mu_2p_1}$</span></p>
<p>when <span class="math-container">$p_2\mu_1-\mu_2p_1$</span> is equal to 0 I get the solution for <span class="math-container">$w&gt;p_1$</span>, but I have no idea how they got the second half. So this is where I got stuck. Many thanks in advance to the math experts.</p>

CC BY-SA 4.0
2022-05-27T02:37:53.637Z
An alternative way to solve this problem is posted here: https://qr.ae/pvYE8Q
Amit
<microeconomics><utility><optimization><lagrangian>
Concave utility functions solution example
Victor Yerz
# Concave utility functions solution example

(Asked by: username_0 on 2022-05-26)

In the [following post](https://economics.stackexchange.com/questions/24713/concave-utility-functions-corner-solution-explanation) an example is given of the corner solution for a concave utility function. I tried solving it but got stuck. I have no idea how these types of problems are solved so if you could please point me in the right direction.

Here's my work so far:

$U(x\_1, x\_2)=x\_1+\ln(x\_2)$

s.t.

$x\_1p\_1+x\_2p\_2\leq w$

$x\_1\geq0;\; x\_2\geq0$

\begin{alignat\*}{3} % #1
L(x\_1, x\_2,x\_3,&\lambda,\mu\_1,\mu\_2)=x\_1+\ln(x\_2) +\\
+&\lambda[w-(x\_1p\_1+x\_2p\_2)]+\mu\_1x\_1+\mu\_2x\_2
\end{alignat\*}

$\frac{\partial L}{\partial x\_1}=1-\lambda p\_1+\mu\_1 \leq 0$

$\frac{\partial L}{\partial x\_2}=\frac{1}{x\_2}-\lambda p\_2+\mu\_2 \leq 0$

$\frac{\partial L}{\partial \lambda}=w-(x\_1p\_1+x\_2p\_2) \leq 0$

$\frac{\partial L}{\partial \mu\_1}=x\_1 \leq 0$

$\frac{\partial L}{\partial \mu\_2}=x\_2 \leq 0$

Assuming the top constraints are binding. We can say:

$\lambda = \frac{1+\mu\_1}{p\_1}$

$\lambda = \frac{\frac{1}{x\_2}+\mu\_2}{p\_2}$

$\frac{p\_2(1+\mu\_1)}{p\_1}=\frac{1}{x\_2}+\mu\_2$

$\frac{p\_2+p\_2\mu\_1-\mu\_2p\_1}{p\_1}=\frac{1}{x\_2}$

$x\_2=\frac{p\_1}{p\_2+p\_2\mu\_1-\mu\_2p\_1}$

putting this into the budget constraint I get:

$x\_1p\_1+\frac{p\_1p\_2}{p\_2+p\_2\mu\_1-\mu\_2p\_1}=w$

$x\_1=\frac{w}{p\_1}-\frac{p\_2}{p\_2+p\_2\mu\_1-\mu\_2p\_1}$

$x\_2=\frac{p\_1}{p\_2+p\_2\mu\_1-\mu\_2p\_1}$

when $p\_2\mu\_1-\mu\_2p\_1$ is equal to 0 I get the solution for $w>p\_1$, but I have no idea how they got the second half. So this is where I got stuck. Many thanks in advance to the math experts.

**Tags:** microeconomics, utility, optimization, lagrangian
> **Comments:**
> **username_1**: An alternative way to solve this problem is posted here: https://qr.ae/pvYE8Q  

---

## 1 answers

### Answer by username_1 on 2022-05-26. Score: 5 | Accepted answer

This is the problem we want to solve:

\begin{eqnarray\*} \max\_{x\_1, x\_2} & x\_1 +\ln x\_2 \\ \text{s.t.} & \ p\_1 x\_1 + p\_2x\_2 \leq w \\ \text{and} & \ x\_1\geq 0, x\_2>0 \end{eqnarray\*}

Here $w>0$, $p\_1>0$ and $p\_2>0$.

First set up the Lagrangian function:

$\mathcal{L}(x\_1, x\_2)= x\_1 +\ln x\_2 - \lambda(p\_1 x\_1 + p\_2x\_2 - w) + \mu\_1x\_1$

First-order necessary conditions are:

$\dfrac{\partial\mathcal{L}}{\partial x\_1} = 1 - \lambda p\_1 + \mu\_1 = 0$

$\dfrac{\partial\mathcal{L}}{\partial x\_2} = \dfrac{1}{x\_2} - \lambda p\_2 = 0$

$p\_1 x\_1 + p\_2x\_2 \leq w, \ \lambda \geq 0, \ \lambda(p\_1 x\_1 + p\_2x\_2 - w) = 0$

$x\_1 \geq 0, \ \mu\_1 \geq 0, \ \mu\_1x\_1 = 0$

$x\_2>0$

Since $\mathcal{L}$ is concave, if $(x\_1^d, x\_2^d)$ satisfies the first-order conditions, it is also a solution of the utility maximization problem.

Solving the above system we get the optimal values of $x\_1^d$, $x\_2^d$as:

\begin{eqnarray\*} (x\_1^d, x\_2^d)(p\_1, p\_2, w)=\begin{cases} \left(\frac{w-p\_1}{p\_1},\frac{p\_1}{p\_2}\right) & \text{if } p\_1 \leq w \\ \left(0,\frac{w}{p\_2}\right) & \text{if } p\_1 > w \end{cases} \end{eqnarray\*}

---

*Added Later*

This is how we can solve the following system:

$\dfrac{\partial\mathcal{L}}{\partial x\_1} = 1 - \lambda p\_1 + \mu\_1 = 0$

$\dfrac{\partial\mathcal{L}}{\partial x\_2} = \dfrac{1}{x\_2} - \lambda p\_2 = 0$

$p\_1 x\_1 + p\_2x\_2 \leq w, \ \lambda \geq 0, \ \lambda(p\_1 x\_1 + p\_2x\_2 - w) = 0$

$x\_1 \geq 0, \ \mu\_1 \geq 0, \ \mu\_1x\_1 = 0$

$x\_2>0$

Based on the above system, we can divide it into the following
possibilities for the solution:

* $p\_1 x\_1 + p\_2x\_2 < w$ This would imply that $\lambda = 0$, but that would mean that $\mu\_1=-1$ which is not consistent with the system. So, there is no solution to the above system where $p\_1 x\_1 + p\_2x\_2 < w$.
* $p\_1 x\_1 + p\_2x\_2 = w$ In this case there are two possibilities:
  $x\_1>0$ and the other is $x\_1=0$. Both of them are possible depending on the values of $p\_1$, $p\_2$ and $w$:

For the case of $x\_1>0$, we get $\mu\_1=0$, and that would imply that $\lambda=\frac{1}{p\_1}$. So, $x\_2=\frac{p\_1}{p\_2}$ and the corresponding value of $x\_1= \frac{w-p\_1}{p\_1}$. Clearly, this is the only solution to the above system when $p\_1< w$.

For the case of $x\_1=0$, $x\_2= \frac{w}{p\_2}$ and the corresponding value of $\lambda=\frac{1}{w}$ and therefore, $\mu\_1 = \frac{p\_1-w}{p\_1}$. Clearly, this is the only solution to the above system when $p\_1 \geq w$.

---

To see how to solve a similar problem with $u(x, y) = 2\sqrt{x} + y$, you may refer to: <https://youtu.be/l8vHgCv70h0>

Related posts (Alternative way of finding demand for $u(x, y) = 2\sqrt{x} + y$): <https://qr.ae/pGJuvH>

> **Comments:**
> **username_0**: Thank you very much for the detailed answer. The examples were also very helpful. Essentially, solving with KKT conditions involves trying out different cases and finding out the ones in which the system holds true.   I should probably open a new post about this, but would you happen to know if this problem can be solved with non-linear/linear programming? Additionally, what if I end up with multiple solutions within the same domain, like in the case of u(x1,x2)=x1^2+x2^2 with a corner solution? Should I evaluate all three and take the max for a utility, or is there a more rigorous method?  
> **username_1**: Most welcome. The objective function is non-linear, so it is not a linear programming problem. KT Method discussed in this answer is a way to solve non-linear programming problems (including the other ways you saw). For solving a utility maximisation problem with $u = x_1^2+x_2^2$, the quick way is using the graph, but if you want to see the K-T method then you can refer to this: https://youtu.be/eFe25HVJSWg Since K-T conditions are no longer sufficient for the optimum when the objective function is $u = x_1^2+x_2^2$, you may get more solutions to the K-T conditions including the optimal one.  

---

