Are these two function convex?

64 Views Asked by At

Screenshot here $$f(x)=\left\{\begin{array}{ll}x \log x, & x>0 \\ 1, & x=0\end{array}\right. \\ f(x)=\left\{\begin{array}{c}x^{2}, \qquad x \geq 0 \\ 1+x^{2}, \quad x<0\end{array}\right.$$ first func is for $x\geq 0$ second func is for any $x$

How do I prove that these functions are convex or not?

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

The second function is not convex because of the jump at 0. You can look for a secant line that crosses the graph near 0. For instance you can try $x_0=-1/2, x_1=1/2$ and any point $tx_0+(1-t)x_1$ with $t<1/2$: enter image description here

For the first, its easy to check that its convex as a function on $(0,\infty)$ by differentiating twice. (a $C^2$ function is convex iff $f'' \ge 0.$) What this means is that if you form the secant line segments joining any two points on the graph with $x=x_0,x_1>0$ then the line lies above the graph. It remains for you to check the case where one of the points is at $x=0$, i.e. we need to know if

$$ f((1-t)0 + tx) \le (1-t)f(0) + tf(x) \\ \iff tx\log tx \le (1-t) + tx\log x$$ but $ tx\log tx = tx \log x + tx \log t$ so we just need to know if for any $t\in (0,1)$, and any $x\ge 0$, $$ tx\log t \le 1-t$$ and this is true because for $t\in(0,1)$, $\log t<0$, so in fact $$ tx\log t \le 0 \le 1-t.$$