# Finding the maximum value of a function

Let $a,b>0$, $$f(x)=\dfrac{xa+(1-x)b}{a^xb^{1-x}},\quad x\in [0, 1].$$ What is the maximum of $f(x)$?

I tried to find the derivative of $f(x)$, which is $$f'(x)=\left(\frac{a}{b}\right)^{1-x}\left(1-x\ln \frac{a}{b}\right)+\left(\frac{b}{a}\right)^{x}\left((1-x)\ln \frac{b}{a}-1\right).$$ It seems difficult to find the critical points of $f(x)$.

-
The expression $(a/b)^xf'(x)$ being an affine function of $x$, to find the location of the maximum seems straightforward. – Did Jul 24 '11 at 22:23

## 2 Answers

It is natural to take the logarithm, but we do not have to. Here is an informative first step. Let $b=ca$. If we substitute $ca$ for $b$ in our expression, after a small amount of calculation we obtain $$\frac{cx+(1-x)}{c^x}.$$ This is useful, and not only as a simplifying device: It tells us that only the ratio $b/a$ matters.

Differentiation is straightforward: We get $$\frac{c^x(c-1)-(cx+ 1-x)(\ln c)c^x}{c^{2x}}.$$ The sign of the derivative is determined by the sign of $$(c-1)-(cx+1-x)\ln c.$$

Added: Suppose that $a \ne b$. We show that the maximum does not occur at an endpoint. By interchanging the roles of $a$ and $b$ if necessary, we can assume without loss of generality that $c>1$.

Let $g(x)=(c-1)-(cx+1-x)\ln c$. For $x$ positive but very close to $0$, $g(x)\approx -1-\ln c$. But from the Taylor expansion of $\ln(1+t)$, or otherwise, it is easy to see that $\ln(c)<c-1$ when $c-1$ is positive, so $g(x)$ is positive when $x$ is close enough to $0$. A similar argument shows that $g(x)$ is negative when $x$ is close enough to $1$. Thus the maximum occurs in the open interval $(0,1)$. In particular, the unique $x$ at which $(c-1)-(cx+1-x)\ln c=0$ is in the interior of $[0,1]$.

-
Thanks for a different argument. Let $0<A\le a,b\le B$, is it true $f(x)\le \frac{A+B}{2\sqrt{AB}}$? I now find it hard to prove this in terms of finding the maximum of $f(x)$. – Sunni Jul 25 '11 at 13:12
@Sunni: A bit of experimentation seems to show it is plausible. No proof yet! – André Nicolas Jul 25 '11 at 23:12

HINT: (Answering the original question: Where are the critical points of the function) It is enough to maximize $g(t)$, where $$g(t) := \ln f(t) = \ln(at + (1-t)b) - t \ln a - (1-t) \ln b$$

Now,

$$g'(t) = \frac{a-b}{at + (1-t)b} - \ln a + \ln b$$

and hence, $g'(t) = 0$, when

\begin{align} \frac{a-b}{at + (1-t)b} = \ln (a/b) \end{align}

(and so on...)

-
A typo... I am asking the maximum of $f(x)$...Now I am sure that $1/2$ is not a critical point. – Sunni Jul 24 '11 at 22:40
DJC, I went ahead and corrected a minor typo in the last equation; hope that's ok :) Added: Ah, I don't have edit privileges, so the typo will persist till someone approves it... – Srivatsan Jul 24 '11 at 22:59
@Srivatsan: That's great with me! – JavaMan Jul 24 '11 at 23:00