convexity of piece wise function

115 Views Asked by At

I have a piece-wise function defined on the real line. The pieces are connected continuously, and the second derivative of each piece is strictly positive. Does this means that the function is convex?

More generally, where can I see about properties of such function or such construction?

2

There are 2 best solutions below

0
On

The function $f(x)=(x-1)^2$ if $x \ge 0$ and $(x+1)^2$ if $x<0$ is not convex, but the two pieces are continuously connected (at $(0,1)$) and each has strictly positive second derivative, namely $2.$

4
On

No, you function can be non-convex as a whole. Take for example $$f(x) = \begin{cases}(x-1)^2,&x\ge 0,\\(x+1)^2,&x<0.\end{cases}.$$

It has convex pieces, yet globally it is neither convex nor concave.

edit

Moreover, you proposed condition that the function is increasing doesn't help, either. Take $$g(x) = \begin{cases}x^2+1,&x\ge 0,\\e^{x},&x<0.\end{cases}.$$