# Minimize and maximize the function $g(a,b) = a + b$ given the constraint $h(a,b) = \frac{1}{a} + \frac{1}{b} = 1$.

I want to minimize and maximize the function $g(a,b) = a + b$ given the constraint $h(a,b) = \frac{1}{a} + \frac{1}{b} = 1$, and I want to find the values of $a, b,$ and $\lambda$.

This is what I've done:

\begin{align} \frac{\partial g}{\partial a} = \lambda \frac{\partial h}{\partial a} \implies 1 = \lambda(-\frac{1}{a^2})\\\\ \frac{\partial g}{\partial b} = \lambda \frac{\partial h}{\partial b} \implies 1 = \lambda(-\frac{1}{b^2})\\ \end{align}

However, when I solve these two equations for $a$ and $b$, I end up with $a = b = \pm \sqrt{-\lambda}$.

I don't think I should be dealing with complex numbers for this problem. Therefore, should I just infer that $\lambda$ is a negative number, hence I'll be taking the square root of a positive number?

Furthermore, I'm finding after doing several of these Lagrange multiplier problems that there is no specific method to solve the resulting equations for, say, $x, y, z,$ and $\lambda$ (or, in this case, $a, b,$ and $\lambda$). What is the best way to solve this particular problem once I've found these partials?

Should I just use the following idea:

\begin{align} \lambda = -a^2 \ \text{and}\ \lambda = -b^2 \implies a = b \end{align}

Using this fact I get the following:

\begin{align} h= \frac{1}{a} + \frac{1}{a} = 1 \implies a = 2 \implies b = 2 \end{align}

Which would mean that $\lambda = -x^2 = -(2)^2 = -4$.

Therefore, for the values of $a, b,\ \text{and}\ \lambda$ I get $2, 2,\ \text{and}\ -4$, respectively.

If that's correct, then isn't my minimum $\textbf{and}$ maximum values for $g(a,b)$ given the constraint of $h(a,b)$ just $2 + 2 = 4$ in both cases?

Note: After doing this problem, I realized that I should have immediately had some intuition from the constraint function that $a$ and $b$ were $2$. However, what if $a = 0$ and $b = 1$?

• Note that there is no maximum. And $a$ is not allowed to be $0$. – André Nicolas Oct 5 '14 at 7:02
• Okay, I see why $a$ cannot be zero. That was a quick idea that I did not think through. However, how do you know there is no maximum? – eyeh8math Oct 5 '14 at 7:06
• for this problem there's no global maxima nor minima, what you've found are just the local minimum and the local maxima. – alethiologist Oct 5 '14 at 7:08
• If you allow negatives, there is no minimum either. For no max, pick $a=10000$, and $b=10000/9999$. Then $1/a+1/b=1$ but $a+b$ is big. – André Nicolas Oct 5 '14 at 7:09
• I thought $\lambda = -a^2 \ \text{and}\ \lambda = -b^2 \implies a = b$ would require me to pick the same values for $a$ and $b$. If so, your counterexample for there being a global maximum would not work. I suppose I was wrong in thinking that $a$ and $b$ must be the same? – eyeh8math Oct 5 '14 at 7:20

You can use basic calc 1 methods here as well rather than lagrange multipliers. Solve the constraint equation for one of the two variables, say $\frac 1 a=1-\frac 1 b$, so $\frac 1 a=\frac {b-1} b$, and thus $a=\frac b {b-1}$ Plugging that into the equation to be optimized, we get

$g(b)=b+\frac b {b-1}=b+\frac {b-1+1} {b-1}=b+1+\frac 1 {b-1}$

So, taking the derivative to look for critical points, we have $g'(b)=1-(b-1)^{-2}$=0. (the undefined point at b=1 we can throw away because b cannot be 1 and satisfy the constraint equation)

Thus, multiplying through, we get $0=(b-1)^2-1$,$1=(b-1)^2$,$\pm 1=b-1$, and finally $b=2$ or $b=0$. We can't have b be 0 and meet the constraint constraint equation, so our only critical point is at b=2.

Testing the derivative, we see for $b<2$,$g'(b)<0$ and for $b>2,g'(b)>0$, so we have a local minimum. This will be a global minimum if we stay in the first quadrant, as above you see that you will have no global minimum if you allow negative numbers. Plugging into the constraint gives you $a=2$ and a minimal value of 4.

(Same results, but perhaps a bit clearer)

• what if it is a saddle point? – hamster on wheels Aug 5 '17 at 2:57

The constraint

$$\frac{1}{a} + \frac{1}{b} = 1$$

means that

$$a + b = ab.$$

By the Arithmetic Mean-Geometric Mean (AM-GM) Inequality:

$$a + b \geq 2\sqrt{ab},$$

so that

$$ab \geq 2\sqrt{ab}.$$

In other words,

$$\sqrt{a + b} = \sqrt{ab} \geq 2.$$

This gives the minimal value:

$$a + b \geq 4,$$

where equality occurs if and only if $a = b = 2$.

Note that the AM-GM Inequality applies only if $a > 0$ and $b > 0$.