I have a function: $ u(x) = x_{1} + x_{2} + \min\{x_{1}, x_{2}\}$. How do we algebraically show if it's convex or not? Also, what would be the general way to show if any given function is convex.


2 Answers 2


This is an edit

By definition,for a convex subset $C\subseteq \mathbb{R}^n$ a convex function $f:C \to \mathbb{R}$ satisfy

$$ f((1-t)x+ty)\leq (1-t)f(x)+tf(y)$$

for every $x,y\in C$ and $t \in (0,1)$.

We can see if we let $x=(1,3)$ and $y=(3,1)$ and $t=\frac{1}{2}$ that

$$ u((1-t)x+ty)=u(2,2)=6 \not \leq 5=\frac{u(1,3)}{2}+\frac{u(3,1)}{2}=(1-t)u(x)+tu(y)$$

meaning your function is not convex. As you mentioned in the comments, the fact that the $\min$ function is not differentiable around $x_1=x_2$ gave you a false answer, since the function is piecewise linear.

The rest of my original answer is irrelevant to the question now, but is still usefull to know.

More generally it helps to know the subspace of convex functions over $\mathbb{R}^n$ is a cone in the vectorspace of functions over $\mathbb{R}^n$.

Specifically, let $C$ be the set of convex functions over $\mathbb{R}^n$, i.e. $\mathbb{R}^n \to \mathbb{R}$.

If $f,g\in C$ and $a,b\in \mathbb{R}^+$ then $a\cdot f+b\cdot g \in C$

This means that you can start to see if "complicated" functions are convex, if they are a conic combination of known convex functions.

  • $\begingroup$ Hi, can you give an example of a complicated convex function and how it arises from a simpler convex function? $\endgroup$ Oct 19, 2019 at 2:09
  • 1
    $\begingroup$ I have changed my wording to be more precise, but an example would be $f(x,y,z)=23x^4+652y^8+1543z^{12}$ and $g(x,y,z)=exp(xyz)$, then $f+g$ is convex because it is the sum of convex functions. (in fact $f$ itself is a sum of convex functions). $\endgroup$ Oct 19, 2019 at 8:43
  • $\begingroup$ In your example above, how did you get 6 in $$ u((1-t)x+ty)=u(2,2)=6$$? I understand you have plugged 2, 2 in a utility function. What utility function is that? $\endgroup$ Oct 21, 2019 at 22:58
  • $\begingroup$ in your utility function. I must assume $x=(x_1,x_2)$, meaning plugging (2,2) into your utility function $u(x_1,x_2)=x_1+x_2+\min\{x_1,x_2\}$ gives $u(2,2)=2+2+\min\{2,2\} = 6$. $\endgroup$ Oct 22, 2019 at 7:49

I assume you meant $u(x_1,x_2)=x_1+x_2+\min\{x_1,x_2\}$. To check if a function of two or more variables is convex, you need to check if you can differentiate it twice, calculate its Hessian and check if it is positive semi-definite. On top of that the domain needs to be a convex set but since we talk about utility in economics - you don't need to worry about that too much - Can A Utility Function Take On Negative Values?

In your example: $$\mathbf{H}=\begin{bmatrix} \frac{\partial^2u}{\partial x_1^2} & \frac{\partial^2u}{\partial x_1x_2} \\ \frac{\partial^2u}{\partial x_1x_2} & \frac{\partial^2u}{\partial x_2^2} \\ \end{bmatrix}=\begin{bmatrix} 0 & 0 \\ 0 & 0 \\ \end{bmatrix}$$

so it is?

The approach described above is a general way of showing a function being convex but as pointed in the comment section, you need to be careful - make sure that all the assumptions are met before jumping to conclusions. (Or else, you end up being mistaken as me right now.)


Minimum function mislead me, I agree.

Let's get back to basics:

$u(x_1,x_2)=x_1+x_2+\min(x_1,x_2)=x_1+x_2 + \frac{x_1+x_2-|x_1-x_2|}{2}=\begin{cases}x_1+2x_2 \;\; \mathrm{for} \;\; x_1 \geq x_2\\ 2x_1+x_2 \;\; \mathrm{for} \;\; x_1<x_2 \end{cases}$

It looks like that (on horizontal axis $x_1$, on vertical axis $x_2$: enter image description here

It is neither convex, nor concave. Due to the absolute value function that is in a core of minimum function: Why is the absolute value function not differentiable at x=0?

I thought that eliminating point where $x_1=x_2$ would solve the issue but as shown in the other answer - it does not.

EDIT. 2 (final)

It is, in fact, concave as the user @afreelunch was telling me. You can see it directly from the definition. Or (what I think is even easier) from the way our utility function is built.

We have $u(x_1,x_2) = \min\{2x_1+x_2,x_1+2x_2\}$. Now, let's take it apart: $f_1(x_1) = 2x_1$ and $g_1(x_2) = x_2$, they are both linear Is linear function convex or concave? - hence, concave (and convex but we care about concavity here) and therefore their sum (property of concave function) $h_1(x_1,x_2)=2x_1+x_2$ is also concave. Similarly, $f_2(x_1) = x_1$ and $g_2(x_2)=2x_2$ and $h_2(x_1,x_2)=x_1+2x_2$ is concave as well. Knowing that, we get $\min\{h_1(x_1,x_2),h_2(x_1,x_2)\}$ - minimum of two concave functions - which is then concave (also a well known fact).

In short, minimum preserves concavity (and maximum preserves convexity).

  • 1
    $\begingroup$ But is the min function differentiable? $\endgroup$
    – user17900
    Oct 19, 2019 at 0:44
  • $\begingroup$ it is not but partial derivatives are pretty straightforward; math.stackexchange.com/questions/150960/… $\endgroup$
    – bajun65537
    Oct 19, 2019 at 1:01
  • $\begingroup$ Graphically, it looks like it is convex, but the hessian is 0. So, how do we conclude that it is convex? The partial derivatives are also 0. $\endgroup$ Oct 19, 2019 at 2:12
  • $\begingroup$ Zero matrix is positive semidefinite (and negative semidefinite at the same time). Look here for some logic behind it: math.stackexchange.com/questions/3153187/… Hessian you ended up with is a 2x2 zero matrix with all its eigenvalues being non-negative, meaning that it is, in fact, positive semidefinite. From here you conclude that the utility function is convex. $\endgroup$
    – bajun65537
    Oct 19, 2019 at 9:02
  • 1
    $\begingroup$ Perhaps start with the definition of concave? (There is no need to involve derivatives, this function is not differentiable). NB max is convex $\endgroup$
    – user17900
    Oct 23, 2019 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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