3.3 Concave and convex functions of many variables
Convex sets
To extend the notions of concavity and convexity to functions of many variables we first define the notion of a convex set.
 Definition

A set S of nvectors is convex if
(1−λ)x + λx' ∈ S whenever x ∈ S, x' ∈ S, and λ ∈ [0,1].
For example, the twodimensional set in the first of the next two figures is convex, because every line segment joining a pair of points in the set lies entirely in the set. The set in the second figure is not convex, because the line segment joining the points x and x' does not lie entirely in the set.
The following property of convex sets (which you are asked to prove in an exercise) is sometimes useful.
 Proposition
 The intersection of convex sets is convex.
Concave and convex functions
Let f be a function of many variables, defined on a convex set S. We say that f is concave if the line segment joining any two points on the graph of f is never above the graph; f is convex if the line segment joining any two points on the graph is never below the graph. (That is, the definitions are the same as the definitions for functions of a single variable.)More precisely, we can make the following definition (which is again essentially the same as the corresponding definition for a function of a single variable). Note that only functions defined on convex sets are covered by the definition.
 Definition

Let f be a function of many variables defined on the convex set S. Then f is
 concave on the set S if for all x ∈ S, all x' ∈ S, and all λ ∈ (0,1) we have
f((1−λ)x + λx') ≥ (1−λ)f(x) + λf(x')  convex on the set S if for all x ∈ S, all x' ∈ S, and all λ ∈ (0,1) we have
f((1−λ)x + λx') ≤ (1−λ)f(x) + λf(x').
 concave on the set S if for all x ∈ S, all x' ∈ S, and all λ ∈ (0,1) we have
 Definition

Let f be a function of many variables defined on the convex set S. Then f is
 strictly concave on the set S if for all x ∈ S, all x' ∈ S with x' ≠ x, and all λ ∈ (0,1) we have
f((1−λ)x + λx') > (1−λ)f(x) + λf(x')  strictly convex on the set S if for all x ∈ S, all x' ∈ S with x' ≠ x, and all λ ∈ (0,1) we have
f((1−λ)x + λx') < (1−λ)f(x) + λf(x').
 strictly concave on the set S if for all x ∈ S, all x' ∈ S with x' ≠ x, and all λ ∈ (0,1) we have
 Example

Let f be a linear function, defined by f(x) = a_{1}x_{1} + ... + a_{n}x_{n} = a·x on a convex set, where a_{i} is a constant for each i. Then
f is both concave and convex:
f((1 − λ)x + λx') = a·[(1−λ)x + λx'] for all x, x', and λ ∈ [0, 1] = (1−λ)a·x + λa·x' for all x, x', and λ ∈ [0, 1] = (1−λ)f(x) + λf(x') for all x, x', and λ ∈ [0, 1].
 Example

Suppose the function g of a single variable is concave on [a,b], and the function f of two variables is defined by f(x,y) = g(x) on [a, b] × [c, d]. Is f concave?
First note that the domain of f is a convex set, so the definition of concavity can apply.
The functions g and f are illustrated in the following figures. (The axes for g are shown in perspective, like those for f, to make the relation between the two figures clear. If we were plotting only g, we would view it straight on, so that the xaxis would be horizontal. Note that every crosssection of the graph of f parallel to the xaxis is the graph of the function g.)
From the graph of f (the roof of a horizontal tunnel), you can see that it is concave. The following argument is precise.
f((1−λ)(x, y) + λ(x', y')) = f((1−λ)x + λx', (1−λ)y + λy') = g((1−λ)x + λx') ≥ (1−λ)g(x) + λg(x') = (1−λ)f(x, y) + λf(x', y')
 Example

Let f and g be defined as in the previous example. Assume now that g is strictly concave. Is f strictly concave?
The strict concavity of f implies that
f((1−λ)(x, y) + λ(x', y')) > (1−λ)f(x, y) + λf(x', y') f((1−λ)(x, y) + λ(x', y')) = f(x, (1−λ)y + λy') = g(x) = (1−λ)f(x, y) + λf(x, y').
Characterizations of concave and convex functions
Having seen many examples of concave functions, you should find it plausible that a function is concave if and only if the set of points under its graph—the set shaded pink in the following figure—is convex. The result is stated precisely in the following proposition.
 Proposition
 A function f of many variables defined on the convex set S is
 Proof

Let L = {(x, y): x ∈ S and y ≤ f(x)}.
First suppose f is concave and let (x, y) ∈ L and (x', y') ∈ L. Then x ∈ S, x' ∈ S, y ≤ f(x) and y' ≤ f(x'). The last two inequalities imply that
(1 − λ)y + λy' ≤ (1 − λ)f(x) + λf(x') for any λ ∈ [0, 1]. (1 − λ)f(x) + λf(x') ≤ f((1 − λ)x + λx').Thus(1 − λ)y + λy' ≤ f((1 − λ)x + λx'),and hence ((1 − λ)x + λx', (1 − λ)y + λy') = (1 − λ)(x, y) + λ(x', y') ∈ L, establishing that L is convex.Conversely, suppose L is convex. Let x ∈ S and x' ∈ S. Then (x, f(x)) ∈ L and (x', f(x')) ∈ L, so by the convexity of L, (1 − λ)(x, f(x)) + λ(x', f(x')) = ((1 − λ)x + λx', (1 − λ)f(x) + λf(x')) ∈ L for any λ ∈ [0, 1]. Thus (1 − λ)f(x) + λf(x') ≤ f((1 − λ)x + λx'), establishing that f is concave.
The argument for a convex function is symmetric.
 Proposition (Jensen's inequality)

A function f of many variables defined on the convex set S is concave if and only if for all n ≥ 2
f(λ_{1}x_{1} + ... + λ_{n}x_{n}) ≥ λ_{1}f(x_{1}) + ... + λ_{n}f(x_{n})
i=1λ_{i} = 1.The function f of many variables defined on the convex set S is convex if and only if for all n ≥ 2
f(λ_{1}x_{1} + ... + λ_{n}x_{n}) ≤ λ_{1}f(x_{1}) + ... + λ_{n}f(x_{n})
i=1λ_{i} = 1.
 Proof

Here is the proof for concavity; the proof for convexity is analogous.
If the inequality is satisfied for all n, it is satisfied in particular for n = 2, so that f is concave directly from the definition of a concave function.
Now suppose that f is concave. Then the definition of a concave function implies directly that the inequality is satisfied for n = 2. To show that it is satisfied for all n ≥ 3 I argue by induction. Let m ≥ 2 and suppose that the inequality is satisfied for all n ≤ m. I show that it is satisfied for n = m + 1. Take any x_{1} ∈ S, ..., x_{m+1} ∈ S and λ_{1} ≥ 0, ..., λ_{m+1} ≥ 0 with ∑m+1
i=1λ_{i} = 1. If λ_{1} = 1 then λ_{2} = ... = λ_{m+1} = 0, so that the inequality is trivially satisfied. If λ_{1} < 1 thenf(∑m+1
i=1λ_{i}x_{i})= f(λ_{1}x_{1} + (1 − λ_{1})∑m+1
i=2(λ_{i}/(1−λ_{1}))x_{i})≥ λ_{1}f(x_{1}) + (1 − λ_{1})f(∑m+1
i=2(λ_{i}/(1−λ_{1}))x_{i})
i=2(λ_{i}/(1−λ_{1}))x_{i}, and λ = 1 − λ_{1} in the definition of a concave function. Now, because the inequality is satisfied for n = m we havef(∑m+1
i=2(λ_{i}/(1−λ_{1}))x_{i})≥ ∑m+1
i=2(λ_{i}/(1−λ_{1}))f(x_{i}),f(∑m+1
i=1λ_{i}x_{i})≥ λ_{1}f(x_{1}) + (1 − λ_{1})∑m+1
i=2(λ_{i}/(1−λ_{1}))f(x_{i})= ∑m+1
i=1λ_{i}f(x_{i}),
Differentiable concave and convex functions
A previous result shows that the graph of a concave function of a single variable lies everywhere on or below all of its tangents. The generalization of this result to concave functions of many variables says that the graph of such a function lies everywhere on or below all of its tangent planes. As for a function of a single variable, a symmetric result holds for convex functions. Like the result for functions of a single variable, it is used to show that stationary points are global maximizers of concave functions and global minimizers of convex functions. Proposition

The differentiable function f of n variables defined on a convex set S is concave on S if and only if
f(x) − f(x*) ≤ ∑n
i=1f'_{i}(x*)·(x_{i} − x*_{i}) for all x ∈ S and x* ∈ Sf(x) − f(x*) ≥ ∑n
i=1f'_{i}(x*)·(x_{i} − x*_{i}) for all x ∈ S and x* ∈ S.
 Source
 One proof follows the lines of the proof of the analogous result for a function of a single variable. For details, see Sydsæter and Hammond (1995), Theorem 17.7 (p. 629). (Note that by this result their assumption that the function has continuous partial derivatives is equivalent to the assumption that the function is continuously differentiable, and by Corollary 25.5.1 (p. 246) in Rockafellar (1970), a differentiable convex function, and hence a differentiable concave function, is continuously differentiable.) Simon and Blume (1994), Theorem 21.3 (p. 511), give a different proof.
Twicedifferentiable concave and convex functions
A twicedifferentiable function of a single variable is concave if and only if its second derivative is nonpositive everywhere.To determine whether a twicedifferentiable function of many variables is concave or convex, we need to examine all its second partial derivatives. We call the matrix of all the second partial derivatives the Hessian of the function.
 Definition

Let f be a twicedifferentiable function of n variables. The Hessian of f at x is
H(x) = f"_{11}(x) f"_{12}(x) ... f"_{1n}(x) f"_{21}(x) f"_{22}(x) ... f"_{2n}(x) ... ... ... ... f"_{n1}(x) f"_{n2}(x) ... f"_{nn}(x) .
We can determine the concavity/convexity of a function by determining whether the Hessian is negative or positive semidefinite, as follows.
 Proposition

Let f be a function of many variables with continuous partial derivatives and cross partial derivatives on the convex open set S and denote the Hessian of
f at the point x by H(x). Then
 f is concave if and only if H(x) is negative semidefinite for all x ∈ S
 if H(x) is negative definite for all x ∈ S then f is strictly concave
 f is convex if and only if H(x) is positive semidefinite for all x ∈ S
 if H(x) is positive definite for all x ∈ S then f is strictly convex.
 Source
 For a proof, see Sydsæter and Hammond (1995), Theorems 17.13 (p. 640) and 17.14 (p. 641).
Thus if you want to determine whether a function is strictly concave or strictly convex, you should first check the Hessian. If the Hessian is negative definite for all values of x then the function is strictly concave, and if the Hessian is positive definite for all values of x then the function is strictly convex. If the Hessian is not negative semidefinite for all values of x then the function is not concave, and hence of course is not strictly concave. Similarly, if the Hessian is not positive semidefinite the function is not convex. If the Hessian is not negative definite for all values of x but is negative semidefinite for all values of x, the function may or may not be strictly concave; you need to use the basic definition of strict concavity to determine whether it is strictly concave or not. Similarly, if the Hessian is not positive definite for all values of x but is positive semidefinite for all values of x, the function may or may not be strictly convex.
 Example

Consider the function f(x, y) = 2x − y − x^{2} + 2xy − y^{2} defined on the set of all pairs of numbers. Its Hessian is
−2 2 2 −2
 Example

Consider the function f(x_{1}, x_{2}, x_{3}) = x2
1 + 2x2
2 + 3x2
3 + 2x_{1}x_{2} + 2x_{1}x_{3} defined on the set of all triples of numbers. Its first partials aref'_{1}(x_{1}, x_{2}, x_{3}) = 2x_{1} + 2x_{2} + 2x_{3} f'_{2}(x_{1}, x_{2}, x_{3}) = 4x_{2} + 2x_{1} f'_{3}(x_{1}, x_{2}, x_{3}) = 6x_{3} + 2x_{1}. f"_{11} f"_{12} f"_{13} f"_{21} f"_{22} f"_{23} f"_{31} f"_{32} f"_{33} = 2 2 2 2 4 0 2 0 6 .
 Example

Consider the CobbDouglas function, defined by f(K, L) = AK^{a}L^{b} on the set of pairs (K, L) with K ≥ 0 and L ≥ 0. Assume that A > 0. The Hessian of this function is
a(a−1)AK^{a−2}L^{b} abAK^{a−1}L^{b−1} abAK^{a−1}L^{b−1} b(b−1)AK^{a}L^{b−2} .
 Proposition

Let f and g be functions of many variables.
 If f and g are concave and a ≥ 0 and b ≥ 0 then the function h defined by h(x) = af(x) + bg(x) for all x is concave.
 If f and g are convex and a ≥ 0 and b ≥ 0 then the function h defined by h(x) = af(x) + bg(x) for all x is convex.
 Example

A firm produces the output f(x) from the vector x of inputs, which costs it c(x). The function f is concave and the function c is convex. The firm sells its output at a fixed price p > 0. Its profit when it uses the input vector x is
π(x) = pf(x) − c(x).That is, π is the sum of two functions, pf and −c. The function −c is concave because c is convex, so by the proposition π is concave.