# Algebraic approach towards convexity

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.

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.

• Hi, can you give an example of a complicated convex function and how it arises from a simpler convex function? Oct 19 '19 at 2:09
• 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). Oct 19 '19 at 8:43
• 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? Oct 21 '19 at 22:58
• 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$. Oct 22 '19 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.)

EDIT.

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

It looks like that (on horizontal axis $$x_1$$, on vertical axis $$x_2$$:

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).

• But is the min function differentiable?
– user17900
Oct 19 '19 at 0:44
• it is not but partial derivatives are pretty straightforward; math.stackexchange.com/questions/150960/… Oct 19 '19 at 1:01
• 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. Oct 19 '19 at 2:12
• 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. Oct 19 '19 at 9:02
• Perhaps start with the definition of concave? (There is no need to involve derivatives, this function is not differentiable). NB max is convex
– user17900
Oct 23 '19 at 9:36