9
$\begingroup$

According to a calculus book I have been reading, we call a function $g(x)$ a convex function if

$$g(\lambda x +(1-\lambda)y) \leq \lambda g(x) +(1-\lambda)g(y)$$, for all $x,y$ and $0<\lambda<1$.

But if I have to check if a given function is convex or not,this definition seems hard and impractical to use. So,my question is, is there any easier way of checking convexity of a function and if there is,then why it is equivalent to this defiinition.

Thanks in advance!

$\endgroup$
5
  • 2
    $\begingroup$ look at the second derivative if it exists and is non-negative $\endgroup$ Aug 16 '19 at 19:09
  • 3
    $\begingroup$ @J.W.Tanner provided the function has one! $\endgroup$
    – Anurag A
    Aug 16 '19 at 19:11
  • $\begingroup$ Just to remind you guys, i am interested in the proof also $\endgroup$ Aug 16 '19 at 19:12
  • 1
    $\begingroup$ Your question is too vague to provide various proves. Have a look at ljk.imag.fr/membres/Anatoli.Iouditski/cours/convex/… if you want to look at various convexity criteria with the associated proves. $\endgroup$ Aug 16 '19 at 19:26
  • $\begingroup$ @mathcounterexamples.net thanks! $\endgroup$ Aug 16 '19 at 19:47
10
$\begingroup$

What you gave is the standard definition of a convex function.

If $f$ is supposed to be continuous, it is enough to check that

$$f\left(\frac{x+y}{2}\right) \le \frac{f(x)+f(y)}{2}$$ for all $x,y$.

If $f$ is twice differentiable, it is enough to check that the second derivative is non negative.

$\endgroup$
2
2
$\begingroup$

Check the Hessian matrix of the function. If the matrix is:

  1. Positive-definite then your function is strictly convex.
  2. Positive semi-definite then your function is convex.

A matrix is positive definite when all the eigenvalues are positive and semi-definite if all the eigenvalues are positive or zero-valued.

$\endgroup$
1
$\begingroup$

For convexity of a function $f(x)$ you like to have the graph of your function on an interval [a,b] falls below or on the graph of a straight line segment connecting $f(a)$ and $f(b)$.

You can check arbitrary points or in case the second derivative exist you want your second derivative be non negative.

That makes the slopes to increase and the curve falls above the tangent lines and below the secant lines.

$\endgroup$
1
$\begingroup$

For particular functions, there are indeed easier ways of checking.

For example, for any function $g(x)$ which is twice differentiable in an interval $(a,b)$ $$( \forall x\in(a,b) (\frac{d^2g}dx^2 \leq 0) ) \implies g(x) \mbox{ is convex in } (a,b)$$

That is, a function with non-negative second derivative in an interval is convex in that interval.

Another property is that any function $g(x)$ which is not continuous on $(a,b)$ cannot be convex on $(a,b)$.

But there can be other functions which are more difficult to deal with. Suppose $g(x)$ is continuous on $(a,b)$ but is not everywhere differentiable, or has a discontinuous first derivative, so that the second derivative does not exist everywhere. Such a function can still be convex; for example


Somebody changed my answer, saying that a function with a non-positive second derivative is convex. Of course, what one calls "convex" or "concave" for a function from $\Bbb R \to \Bbb R$ is somewhat just a matter of convention, but if you believe that the common usage is the definition found in Wikipedia, the function $x^2$ is convex.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.