Tutorials › Real Analysis › Second Derivative and Convexity

Differentiation · Tutorial 437 of 1000

Second Derivative and Convexity

Use the sign of the second derivative to decide whether a twice-differentiable function is convex, and understand what the test does and does not imply.

Advanced 9 min read

What You'll Learn

  • State the second-derivative criterion for convexity on an open interval
  • Prove that nonnegative second derivative implies convexity
  • Use the derivative characterization of convexity to prove the converse
  • Recognize why one negative second derivative rules out convexity
  • Apply the test when the second derivative is zero at some points
  • Identify why the test requires hypotheses on the whole interval

From Increasing Derivatives to Second Derivatives

In “Convexity and Derivatives,” convexity was characterized by a nondecreasing first derivative. When a function has a second derivative, the derivative of its first derivative tells us whether that first derivative is increasing or decreasing. This gives a convenient test for convexity: check the sign of the second derivative throughout the interval.

Throughout this tutorial, let \(I\) be an open interval and let \(f:I\to\mathbb{R}\) be twice differentiable, meaning that \(f'\) exists and is differentiable at every point of \(I\). We write \(f''=(f')'\). No continuity assumption on \(f''\) will be needed.

The Second-Derivative Criterion

The key connection is that a nonnegative second derivative makes the first derivative nondecreasing. The Mean Value Theorem gives this connection directly: between any two points, the change in \(f'\) equals a value of \(f''\) times the distance between the points. The derivative characterization of convexity from the previous tutorial then completes the argument.

Theorem (Second-Derivative Criterion for Convexity): Let \(I\) be an open interval, and let \(f:I\to\mathbb{R}\) be twice differentiable. Then \(f\) is convex on \(I\) if and only if $$ f''(x)\geq 0\qquad\text{for every }x\in I. $$

Proof. First suppose \(f''(x)\geq0\) for every \(x\in I\). Take any \(x,y\in I\) with \(x<y\). Since \(f'\) is differentiable on \(I\), it is continuous there. In particular, \(f'\) is continuous on \([x,y]\) and differentiable on \((x,y)\), so the Mean Value Theorem applied to \(f'\) gives some \(c\in(x,y)\) such that

$$ f'(y)-f'(x)=f''(c)(y-x). $$

Here \(f''(c)\geq0\) and \(y-x>0\), so \(f'(y)-f'(x)\geq0\). Thus \(f'(x)\leq f'(y)\) whenever \(x<y\), which means \(f'\) is nondecreasing on \(I\). By the Derivative Characterization of Convexity from the previous tutorial, \(f\) is convex on \(I\).

Now suppose \(f\) is convex on \(I\). By the Theorem on Derivative Monotonicity for Convex Functions from the previous tutorial, \(f'\) is nondecreasing on \(I\). The function \(f'\) is differentiable, so the earlier result “Derivative Sign for a Nondecreasing Function” applies to it: the derivative of a differentiable nondecreasing function is nonnegative at every interior point. Every point of \(I\) is interior, and therefore

$$ f''(x)=(f')'(x)\geq0\qquad\text{for every }x\in I. $$

Both implications hold, proving the equivalence. \(\square\)

The theorem requires the sign condition at every point of the interval, not merely at a sample of points. It also does not require \(f''\) to be continuous: differentiability of \(f'\) is enough for the Mean Value Theorem step and for the converse.

Applying the Criterion

Worked Example: A Sixth-Power Function

Let \(f(x)=x^6\) on \(\mathbb{R}\). By the Power Rule, \(f'(x)=6x^5\) and \(f''(x)=30x^4\). Since \(x^4\geq0\) for every real \(x\),

$$ f''(x)=30x^4\geq0\qquad\text{for every }x\in\mathbb{R}. $$

The Second-Derivative Criterion shows that \(f\) is convex on \(\mathbb{R}\). At \(x=0\), the second derivative is zero; this does not obstruct the conclusion because the criterion requires nonnegativity, not strict positivity. Away from zero, \(f''(x)>0\), but the conclusion of this test is convexity.

Worked Example: A Reciprocal Function That Is Not Convex

Consider \(f(x)=-1/x\) on \(I=(0,\infty)\). The Power Rule for Negative Integer Exponents gives

$$ f'(x)=x^{-2}, \qquad f''(x)=-2x^{-3}=-\frac{2}{x^3}. $$

For every \(x>0\), \(x^3>0\), so \(f''(x)<0\). In particular, the necessary condition in the Second-Derivative Criterion fails, and \(f\) is not convex on \((0,\infty)\). The derivative viewpoint confirms the failure: if \(0<x<y\), then \(x^{-2}>y^{-2}\), so \(f'(x)>f'(y)\), contrary to the nondecreasing-derivative condition for a differentiable convex function.

Worked Example: A Quadratic with Positive Second Derivative

Let \(f(x)=3x^2-4x+7\) on \(\mathbb{R}\). The derivative rules give

$$ f'(x)=6x-4, \qquad f''(x)=6. $$

Because \(6\geq0\) everywhere, the Second-Derivative Criterion proves that \(f\) is convex on \(\mathbb{R}\). In this example, the derivative is increasing at a constant rate: for any \(x<y\),

$$ f'(y)-f'(x)=(6y-4)-(6x-4)=6(y-x)>0. $$

The calculation illustrates the role of the second derivative: it measures the change in the first derivative, and a positive value makes that derivative increase across every nontrivial interval.

A Negative Value at One Point Is Enough

The criterion also has a useful contrapositive. If \(f''\) is negative at even one point, \(f\) cannot be convex on the interval. This conclusion is local: a single negative value gives nearby points where the first derivative decreases, which conflicts with the derivative monotonicity required by convexity.

Theorem (A Negative Second Derivative Rules Out Convexity): Let \(I\) be an open interval, let \(f:I\to\mathbb{R}\) be twice differentiable, and suppose \(a\in I\) satisfies \(f''(a)<0\). Then \(f\) is not convex on \(I\).

Proof. Since \(I\) is open, there is room to choose positive increments \(h\) small enough that \(a+h\in I\). By the definition of \(f''(a)\),

$$ \lim_{h\to0}\frac{f'(a+h)-f'(a)}{h}=f''(a)<0. $$

Choose a positive number \(\varepsilon\) such that \(f''(a)+\varepsilon<0\), for example \(\varepsilon=-f''(a)/2\). By the limit, for all sufficiently small nonzero \(h\),

$$ \frac{f'(a+h)-f'(a)}{h}<f''(a)+\varepsilon<0. $$

Choose such an \(h>0\). Multiplying by \(h>0\) gives \(f'(a+h)-f'(a)<0\), so \(f'(a+h)<f'(a)\). A differentiable convex function must have a nondecreasing derivative, by the Theorem on Derivative Monotonicity for Convex Functions. The decrease just obtained contradicts that requirement. Therefore \(f\) is not convex on \(I\). \(\square\)

This result does not say that one nonnegative value of \(f''\) proves convexity. The sign must be nonnegative throughout the domain for the sufficient direction. A negative value, however, immediately disproves convexity.

What the Sign Test Does—and Does Not—Tell You

The second-derivative criterion is a global test on the interval: \(f''\geq0\) everywhere is equivalent to convexity there. It is not enough to find a point where the second derivative is positive, nor is it enough to check the sign at a few selected points. If the sign changes, or if it is negative anywhere, the function is not convex on the whole interval.

A second derivative can equal zero at some points while remaining nonnegative everywhere. The sixth-power example shows why zero values alone do not settle the question: the full sign condition still holds. Conversely, a zero value at a point does not by itself show that the second derivative is nonnegative nearby. The sign on the entire interval is what the criterion uses.

The hypotheses matter as well. The theorem is stated for a twice-differentiable function on an open interval. If the second derivative does not exist at some points, this test cannot be applied as stated; the chord definition of convexity, or the first-derivative characterization when applicable, may still be useful. Nor should the criterion be confused with a test based on the sign of \(f'\): convexity is controlled by whether \(f'\) increases, and \(f''\) records that change.

In practice, the test is often efficient: differentiate twice, determine the sign of \(f''\) over the domain, and then state the conclusion only for the interval on which the sign condition holds. When the sign is not immediately clear, factoring, completing a square, or restricting attention to the given domain can resolve it.

Check Your Understanding

Use the second-derivative criterion and its proof to answer the following questions.

  1. State the Second-Derivative Criterion for a twice-differentiable function on an open interval.
  2. Which theorem connects \(f''\geq0\) to the fact that \(f'\) is nondecreasing?
  3. Why does \(f''(a)<0\) at one point contradict convexity?
  4. Does the criterion require \(f''(x)>0\) at every point, or is nonnegativity enough?
  5. Why can checking \(f''\) at only a few points fail to establish convexity on an interval?