# find max and min of: $f(x_1, x_2 ) = \ln(x_1) + \ln(x_2) - 2x_1-2x_2$?

I need to find max and min (if they exist) of the following function: $$f(x_1,x_2) = \ln(x_1) + \ln(x_2) - 2x_1-2x_2$$

On the set $$C = \{(x_1, x_2) ∈ R^2: x_1 \geq 1, x_2\geq 1, x_1+x_2 \leq 4\}.$$

I have checked that the Lagrange theorem assumptions hold, so that I can find the critical points solving the following system of equation:

$$\frac{1}{x_1}-2+\lambda_1 -\lambda_3=0$$

$$\frac{1}{x_2}-2+\lambda_2 -\lambda_3=0$$

$$\lambda_1(-x_1+1)=0$$

$$\lambda_2(-x_2+1)=0$$

$$\lambda_3(x_1+x_2-4)=0$$

$$-x_1\leq -1, -x_2\leq -1, x_1+x_2\leq 4$$

What is the best way to proceed, given that I would like to solve the problem via Lagrange first order conditions?

Concentrate on the third and fourth equations. There are several possibilities:

• $$x_1=x_2=1$$. This gives $$(1,1)$$, where $$f(x_1,x_2) = -4$$.
• $$\lambda_1=0$$, $$x_2=1$$. The last equation forces either $$x_1=3$$, giving the point $$(3,1)$$ with $$f(x_1,x_2) = -8 + \ln 4$$, or else $$\lambda_3=0$$. But if $$\lambda_3=0$$, then from the first equation, $$\frac{1}{x_1} - 2 = 0$$ so that $$x_1 = \frac{1}{2}$$, which is impossible. Thus from this case we get $$(3,1)$$, $$f(3,1) = -8 + \ln 3$$.
• $$\lambda_2 = 0$$, $$x_1=1$$. This is similar to the previous case, and gives the point $$(1,3)$$ with $$f(1,3) = -8 + \ln 3$$.
• $$\lambda_1 = \lambda_2 = 0$$. If $$\lambda_3=0$$ as well, then (from the first two equations) $$x_1=x_2 = \frac{1}{2}$$, which is impossible. Thus, $$\lambda_3\ne 0$$, and the first, second, and last equations together give $$x_1 = x_2 = 2$$, so we get $$(2,2)$$ with $$f(2,2) = -8 + \ln 4$$.

The last solution is extraneous, so that $$f$$ achieves a minimum of $$-4$$ and $$(1,1)$$ and a maximum of $$-8 + \ln 3$$ at $$(1,3)$$ and $$(3,1)$$.

• Thank you for your answer, which is really clear. Only one question: why in the last case do you say that we may assume that $\lambda_3 \neq 1$? – LearningProb Jan 12 at 16:05
• My bad, see edit for fix. – rogerl Jan 13 at 1:37
• Thank you. I really have the last question: is it really necessary to focus on both 3) and 4)? I think it would be enough to focus on the third equation for example, splitting between $\lambda_1=0$ or $x_1=0$ and then this would be enough to get all possibilities. Am I correct? – LearningProb Jan 13 at 11:49
• Perhaps. I haven't worked it out. But if you have a path using only that equation, go for it. – rogerl Jan 13 at 15:37

Actually there is no need for Lagrange multipliers. In order to minimize/maximize $$\log(x y)-2(x+y)$$ over the triangle $$x,y\geq 1,x+y\leq 4$$ it is enough to consider $$\log(x(s-x))-2s$$ for a fixed $$s\in[2,4]$$ and for $$x$$ ranging from $$1$$ to $$s-1$$. This function shares its stationary points with $$x(s-x)$$, so the maximum is attained at $$x=y$$ and the minimum at $$x=1$$ or $$y=1$$. Considering $$x=y$$ we have to maximize $$2\log(x)-4x$$ over $$x\in[1,2]$$, and this is a decreasing function, since it has a negative derivative. Considering $$x=1$$ we have to minimize $$\log(y)-2y-2$$ over $$y\in[1,3]$$: this is a decreasing function too. Summarizing, the maximum of $$\log(xy)-2(x+y)$$ over the given triangle occurs at $$(1,1)$$ and the points of minimum are $$(1,3)$$ and $$(3,1)$$.