6

I am asking because some Internet pages contradict. In Wikipedia, the definition I found of a convex function is:

"Let $X$ be a convex set in a real vector space and let $f: X \to R$ be a function.

• $f$ is called convex if:

For all $x_1\ne x_2 \in X$ and for all $t\in (0,1): f(t x_1 + (1-t)x_2 ) \le tf(x_1) + (1-t)f(x_2)$.

• $f$ is called strictly convex if:

For all $x_1\ne x_2 \in X$ and for all $t \in (0,1) : f(t x_1 + (1-t)x_2 ) < tf(x_1) + (1-t)f(x_2)$."

According to this definition, the funcion $f(x) = |x|$ is convex, but in another page they say that we cannot talk about concavity of $|x|$ because it is not differentiable in $x=0$. I know that if $f''(x) \gt 0$ for all $x$, then the function is convex, but my dude is this is an "if and only if".

Can I use $f^{\prime \prime}(x)$ to define the concavity of a function?

Moreover, I am not sure of if a constant function is both concave and convex. This is a conceptual problem. I would like to know in which book I can verify if the distinction between concavity and strict concavity is valid, because I do not trust sites like Wikipedia.

  • 4
    I don't see a contradiction on Wikipedia - I see they write, "$f$ convex if and only if $f''(x)\geq 0$ for all $x$" - but this is prefaced by "If $f$ is twice continuously differentiable..." which $f(x)=|x|$ is not. – Milo Brandt Aug 01 '15 at 02:59
  • But in the section "Examples" they say: "The function f(x) = |x|^p for 1≤p is convex." – Ronald Becerra Aug 01 '15 at 03:04
  • It is easy to check convexity of $f(x) = |x|$ by definition. – Zhanxiong Aug 01 '15 at 03:04
  • 2
    A function does not need to be differentiable in order to be convex, $|x|$ is convex. People confuse it: if the second derivative is positive on some interval the function is convex. It's not a iff. Fun fact: every convex function must be continuous. – onlyme Aug 01 '15 at 03:04
  • There was a very similar discussion in this discussion. – Mark McClure Aug 01 '15 at 04:46
  • Pay attention your definition of convexity and strict convexity is the same in strict convexity the inequality is strict! $<$ – Ali Aug 01 '15 at 09:20
  • 1
    @onlyme, it is not the case that every convex function is continuous. In particular it is possible for a convex function to be discontinuous on the boundary of its domain. – Michael Grant Aug 01 '15 at 14:08
  • @MichaelGrant true – onlyme Aug 01 '15 at 17:04

1 Answers1

6

Your condition is slightly off. A function is convex if $f''(x)\geq 0$ for all $x$. So yes, a constant function would be both concave and convex (but not strictly convex).

To show that $f(x)=|x|$ is convex, note that by the triangle inequality

$$f(tx_1+(1-t)x_2)=|tx_1+(1-t)x_2|\leq|tx_1|+|(1-t)x_2|=tf(x_1)+(1-t)f(x_2)$$

$f(x)$ is not differentiable at $x=0$, but this is okay. The theorem states that if $f$ is twice differentiable and convex then $f''(x)\geq 0$. Also note that $f''(x)\geq 0$ for all $x$ where $f''(x)$ is defined.

Convexity is a geometric condition. Think of a convex shape. If above the graph is a convex shape, then the function is called convex. This is a much more visual and natural way of thinking of it.

Using this geometric shape idea, if the corner at $x=0$ was slightly rounded and hence differentiable, it would still be the same shape basically. This geometric idea is probably the best way to look at it.

Edit for comments:

For strictly convex or convex, think about whether there are straight lines or not. Again geometrically is the best way to see these things. Think about the function $f(x)=x$. Then $f''(x)=0$. This is convex, but not strictly convex.

Geometrically, a function is convex if the area above the graph is convex (and equivalently, the area below the graph is concave) and concave if the area above is concave (area under is convex). So thinking of this geometrically, a function is strictly convex if it has a convex area above and not a convex area below the graph. This happens when there are lines.

  • But I still have the dude if the difference between convexity and strict convexity is valid. I say it because neither Leithold or Spivak talk about that. I have only read it on Internet Pages, not in a book. – Ronald Becerra Aug 01 '15 at 03:26
  • @RonaldBecerra What do you think "dude" means? I edited my answer with an explanation. –  Aug 01 '15 at 03:35
  • 3
    I am guessing he meant "doubt". – Michael Grant Aug 01 '15 at 17:06