Convex and Concave Functions: Definition and Tests

#Calculus
TL;DR
A convex function's chords lie on or above its graph; a concave function's chords lie on or below it. This guide to convex and concave functions covers three equivalent tests, Jensen's inequality and naming clashes.
BT
Bhanzu TeamLast updated on October 9, 202618 min read

What Are Convex And Concave Functions?

Convex and concave functions are classified by their chords, the straight segments joining two points on the graph. A function is convex on an interval when every chord lies on or above the graph between its endpoints, and concave when every chord lies on or below it. That is the answer to the common question "What are concave and convex functions?", and the formal statement below says exactly the same thing in symbols.

A function ff defined on an interval II is convex on II when, for all x1x_1 and x2x_2 in II and every tt with 0≤t≤10 \leq t \leq 1,

f(tx1+(1−t)x2)≤tf(x1)+(1−t)f(x2).f\big(t x_1 + (1 - t) x_2\big) \leq t f(x_1) + (1 - t) f(x_2).

It is concave on II when the inequality points the other way:

f(tx1+(1−t)x2)≥tf(x1)+(1−t)f(x2).f\big(t x_1 + (1 - t) x_2\big) \geq t f(x_1) + (1 - t) f(x_2).

What each part means:

  • tx1+(1−t)x2t x_1 + (1 - t) x_2 is a point between x1x_1 and x2x_2; as tt runs from 00 to 11, it slides from x2x_2 to x1x_1.

  • The left side is the height of the graph at that point.

  • The right side is the height of the chord at the same point, a weighted average of the two endpoint heights.

The function is strictly convex (or strictly concave) when the inequality is strict for every x1≠x2x_1 \neq x_2 and every tt strictly between 00 and 11. The domain must be an interval, because the definition needs every in-between point to exist. One more view connects this to geometry: ff is convex exactly when the region on and above its graph is a convex shape, with no dents.

Why Do Some Textbooks Say Concave Up Instead Of Convex?

"Convex" and "concave up" describe the same bowl shape; they come from two traditions that never agreed on one word. Most first-year calculus books, including OpenStax Calculus, say concave up and concave down. Analysis, optimization and economics texts say convex and concave. A few older or translated texts use a third pair, as the Wikipedia article on convex functions records.

Shape

Analysis, optimization, economics

Most calculus textbooks

Some older or translated texts

Bowl, holds water

Convex

Concave up

Convex downward

Dome, sheds water

Concave

Concave down

Convex upward

This naming took a while to settle the first time: "convex downward" sounds like a dome, yet it names the bowl. The safe habit is to translate every term back to the chord picture before using it. In this article, convex always means the bowl and concave always means the dome.

How Do You Determine If A Function Is Convex Or Concave?

You can determine whether a function is convex or concave with any of three equivalent tests: the chord test, the tangent line test or the second derivative test. The chord test works for every function, the tangent test needs one derivative, and the second derivative test, the quickest, needs two.

Test 1: The Chord Test

The chord test is the definition itself, and it is the only one of the three that also works for functions with corners. For f(x)=x2f(x) = x^2, subtract the graph height from the chord height:

ta2+(1−t)b2−(ta+(1−t)b)2=t(1−t)(a−b)2t a^2 + (1 - t) b^2 - \big(t a + (1 - t) b\big)^2 = t(1 - t)(a - b)^2

For 0≤t≤10 \leq t \leq 1, both tt and 1−t1 - t are non-negative and (a−b)2≥0(a - b)^2 \geq 0, so the gap is never negative and x2x^2 is convex everywhere.

Test 2: The Tangent Line Test

A differentiable function is convex on an interval exactly when its graph lies on or above every one of its tangent lines there:

f(x)≥f(a)+f′(a)(x−a)for all x,a in If(x) \geq f(a) + f'(a)(x - a) \quad \text{for all } x, a \text{ in } I

For a concave function the graph lies on or below every tangent. With f(x)=exf(x) = e^{x} and the tangent at a=0a = 0, this gives the useful inequality ex≥1+xe^{x} \geq 1 + x for every real xx. If tangent line equations are new, that page builds y=f(a)+f′(a)(x−a)y = f(a) + f'(a)(x - a) from scratch.

Test 3: The Second Derivative Test

For a function that is twice differentiable on an open interval II:

f is convex on I  ⟺  f′′(x)≥0 for all x in If \text{ is convex on } I \iff f''(x) \geq 0 \text{ for all } x \text{ in } I

f is concave on I  ⟺  f′′(x)≤0 for all x in If \text{ is concave on } I \iff f''(x) \leq 0 \text{ for all } x \text{ in } I

So the condition to check is f′′(x)>0f''(x) > 0. Actually, that is too strict: the test asks for f′′(x)≥0f''(x) \geq 0, and zero is allowed. The function x4x^4 has second derivative 12x212x^2, which is 00 at x=0x = 0, yet x4x^4 is not only convex but strictly convex. A strictly positive f′′(x)f''(x) guarantees strict convexity, but strict convexity does not force f′′(x)f''(x) to be strictly positive.

Why does the sign of f′′f'' decide the shape? A short proof sketch:

  • f′′(x)≥0f''(x) \geq 0 means f′f' is non-decreasing, the same idea as increasing and decreasing functions applied one level up.

  • Take x1<m<x2x_1 < m < x_2. By the mean value theorem, the chord slope on [x1,m][x_1, m] equals f′(c1)f'(c_1) and the chord slope on [m,x2][m, x_2] equals f′(c2)f'(c_2) for some c1<m<c2c_1 < m < c_2.

  • Since f′f' is non-decreasing, f′(c1)≤f′(c2)f'(c_1) \leq f'(c_2): the graph climbs no faster before mm than after it, which places f(m)f(m) on or below the chord from x1x_1 to x2x_2.

Which Common Functions Are Convex Or Concave?

Most functions you meet are convex on some intervals and concave on others, so the honest answer always names the interval. The table lists the standard cases with the second derivative that settles each one.

Function

Second derivative

Verdict

x2x^2, x4x^4 (any even power)

22, 12x212x^2

Convex on all real numbers

∣x∣\lvert x \rvert

Not defined at 00

Convex (chord test; corner at 00)

exe^{x}

exe^{x}

Strictly convex everywhere

axa^{x} with a>0a > 0, a≠1a \neq 1

ax(ln⁡a)2a^{x}(\ln a)^2

Convex, even when decreasing (0<a<10 < a < 1)

1x\frac{1}{x}

2x3\frac{2}{x^3}

Convex on (0,∞)(0, \infty), concave on (−∞,0)(-\infty, 0)

−x2-x^2

−2-2

Concave on all real numbers

x\sqrt{x}

−14x3/2-\frac{1}{4x^{3/2}}

Concave on (0,∞)(0, \infty)

ln⁡x\ln x

−1x2-\frac{1}{x^2}

Concave on (0,∞)(0, \infty)

mx+cmx + c

00

Both convex and concave

x3x^3

6x6x

Concave for x≤0x \leq 0, convex for x≥0x \geq 0, neither overall

sin⁡x\sin x

−sin⁡x-\sin x

Concave on [0,π][0, \pi], convex on [π,2π][\pi, 2\pi], neither overall

Two entries correct claims that circulate online. A decreasing exponential such as (12)x\left(\frac{1}{2}\right)^{x} is convex, not concave, because (ln⁡a)2(\ln a)^2 is positive whichever way the curve slopes. And sin⁡x\sin x is not a convex function on the real line; it switches between the two shapes every π\pi units.

What Properties Do Convex And Concave Functions Share?

Convex and concave functions mirror each other, so every property of one has a twin for the other. These are the properties competitors list and the ones problems actually use:

  • Negation swaps the type. ff is convex exactly when −f-f is concave, which is why most results are stated for convex functions only.

  • Sums and positive multiples stay convex. If ff and gg are convex and c≥0c \geq 0, then f+gf + g and cfcf are convex; ex+x2e^{x} + x^2 is convex because both parts are.

  • The larger of two convex functions is convex. That is why ∣x∣=max⁡(x,−x)\lvert x \rvert = \max(x, -x) is convex despite its corner.

  • A local minimum of a convex function is a global minimum. A convex function has no false bottoms: any low point you find is the lowest point on the interval, and the twin statement holds for the local maximum of a concave function. Finding those points is covered under maxima and minima.

  • Composition needs a direction condition. If ff is convex and gg is convex and non-decreasing, then g(f(x))g(f(x)) is convex, which shows at once that ex2e^{x^2} is convex.

  • Convex functions on open intervals are continuous. A jump would break the chord inequality near the jump.

What Is Jensen's Inequality For Convex Functions?

Jensen's inequality says that for a convex function, the function of an average is at most the average of the function values. The two-point version with equal weights is the chord definition at t=12t = \frac{1}{2}:

f(x1+x22)≤f(x1)+f(x2)2f\left(\frac{x_1 + x_2}{2}\right) \leq \frac{f(x_1) + f(x_2)}{2}

The general version allows any number of points and any weights w1,w2,…,wnw_1, w_2, \ldots, w_n that are non-negative and add up to 11:

f(∑i=1nwixi)≤∑i=1nwif(xi)f\left(\sum_{i=1}^{n} w_i x_i\right) \leq \sum_{i=1}^{n} w_i f(x_i)

For a concave function the inequality reverses. With f(x)=x2f(x) = x^2 and equal weights 12\frac{1}{2}, the two-point form gives (a+b2)2≤a2+b22\left(\frac{a + b}{2}\right)^2 \leq \frac{a^2 + b^2}{2}, the first step of the root-mean-square inequality you may meet later. The Wikipedia article on Jensen's inequality shows how the arithmetic mean and geometric mean inequality drops out of the concavity of ln⁡x\ln x, which Example 5 below carries out with numbers.

The Mathematicians Behind Convex And Concave Functions

Johan Ludwig William Valdemar Jensen (1859 to 1925, Denmark) worked for the Copenhagen telephone company for most of his life and did mathematics in his spare time, according to his MacTutor biography. In 1906 he published the inequality for convex functions that now carries his name, showing that many classical inequalities are special cases of one statement about convexity.

How Are Convex And Concave Functions Different?

Convex and concave functions are opposites in every test: whatever holds for one holds with the inequality flipped for the other. The difference also decides how they behave in optimization, the second half of a common question about the two.

Feature

Convex function

Concave function

Shape

Bowl (concave up)

Dome (concave down)

Chord

On or above the graph

On or below the graph

Tangent lines

On or below the graph

On or above the graph

Second derivative

f′′(x)≥0f''(x) \geq 0

f′′(x)≤0f''(x) \leq 0

First derivative

f′f' non-decreasing

f′f' non-increasing

Guaranteed extreme

Any local minimum is global

Any local maximum is global

Jensen's inequality

f(average)≤average of ff(\text{average}) \leq \text{average of } f

f(average)≥average of ff(\text{average}) \geq \text{average of } f

Typical examples

x2x^2, exe^{x}, ∣x∣\lvert x \rvert

−x2-x^2, x\sqrt{x}, ln⁡x\ln x

Examples Of Convex And Concave Functions

Each example answers a version of the standard exercise: show whether a function is convex, concave or neither, and on which interval.

Example 1

Show that f(x)=x2−4x+7f(x) = x^2 - 4x + 7 is convex on all real numbers.

f′(x)=2x−4f'(x) = 2x - 4

f′′(x)=2f''(x) = 2

Since f′′(x)=2>0f''(x) = 2 > 0 for every xx, the function is strictly convex.

Final answer: ff is strictly convex on (−∞,∞)(-\infty, \infty).

Example 2

Decide whether f(x)=(12)xf(x) = \left(\frac{1}{2}\right)^{x} is convex or concave.

The tempting argument goes: the graph falls from left to right, so it must bend downward, so it is concave. Test that claim with a chord from x=0x = 0 to x=2x = 2, at the midpoint x=1x = 1:

f(1)=12f(1) = \frac{1}{2}

f(0)+f(2)2=1+142=58\frac{f(0) + f(2)}{2} = \frac{1 + \frac{1}{4}}{2} = \frac{5}{8}

The graph height 12\frac{1}{2} sits below the chord height 58\frac{5}{8}, which is what a convex function does, so the concave guess has already failed. The slope tells you the direction of travel; it says nothing about the bending. The second derivative settles it for every xx:

f′′(x)=(12)x(ln⁡2)2>0f''(x) = \left(\frac{1}{2}\right)^{x} (\ln 2)^2 > 0

Final answer: f(x)=(12)xf(x) = \left(\frac{1}{2}\right)^{x} is strictly convex on all real numbers, even though it is decreasing.

Example 3

Find where f(x)=x3−3x2+4xf(x) = x^3 - 3x^2 + 4x is convex and where it is concave.

f′(x)=3x2−6x+4f'(x) = 3x^2 - 6x + 4

f′′(x)=6x−6=6(x−1)f''(x) = 6x - 6 = 6(x - 1)

The second derivative is negative for x<1x < 1 and positive for x>1x > 1.

Final answer: concave on (−∞,1](-\infty, 1], convex on [1,∞)[1, \infty), and neither on the whole real line.

The first instinct with a cubic is to give one verdict for the whole function. A cubic always switches shape once, so the only correct answer names the two intervals.

Example 4

Show that ln⁡x\ln x is concave and use its tangent at x=1x = 1 to prove ln⁡x≤x−1\ln x \leq x - 1 for x>0x > 0.

f′(x)=1xf'(x) = \frac{1}{x}

f′′(x)=−1x2<0 for x>0f''(x) = -\frac{1}{x^2} < 0 \text{ for } x > 0

So ln⁡x\ln x is concave on (0,∞)(0, \infty). The tangent at x=1x = 1 has slope f′(1)=1f'(1) = 1 and passes through (1,0)(1, 0):

y=0+1⋅(x−1)=x−1y = 0 + 1 \cdot (x - 1) = x - 1

A concave graph lies on or below its tangents, so

ln⁡x≤x−1\ln x \leq x - 1

Final answer: ln⁡x\ln x is concave on (0,∞)(0, \infty) and ln⁡x≤x−1\ln x \leq x - 1 for all x>0x > 0, with equality only at x=1x = 1.

Example 5

Use Jensen's inequality to show that a+b+c3≥abc3\frac{a + b + c}{3} \geq \sqrt[3]{abc} for positive aa, bb, cc, and check it with a=1a = 1, b=8b = 8, c=27c = 27.

Because ln⁡x\ln x is concave, Jensen's inequality with weights 13\frac{1}{3} points the other way:

ln⁡(a+b+c3)≥ln⁡a+ln⁡b+ln⁡c3=ln⁡abc3\ln\left(\frac{a + b + c}{3}\right) \geq \frac{\ln a + \ln b + \ln c}{3} = \ln \sqrt[3]{abc}

The natural logarithm is increasing, so the inequality between the logarithms carries over to the numbers themselves. Check:

1+8+273=12\frac{1 + 8 + 27}{3} = 12

1⋅8⋅273=2163=6\sqrt[3]{1 \cdot 8 \cdot 27} = \sqrt[3]{216} = 6

Final answer: the arithmetic mean is at least the geometric mean; here 12≥612 \geq 6.

Example 6

A shop's weekly profit is P(q)=60q−q2−200P(q) = 60q - q^2 - 200 for qq items. Show that the critical point gives the largest possible profit.

P′(q)=60−2qP'(q) = 60 - 2q

P′′(q)=−2P''(q) = -2

PP is concave on its whole domain, so any local maximum is the global maximum. Setting P′(q)=0P'(q) = 0 gives q=30q = 30.

P(30)=1800−900−200=700P(30) = 1800 - 900 - 200 = 700

Final answer: the profit is greatest at q=30q = 30 items, where it equals 700700, and concavity guarantees no other quantity does better.

Why Do Convex And Concave Functions Matter? "One Bottom, With Nowhere Else To Hide"

Convexity exists to answer a question every optimizer faces: is the low point I found the lowest one, or just a dip? For a convex function the answer is always yes, so a search that keeps going downhill cannot get stuck in a false valley. That single guarantee is why the idea earns a name of its own.

  • It turns local answers into global ones. Example 6 needed one critical point and one sign check; without concavity, every other quantity would have to be compared by hand.

  • It produces inequalities for free. Jensen's inequality, the tangent line test and the chord test each turn one shape fact into a family of inequalities such as ex≥1+xe^{x} \geq 1 + x and the arithmetic and geometric mean inequality.

  • It models diminishing returns. A concave curve rises, but each extra unit adds less than the one before, which is how output, satisfaction and many learning curves behave.

Where Are Convex And Concave Functions Used?

Convex and concave functions are used wherever a best choice has to be found or a diminishing effect has to be modelled.

  • Optimization problems. Most optimization problems in a first course quietly rely on a convex cost or a concave profit, so the critical point found is the true optimum.

  • Economics. Production functions are usually modelled as increasing and concave, the shape of diminishing returns, as the University of Toronto economics tutorial explains, and utility functions are drawn concave for the same reason. More of this appears under calculus in economics.

  • Machine learning. Training a model means minimizing an error function, and when that function is convex, as with a squared-error fit to a straight line, gradient descent cannot be trapped in a false minimum.

  • Finance and risk. A concave utility function, through Jensen's inequality, values a sure amount above a gamble with the same average, which is the mathematical form of risk aversion.

Why Do Students Get Convex And Concave Functions Wrong?

Most errors here come from trusting a picture or a word instead of the definition, and each one has a fast fix.

Mistake 1: Reading Convex As A Dome

Where it slips in: Moving between a calculus textbook (concave up) and an economics or optimization text (convex).

Don't do this: Assume "convex" means bulging upward like a dome because a convex lens bulges outward.

The correct way: Translate every term back to the chord picture: convex means the chord is on or above the graph, the bowl shape.

The memorizer is hit hardest here, because a memorized phrase like "convex bulges out" was learned for lenses and polygons, not graphs.

Mistake 2: Requiring f′′(x)>0f''(x) > 0 At Every Point

Where it slips in: Functions like x4x^4 or x6x^6 whose second derivative touches zero.

Don't do this: Conclude that x4x^4 is not convex because f′′(0)=0f''(0) = 0.

The correct way: Use f′′(x)≥0f''(x) \geq 0 for convexity; check strict convexity with the chord test if it matters.

Mistake 3: Judging The Shape From Whether The Function Rises Or Falls

Where it slips in: Exponential and logarithmic functions, such as e−xe^{-x} (falling but convex) and ln⁡x\ln x (rising but concave).

Don't do this: Call a decreasing function concave or an increasing function convex.

The correct way: Look at the sign of f′′(x)f''(x), or at how f′f' changes, never at the sign of f′f' itself.

Students who sketch two tangent lines before answering stop making this mistake almost at once, because the drawing shows whether the slopes are growing or shrinking, which is the question convexity actually asks.

Mistake 4: Giving One Verdict For A Function That Changes Shape

Where it slips in: Cubics, sin⁡x\sin x and 1x\frac{1}{x}, which are convex on one interval and concave on another.

Don't do this: Declare "1x\frac{1}{x} is convex" without naming the interval.

The correct way: Find where f′′(x)f''(x) changes sign, then state the verdict separately on each interval of the domain.

The rusher makes this mistake under time pressure: one test value gives a sign, and the answer goes down for the whole real line.

Practice Problems On Convex And Concave Functions

  1. Show that f(x)=x4+3x2f(x) = x^4 + 3x^2 is strictly convex on all real numbers.

  2. Show that f(x)=xf(x) = \sqrt{x} is concave on (0,∞)(0, \infty).

  3. Find the intervals where f(x)=x3−6x2+1f(x) = x^3 - 6x^2 + 1 is convex and where it is concave.

  4. Is f(x)=∣x−1∣+x2f(x) = \lvert x - 1 \rvert + x^2 convex? Give a reason without differentiating at x=1x = 1.

  5. Find where f(x)=xexf(x) = x e^{x} is convex and where it is concave.

  6. Use Jensen's inequality with f(x)=x2f(x) = x^2 to show (a+b2)2≤a2+b22\left(\frac{a + b}{2}\right)^2 \leq \frac{a^2 + b^2}{2}, and check it with a=1a = 1, b=5b = 5.

Answer to Problem 1: f′′(x)=12x2+6=6(2x2+1)>0f''(x) = 12x^2 + 6 = 6(2x^2 + 1) > 0 for every xx, so ff is strictly convex.

Answer to Problem 2: f′′(x)=−14x3/2<0f''(x) = -\frac{1}{4x^{3/2}} < 0 for x>0x > 0, so x\sqrt{x} is concave there.

Answer to Problem 3: f′′(x)=6(x−2)f''(x) = 6(x - 2); concave on (−∞,2](-\infty, 2] and convex on [2,∞)[2, \infty).

Answer to Problem 4: Yes. ∣x−1∣\lvert x - 1 \rvert is convex (a shifted absolute value) and x2x^2 is convex, and a sum of convex functions is convex.

Answer to Problem 5: f′′(x)=(x+2)exf''(x) = (x + 2)e^{x}; concave on (−∞,−2](-\infty, -2] and convex on [−2,∞)[-2, \infty).

Answer to Problem 6: x2x^2 is convex, so the two-point Jensen inequality gives the result directly; with a=1a = 1, b=5b = 5, the left side is 99 and the right side is 1313.

Bottom Line

  • Convex and concave functions are defined by chords: on or above the graph for convex, on or below for concave.

  • The chord, tangent line and second derivative tests are equivalent, and the second derivative test asks for f′′(x)≥0f''(x) \geq 0, not f′′(x)>0f''(x) > 0.

  • "Convex" and "concave up" name the same bowl shape; translate any term back to the chord picture.

  • A local minimum of a convex function is a global minimum, which is why convexity matters in optimization.

  • Jensen's inequality compares the function of an average with the average of the function, and yields inequalities such as the arithmetic and geometric mean inequality.

Where To Go From Here

Work through Practice Problems 1 to 6 using the second derivative test first and the chord test as a check; if Problem 4 or Problem 6 trips you up, return to the sections on properties and on Jensen's inequality. Want a live Bhanzu trainer to go through convexity proofs with you? Book a free demo class.

Read More

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

Can convex and concave functions overlap, so that one function is both, or neither?
Yes, both can happen. A function is both convex and concave exactly when it is linear (more precisely, of the form mx+cmx + c), since its chords lie on the graph. A function is neither when its shape changes, as x3x^3 and sin⁡x\sin x do on the whole real line.
Is the product of two concave functions a concave function?
Not in general. The functions f(x)=xf(x) = x and g(x)=xg(x) = x are both concave (and convex), yet their product x2x^2 is convex and not concave. Products need extra conditions, such as sign and monotonicity, before any conclusion holds.
What is the definition of convex and concave functions for two or more variables?
The chord definition carries over unchanged, with points in the plane or in space instead of on a line: f(tx+(1−t)y)≤tf(x)+(1−t)f(y)f(t\mathbf{x} + (1 - t)\mathbf{y}) \leq t f(\mathbf{x}) + (1 - t) f(\mathbf{y}) for convex ff on a convex domain. The second derivative test becomes a condition on the matrix of second partial derivatives, which must be positive semidefinite for convexity.
What is the difference between a convex combination of concave functions and a convex combination of non-convex functions?
A convex combination uses non-negative weights that add up to 11. Any convex combination of concave functions is again concave, because each inequality survives the weighting. For non-convex functions there is no such rule: 12sin⁡x+12(−sin⁡x)=0\frac{1}{2}\sin x + \frac{1}{2}(-\sin x) = 0 is linear, while other mixtures of the same functions are neither convex nor concave.
How do you find whether a function is concave or quasi-concave?
Check concavity with the second derivative or the chord test. Quasi-concavity is weaker: ff is quasi-concave when f(tx1+(1−t)x2)≥min⁡f(x1),f(x2)f(t x_1 + (1 - t) x_2) \geq \min{f(x_1), f(x_2)}, so every concave function is quasi-concave, but exe^{x}, for example, is quasi-concave without being concave.
How are convex and concave functions related to optimization methods such as gradient descent and gradient ascent?
Gradient descent minimizes by stepping downhill, and on a convex function every downhill path ends at the global minimum. Gradient ascent does the same for maximizing a concave function. On functions that are neither, both methods can stop at a local point that is not the best one.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →