# Convexity of $x\left(1+\frac1x\right)^x,\ x\ge 0$

This may turn out to be really simple but I do not see a quick way to the proof. How would one show $\displaystyle x\Big(1+\frac1x\Big)^x,\ x\ge 0$ is convex?

I derived the second derivative. It has a negative term. I suppose I could combine certain terms to make the negativeness disappear. But I hope there is a really clever way to see it right away.

• wouldn't it be simpler to show that $\log(f(x))$ is convex? this implies naturally thee convexity of $f(x)$ – tired Jan 25 '17 at 11:18
• en.wikipedia.org/wiki/Logarithmically_convex_function – tired Jan 25 '17 at 11:31
• @tired, In here, $\log (f(x))$ is not convex. – Alex Silva Jan 25 '17 at 14:06

The following answer is an compose of the comment of tired under the original question and the answer of Michael Rozenberg. The quickest way at the end of the remark.

Lemma 1. If $f(x)$ for $x>0$ is convex and twice differentiable, then $xf(\frac{1}{x})$ is convex for $x>0$.

Proof. By a direct calculation $\dfrac{\mathrm{d}^2 (x f(\frac{1}{x}))}{\mathrm{d} x^2} = \dfrac{f''\Big(\dfrac{1}{x}\Big)}{x^3}$. QED

Lemma 2. Let $f(x)$ be twice differentiable and positive for $x>0$. If $\ln f(x)$ is convex, then $f(x)$ is convex.

Proof. By a direct calculation $\dfrac{\mathrm{d}^2 \ln f(x)}{\mathrm{d} x^2} = \dfrac{f(x)f''(x)-[f'(x)]^2}{f^2(x)}$, and by noticing that $\ln f(x)$ is convex, we get $$\dfrac{f(x)f''(x)-[f'(x)]^2}{f^2(x)} \ge 0.$$ Since $f(x)$ is positive, $$f''(x) \ge \dfrac{[f'(x)]^2}{f(x)}\ge 0.$$ QED

Proof of the convexity of $x(1+1/x)^x$. By Lemma 1, we only need to show that $g(x)=(1+x)^{1/x}$ is convex. Then by Lemma 2, it is sufficient to prove that $\ln g(x) = \frac{1}{x}\ln (1+x)$ is convex.

Since $$\dfrac{\mathrm{d}^2 \ln g(x)}{\mathrm{d} x^2} = \frac{2 (x+1)^2 \log (x+1)-x (3 x+2)}{x^3 (x+1)^2},$$ we need to prove that $$\log (x+1)-\frac{x (3 x+2)}{2 (x+1)^2}>0,$$ which can be easily followed from $$\dfrac{\mathrm{d} \Bigl(\log (x+1)-\frac{x (3 x+2)}{2 (x+1)^2}\Bigr)}{\mathrm{d} x} = \frac{x^2}{(x+1)^3} > 0$$ and $\lim\limits_{x\to 0^+}\Big[\log (x+1)-\frac{x (3 x+2)}{2 (x+1)^2}\Big] = 0$. QED

Remark. For Lemma 1 see Convex function calculus,i.e.,

If $f(x)$ is convex, then its perspective $\displaystyle > g(x,t)=tf\Big(\frac{x}{t}\Big)$ (whose domain is ${\displaystyle > \left\lbrace (x,t)\big|{\tfrac {x}{t}}\in {\text{Dom}}(f),t>0\right\rbrace > } \left\lbrace (x,t)\big|{\tfrac {x}{t}}\in > {\text{Dom}}(f),t>0\right\rbrace )$ is convex.

It seems that the above lemma is from probability which I do not familiar with. So I show Lemma 1 instead. And for Lemma 2 see https://en.wikipedia.org/wiki/Logarithmically_convex_function. If the problem comes from a textbook, I think the above is a clever way. If it comes from a real research, Michael Rozenberg's answer is good enough. However, the most cunning way, which will return the result less then 1 second, I found is to type the following code in Mathematica:

Minimize[{D[x (1 + 1/x)^x, {x, 2}], x > 0}, x]

• I just differentiated twice. I think, there is a mistake in your computations. – Michael Rozenberg Jan 25 '17 at 17:34
• Most of calculations are by Mathematica， and I copied the outputs from the notebook. Could you show me which line is wrong？ – wangtwo Jan 25 '17 at 17:39
• @MichaelRozenberg I'm happy to have enough reputations to add a comment. Wang's proof is so cool, then it can not be wrong ;-) – wangtwo Jan 25 '17 at 17:49
• I did not like $\ln(x+1)>\frac{x(3x+2)}{2(x+1)^2}$ – Michael Rozenberg Jan 25 '17 at 17:52
• I did not like $\ln (x+1) > \frac{x(3x+2)}{2(x+1)^2}$ and $\ln (1+1/x) > \frac{\sqrt{x^2+3x+1}-1}{x(x+1)}$ both. But they are correct bothly. – wangtwo Jan 25 '17 at 18:07

Let $f(x)=x\left(1+\frac{1}{x}\right)^x$, where $x>0$.

Hence, $$f''(x)=\frac{\left(1+\frac{1}{x}\right)^x\left(x(x+1)^2\ln^2\left(1+\frac{1}{x}\right)+2(x+1)\ln\left(1+\frac{1}{x}\right)-x-3\right)}{(x+1)^2}.$$ Thus, we need to prove that $$\ln\left(1+\frac{1}{x}\right)>\frac{\sqrt{x^2+3x+1}-1}{x(x+1)}.$$ Let $g(x)=\ln\left(1+\frac{1}{x}\right)-\frac{\sqrt{x^2+3x+1}-1}{x(x+1)}.$

Hence, $$g'(x)=\frac{2x^3+9x^2+7x+2-2\sqrt{(x^2+3x+1)^3}}{2x^2(x+1)^2\sqrt{x^2+3x+1}}=$$ $$=-\frac{11x^3+46x^2+35x+8}{2x(x+1)^2\sqrt{x^2+3x+1}\left(2x^3+9x^2+7x+2+2\sqrt{(x^2+3x+1)^3}\right)}<0,$$ which says that $g(x)>\lim\limits_{x\rightarrow+\infty}g(x)=0$ and we are done!

• Nice proof. +1. Perseverance in calculation pays off. :-) – Hans Jan 26 '17 at 17:41

I just want to add to the elegant proof of @wangtwo, and remedy the only blemish of an ugly proof of the convexity of $\frac{\ln(1+x)}x$ in a piece of otherwise perfect work. Here is an elegant replacement. $$\frac{\ln(1+x)}x=\int_0^1 \frac1{1+xt}dt$$ is convex since the integrand is convex with respect to $x$.

• @Hans Your proof is very nice, and I want gain more information from your proof. So I search for "parameter integral convex function", and found a treasure that is Stephen Boyd and Lieven Vandenberghe's textbook Convex Optimization (Cambridge University Press, Cambridge, 2004. xiv+716 pp. ISBN: 0-521-83378-7). The pdf version of book can be downloaded from Prof. Boyd's homepage web.stanford.edu/~boyd/cvxbook. In page 79 of the book, the authors introduce a similar idea as your post in math.stackexchange.com/q/2593913/64809 – wangtwo Jan 15 '18 at 2:14
• All I learned is the following: Though convexity is an elementary concept in the first year calculus, it is much better to read an advanced textbook before proving convexity. – wangtwo Jan 15 '18 at 2:17
• @wangtwo: Thank you for the book reference. It is indeed a treasure. I agree with your sentiment. It is the kind of concept that is simple yet has many variations and applications that is the most profound. – Hans Jan 15 '18 at 7:13