FunctionConvexity[f,{x1,x2,…}]
finds the convexity of the function f with variables x1,x2,… over the reals.
FunctionConvexity[{f,cons},{x1,x2,…}]
finds the convexity when variables are restricted by the constraints cons representing a convex region.
FunctionConvexity
FunctionConvexity[f,{x1,x2,…}]
finds the convexity of the function f with variables x1,x2,… over the reals.
FunctionConvexity[{f,cons},{x1,x2,…}]
finds the convexity when variables are restricted by the constraints cons representing a convex region.
Details and Options
- Convexity is also known as convex, concave, strictly convex and strictly concave.
- By default, the following definitions are used:
-

+1 convex, i.e.
for all
and all
and 

0 affine
, i.e.
for all
and all
and 

-1 concave, i.e.
for all
and all
and 

Indeterminate neither convex nor concave - The affine function is both convex and concave.
- With the setting StrictInequalitiesTrue, the following definitions are used:
-

+1 strictly convex, i.e.
for all
and all
and
with 

-1 strictly concave, i.e.
for all
and all
and
and 

Indeterminate neither strictly convex nor strictly concave - The function
should be a real-valued function for all real
that satisfy the constraints cons. - cons can contain equations, inequalities or logical combinations of these representing a convex region.
- The following options can be given:
-
Assumptions $Assumptions assumptions on parameters GenerateConditions Automatic whether to generate conditions on parameters PerformanceGoal $PerformanceGoal whether to prioritize speed or quality StrictInequalities False whether to require strict convexity - Possible settings for GenerateConditions include:
-
Automatic nongeneric conditions only True all conditions False no conditions None return unevaluated if conditions are needed - Possible settings for PerformanceGoal are "Speed" and "Quality".
Examples
open all close allBasic Examples (3)
Find the convexity of a univariate function:
FunctionConvexity[Abs[x], x]Find the convexity of a multivariate function:
FunctionConvexity[-Exp[x + y], {x, y}]Find the convexity of a function with variables restricted by constraints:
FunctionConvexity[{x ^ 3 + y ^ 3, x ≥ 0 && y ≥ 0}, {x, y}]Scope (7)
FunctionConvexity[Sin[x], x]FunctionConvexity[2 ^ x, x]FunctionConvexity[x - Sqrt[x ^ 2], x]Plot[{Sin[x], 2 ^ x, x - Sqrt[x ^ 2]}, {x, -3, 3}]A function that is not real valued has Indeterminate convexity:
FunctionConvexity[Log[x], x]The function is real valued and concave for positive
:
FunctionConvexity[{Log[x], x > 0}, x]Univariate functions with constraints on the variable:
FunctionConvexity[{Sin[x], 0 ≤ x ≤ Pi}, x]FunctionSign[{x - Sqrt[x ^ 2], x ≥ 0}, x]The strict convexity of a function:
FunctionConvexity[Abs[x], x, StrictInequalities -> True]FunctionConvexity[x ^ 2 Abs[x], x, StrictInequalities -> True]
is convex, but not strictly convex.
is strictly convex:
Plot[{Abs[x], x ^ 2Abs[x]}, {x, -2, 2}]FunctionConvexity[x ^ 2 + y ^ 2, {x, y}]Plot3D[x ^ 2 + y ^ 2, {x, -2, 2}, {y, -2, 2}]FunctionConvexity[x ^ 2 - y ^ 2, {x, y}]Plot3D[x ^ 2 - y ^ 2, {x, -2, 2}, {y, -2, 2}]Multivariate functions with constraints on variables:
FunctionConvexity[{x ^ 3 + x ^ 2 y ^ 2 + y ^ 3, -2 < x < 2 && -2 < y < 2}, {x, y}]Plot3D[x ^ 3 + x ^ 2 y ^ 2 + y ^ 3, {x, -2, 2}, {y, -2, 2}]In a different region, the same function is convex:
FunctionConvexity[{x ^ 3 + x ^ 2 y ^ 2 + y ^ 3, 0 < x < 2 && y > 0}, {x, y}]Plot3D[x ^ 3 + x ^ 2 y ^ 2 + y ^ 3, {x, 0, 2}, {y, 0, 2}]Functions with symbolic parameters:
FunctionConvexity[a x ^ 2 + b x + c, x]FunctionConvexity[x ^ 2 + a x y + y ^ 2, {x, y}]Options (5)
Assumptions (1)
FunctionConvexity gives a conditional answer here:
FunctionConvexity[x ^ 4 + a x ^ 2, x]Check convexity for other values of
:
FunctionConvexity[x ^ 4 + a x ^ 2, x, Assumptions -> a < 0]GenerateConditions (2)
By default, FunctionConvexity may generate conditions on symbolic parameters:
FunctionConvexity[a x ^ 2 + b y ^ 2, {x, y}]With GenerateConditionsNone, FunctionConvexity fails instead of giving a conditional result:
FunctionConvexity[a x ^ 2 + b y ^ 2, {x, y}, GenerateConditions -> None]This returns a conditionally valid result without stating the condition:
FunctionConvexity[a x ^ 2 + b y ^ 2, {x, y}, GenerateConditions -> False]By default, all conditions are reported:
FunctionConvexity[E ^ x / a ^ 2, x]With GenerateConditionsAutomatic, conditions that are generically true are not reported:
FunctionConvexity[E ^ x / a ^ 2, x, GenerateConditions -> Automatic]PerformanceGoal (1)
Use PerformanceGoal to avoid potentially expensive computations:
FunctionConvexity[x ^ 6 + a x ^ 2 y ^ 4 + b x ^ 4 y ^ 2 + y ^ 6, {x, y}, PerformanceGoal -> "Speed"]The default setting uses all available techniques to try to produce a result:
FunctionConvexity[x ^ 6 + a x ^ 2 y ^ 4 + b x ^ 4 y ^ 2 + y ^ 6, {x, y}]StrictInequalities (1)
By default, FunctionConvexity computes the non-strict convexity:
FunctionConvexity[#, {x, y}]& /@ {x ^ 2, x ^ 2 + y ^ 2}With StrictInequalitiesTrue, FunctionConvexity computes the strict sign:
FunctionConvexity[#, {x, y}, StrictInequalities -> True]& /@ {x ^ 2, x ^ 2 + y ^ 2}
is convex, but not strictly convex.
is strictly convex:
GraphicsRow[Plot3D[#, {x, -2, 2}, {y, -2, 2}]& /@ {x ^ 2, x ^ 2 + y ^ 2}, ImageSize -> 400]Applications (17)
Basic Applications (8)
FunctionConvexity[x ^ 2 - 1, x]The segment connecting any two points on the graph lies above the graph:
Plot[x ^ 2 - 1, {x, -5, 5}, Rule[...]]FunctionConvexity[x - E ^ x, x]The segment connecting any two points on the graph lies below the graph:
Plot[x - E ^ x, {x, -3, 3}, Rule[...]]FunctionConvexity[Sin[x], x]
is neither a convex function nor a concave function:
Plot[Sin[x], {x, -3Pi, 3Pi}, Rule[...]]Show that
restricted to
is a strictly concave function:
FunctionConvexity[{Sin[x], 0 ≤ x ≤ Pi}, x, StrictInequalities -> True]
is convex, but not strictly convex:
FunctionConvexity[Abs[x], x]FunctionConvexity[Abs[x], x, StrictInequalities -> True]Plot[Abs[x], {x, -5, 5}, Rule[...]]
restricted to positive reals is an affine function:
FunctionConvexity[{Abs[x], x > 0}, x]
is convex for
, but not strictly convex:
FunctionConvexity[Norm[{x, y}, p], {x, y}, Assumptions -> p ≥ 1]FunctionConvexity[Norm[{x, y, z}, Infinity], {x, y, z}]FunctionConvexity[Norm[{x, y}, p], {x, y}, Assumptions -> p ≥ 1, StrictInequalities -> True]Plot3D[{Norm[{x, y}, 1], Norm[{x, y}, 2], Norm[{x, y}, Infinity]}, ...]The sum of functions with convexity
has convexity
:
f = x ^ 2 + Sin[x];
g = x Erf[x] + E ^ (-x ^ 2);FunctionConvexity[f, x]FunctionConvexity[g, x]FunctionConvexity[f + g, x]Plot[{f, g, f + g}, {x, -3, 3}]The negation of a convex function is concave:
f = E ^ (x ^ 2);FunctionConvexity[f, x]FunctionConvexity[-f, x]Plot[{f, -f}, {x, -2, 2}]The maximum of convex functions is convex:
f = 3Abs[x];
g = E ^ x;FunctionConvexity[f, x]FunctionConvexity[g, x]FunctionConvexity[Max[f, g], x]Plot[{f, g, Max[f, g]}, {x, -2, 2}]Affine functions are both convex and concave, hence their maximum is convex:
aff = Table[RandomReal[{-1, 1}]x + RandomReal[{-1, 1}]y + RandomReal[], {10}];FunctionConvexity[Max@@aff, {x, y}]Plot3D[Evaluate[Max@@aff], {x, -1, 1}, {y, -1, 1}, Mesh -> None]Minimum of affine functions is concave:
FunctionConvexity[Min@@aff, {x, y}]Plot3D[Evaluate[Min@@aff], {x, -1, 1}, {y, -1, 1}, Mesh -> None]A quadratic
is convex iff
is positive semidefinite:
Subscript[A, 1] = {{1, 2}, {3, 4}};
Subscript[f, 1] = {x, y}.Subscript[A, 1].{x, y};PositiveSemidefiniteMatrixQ[Subscript[A, 1]]FunctionConvexity[Subscript[f, 1], {x, y}]Plot3D[Subscript[f, 1], {x, -1, 1}, {y, -1, 1}, Mesh -> None]Subscript[A, 2] = {{1, -2}, {3, 4}};
Subscript[f, 2] = {x, y}.Subscript[A, 2].{x, y};PositiveSemidefiniteMatrixQ[Subscript[A, 2]]FunctionConvexity[Subscript[f, 2], {x, y}]Plot3D[Subscript[f, 2], {x, -1, 1}, {y, -1, 1}, Mesh -> None]Calculus (2)
If
is non-decreasing, then
is a convex function of
:
f = 5t + Cos[5t];FunctionMonotonicity[f, t]Plot[f, {t, -3, 3}]g = Integrate[f, {t, 0, x}]FunctionConvexity[g, x]Plot[g, {x, -3, 3}]The derivative of a convex function is non-decreasing:
f = E ^ -x + 25x ^ 2 + Sin[5x] - 100;FunctionConvexity[f, x]df = D[f, x]FunctionMonotonicity[df, x]The second derivative of a convex function is non-negative:
ddf = D[df, x]FunctionSign[ddf, x]Plot[{f, df, ddf}, {x, -5, 5}]Geometry (4)
If
is a convex function
, then the region
is convex:
f = Log[3 ^ (x + 2 y) + Exp[y + z]] + x ^ 2 + y ^ 2 + z ^ 2;FunctionConvexity[f, {x, y, z}]Use ConvexRegionQ to verify that
is a convex region:
reg = ImplicitRegion@@{f ≤ 1, {x, y, z}};ConvexRegionQ[reg]RegionPlot3D[f ≤ 1, ...]If
is a concave function
, then the region
is convex:
f = 3 - Exp[Norm[{x, y}, 3]];FunctionConvexity[f, {x, y}]Use ConvexRegionQ to verify that
is a convex region:
reg = ImplicitRegion@@{f ≥ 1, {x, y}};ConvexRegionQ[reg]RegionPlot[f ≥ 1, {x, -1, 1}, {y, -1, 1}]If
is a convex function, then the epigraph
is a convex set:
f = Cosh[x];FunctionConvexity[f, x]Use ConvexRegionQ to verify that
is a convex region:
reg = ImplicitRegion@@{f ≤ y, {x, y}};ConvexRegionQ[reg]Plot[f, {x, -2, 2}, Filling -> Top]If
is a concave function, then the hypograph
is a convex set:
f = Log[x];FunctionConvexity[{f, x > 0}, x]Plot[f, {x, 0, 2}, Filling -> Bottom]Optimization (3)
A local minimum of a convex function is a global minimum:
f = Ramp[x];FunctionConvexity[f, x]The set of local and global minima is the non-positive half-line:
Plot[f, {x, -1, 1}]A strictly convex function has at most one local minimum:
f = (x - 3y - 7) ^ 2 + (x + y - 5) ^ 2 + (2x - 3y - 4) ^ 2;FunctionConvexity[f, {x, y}, StrictInequalities -> True]{mval, mpoint} = Minimize[f, {x, y}]Show[{Plot3D[{f, mval}, {x, -5, 5}, {y, -5, 5}, PlotStyle -> Opacity[0.7]], Graphics3D[{Red, PointSize[Large], Point[{x, y, mval} /. mpoint]}]}]A strictly convex function may have no local minima:
f = Exp[x] + Exp[y];FunctionConvexity[f, {x, y}, StrictInequalities -> True]Minimize[f, {x, y}]Plot3D[f, {x, -3, 3}, {y, -3, 3}]Properties & Relations (2)
Sum and Max of convex functions are convex:
f = (Abs[x] ^ 3 + Abs[y] ^ 3) ^ (1 / 3);
g = Log[E ^ x + E ^ y];FunctionConvexity[#, {x, y}]& /@ {f, g, f + g, Max[f, g]}GraphicsGrid[Map[Plot3D[#, {x, -2, 2}, {y, -2, 2}]&, {{f, g}, {f + g, Max[f, g]}}, {2}], ImageSize -> 400]The second derivative of a convex function is non-negative:
f = x ^ 4 - 12x Cos[x] - 4x ^ 2 Sin[x] + 12Sin[x]FunctionConvexity[f, x]Use D to compute the derivative:
g = D[f, {x, 2}]Use FunctionSign to verify that the derivative is non-negative:
FunctionSign[g, x]Plot the function and the derivative:
Plot[{f, g}, {x, -7, 7}]See Also
Related Guides
History
Text
Wolfram Research (2020), FunctionConvexity, Wolfram Language function, https://reference.wolfram.com/language/ref/FunctionConvexity.html.
CMS
Wolfram Language. 2020. "FunctionConvexity." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FunctionConvexity.html.
APA
Wolfram Language. (2020). FunctionConvexity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FunctionConvexity.html
BibTeX
@misc{reference.wolfram_2026_functionconvexity, author="Wolfram Research", title="{FunctionConvexity}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/FunctionConvexity.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_functionconvexity, organization={Wolfram Research}, title={FunctionConvexity}, year={2020}, url={https://reference.wolfram.com/language/ref/FunctionConvexity.html}, note=[Accessed: 13-June-2026]}