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)$. 
 A: 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]$.
A: 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...)
