# Show that $x \cdot f(x)$ is convex

Given a function: $$f: (0,\infty)\to\mathbb{R}$$ I need to show that $$xf(x)$$ is convex if and only if $$f\left(\frac{1}{x}\right)$$ is convex

I'm not sure how to approach this type of problems, convexity isn't my thing.

Any help and hints will be appreciated

• You might want to look at information on the perspective of a function. – Michael Grant Mar 1 '18 at 21:19
• My teacher might not be satisfied with that, all we know (and therefore we can use) is a definition of convexity and fact that f(x) is convex when f''(x)>0. – Igor Mar 1 '18 at 21:32
• That's too bad, particularly since it's not necessary for a function to be differentiable to be convex. – Michael Grant Mar 1 '18 at 21:40

I will assume $f$ is twice differentiable since it you're only given convexity if $f''(x)\ge 0$, but as others have mentioned, differentiability is not needed in general.
I'll show one direction, and hopefully you can follow the same sort of idea for the other.

Since $f(1/x)$ is convex, $[f(1/x)]''\ge0$, i.e. $$[f(1/x)]'' = \frac{2}{x^3}f'(1/x) + \frac{1}{x^4}f''(1/x) \ge 0$$ (make sure you check this computation). this tells us that $\frac 1 x f''(1/x) \ge - 2f'(1/x)$. If $x>0$, so is $1/x$, so we may replace $x$ with $1/x$ in this computation and see that $$xf''(x) \ge -2f'(x).$$

Next, we can compute the second derivative of $xf(x)$ which is $2f'(x) + xf''(x)$, and by the above, we see $$2f'(x)+xf''(x) \ge 2f'(x)-2f'(x) = 0,$$ which proves convexity of $xf(x)$. The other direction is nearly identical, and you should be able to carry it out on your own if you understood this one.

As a start, you might want to consider the perspective function $f: \mathbb{R}^n \to \mathbb{R}^{n-1}$ where $f(\mathbf{x},t) = \mathbf{x}/t$ for $\mathbf{x} \in \mathbb{R}^n, t>0$. Here's a nice reference.

While your teacher is silly for telling you that the definition of convexity is that its second derivative is positive, IF you erroneously take that definition the problem can be solved like this:

First, a basic result:

Suppose $h:(0, \infty) \rightarrow \mathbb{R}$ is a function and for all $x$ in the domain, we have that $h(x) > 0$. Then it is true for all $x$ that $h(1/x) > 0$.

That shouldn't be hard to justify to yourself. Now for the real problem.

Let $F(x) = xf(x)$ and $G(x) = f(1/x)$. Let's look at the second derivatives of these functions. Using basic calculus we find: \begin{align} F''(x) & = 2f'(x) + x f''(x) \\ G''(x) &= \frac{1}{x^4} \big [ f''(1/x) + 2xf'(1/x) \big ] \end{align}

Notice that these expressions look pretty similar, but we can make them look even more similar as follows: \begin{align} G''(x) &= \frac{1}{x^4} \big [ f''(1/x) + 2xf'(1/x) \big ] \\ &= \frac{1}{x^3} \left [ \frac{1}{x} f''(1/x) + 2f'(1/x) \right ] \\ & = u^3 \big [ u f''(u) + 2f'(u) \big ] \end{align} where we substituted $u = 1/x$ in the last line. But notice that since our domain is $x \in (0 , \infty)$, we know that $u$ (and hence $u^3$) is always positive! Thus, we have that:

$$G''(x) = u^3 F''(u)$$

and $u^3$ is positive over the entire domain.

But notice that in the case that $F''(x) >0$ everywhere in the domain, we can apply our basic result from the beginning to $F''(u) = F''(1/x)$ and find that $G''(x) > 0$ everywhere as well (since $u^3 > 0$). Similarly, since $1/u = x$, in the event that $G''(x) >0$ over the entire domain, we can again apply our basic result and find $F''(x) > 0$ everywhere as well.

Therefore, $G''(x) > 0$ everywhere on $(0, \infty)$ if an only if $F''(x) > 0$ everywhere on $(0, \infty)$ as well. This is your teacher's bad definition of convexity.

There is a simple answer to this if you the old fashioned definition of convexity : f is convex if $f(x)=\sup \{ax+b:(a,b) \in E\}$ for some set of pairs E. [A convex function is one whose graph is an upper envelope of straight lines]. Today's definition of convexity is equivalent to this. If you assume this you simply have to replace $x$ by $1/x$ and multiply by $x$ to proves the result. (Both parts follows by the same argument!).