# Constructing a quasiconvex function

Let $C\subset\mathbb{R}^2$ be a nonempty convex set. A function $f:C\rightarrow\mathbb{R}$ is called

• convex if $$f(\lambda u+(1-\lambda)v)\leq\lambda f(u)+(1-\lambda)f(v), \quad\forall u,v\in C, \forall\lambda\in(0,1);$$

• quasiconvex if $$f(\lambda u+(1-\lambda)v)\leq\max\{f(u), f(v)\}, \quad\forall u,v\in C, \forall\lambda\in(0,1).$$

It is easy to very find that convexity implies quasiconvexity. The reverse implication is not true in general.

Counterexample. The function $$f(x,y) = \begin{cases} 0 &\mbox{if } \quad0<x<1, y=1, \\ 1 & \mbox{if } \quad\text{otherwise}. \end{cases}$$ is quasiconvex but not convex on $C=[0,1]\times[0,1]$.

• $f$ is not convex on $C$. Indeed, we have $(0.5,1), (0,0)\in C$ and $$f\left(\frac{1}{2}(0.5,1)+\frac{1}{2}(0,0)\right)=f(0.25,0.5)=1>0.5=\frac{1}{2}f\left(0.5,1\right)+\frac{1}{2}f(0,0).$$

• $f$ is quasiconvex on $C$. Indeed, let $u, v\in C$. We consider two cases:

Case 1. $u, v\in (0,1)\times\{1\}$

Then, $\lambda u+(1-\lambda)v\in (0,1)\times\{1\}$ for all $\lambda\in(0,1)$ and so $$f(\lambda u+(1-\lambda)v)=0=\max\{f(u),f(v)\};$$

Case 2. $u\notin (0,1)\times\{1\}$ or $v\notin (0,1)\times\{1\}$

Then, $\max\{f(u),f(v)\}=1$, and so $$f(\lambda u+(1-\lambda)v)\leq\max\{f(u),f(v)\}, \quad \forall \lambda\in (0,1).$$

Question.

We would like to construct a function $f(x,y):C\rightarrow\mathbb{R}$ with $C\subset\mathbb{R}^2$ being convex such that:

(1) $f(x,y)$ is not convex on $C$;

(2) $f(x,y)+\lambda y$ is quasiconvex on $C$ for all $\lambda\in\mathbb{R}$ .

Thanks for all helping and comments.

Very similar to your example. On $C = [0,1] \times [0,1]$, $$f(x,y) = \cases{ 1 & if x \ge 1/2 and y = 1\cr 0 & otherwise\cr}$$ Let $g(x,y) = f(x,y) + \lambda y$. Note that the only cases where $f(t p + (1-t) q) > t f(p) + (1-t) f(q)$ have one of $p$ and $q$, say $p$, is in $[0,1/2] \times \{1\}$ and the other in $(1/2, 1] \times \{1\}$, and then $g(t p + (1-t) q) - \max(g(p),g(q)) = f(tp + (1-t) q) - \max(f(p),f(q) = 0$.