Assume that $f:\mathbb{R}^{2}\to \mathbb{R}$ is a continuous function such that each level set $f^{-1}(c)$ is a convex set.
To what extent such functions are studied? 


In particular:


1. Is there a partial or total ordering on $\mathbb{R}^{2}$ such that all functions with this property, must be monotone?


2.Is it true to say that $f$ is differentiable, almost every where?


These two questions are motivated by the fact that this property for continuous functions $f:\mathbb{R} \to \mathbb{R}$ is equivalent to monoton property and every monoton function from $\mathbb{R}\to \mathbb{R}$ is almost every where differentiable.


**Note:** As usual, a convex set in the plane is a subset $C$ such that $\forall a,b\in C$ and $\forall t\in [0,1]$ we have $ta+(1-t)b\in C$



Continuous functions with convex level sets
Let's call the functions defined by Ali Taghavi to be sliced functions: a continuous function $\ f:\mathbb R^2\rightarrow\mathbb R\ $ is called *sliced* $\ \Leftarrow:\Rightarrow\ \ \forall\_{c\in\mathbb R}\ f^{-1}(c)\ $ is convex.



> 
> **NOTATION**: 
>  $$\ [x;y]\ :=\ \{(1\!-\!t)\cdot x\ +\ t\cdot y\ :\ 0\le t\le 1\}\ $$
>  for arbitrary $\ x\ y\in \mathbb R^n\ $ and $\ n=0\ 1\ 2\ \ldots.\ $ Thus $\ [x;y]=[y;x]\ $ in every dimension including $\ n=1$.
> 
> 
> 


**THEOREM 0**   Let $\ f:\mathbb R^2\rightarrow \mathbb R\ $ be sliced. Then $\ f^{-1}(C)\ $ is convex for every convex $\ C\subseteq\mathbb R$.


**PROOF**   Let $\ C\subseteq \mathbb R\ $ be convex. Let $\ a\ b\in C.\ $ We want to show that


$$\ [a;b]\ \subseteq\ C $$


If $\ f(a)=f(b)\ $ then the above holds due to the convex part of the definition of a sliced function.


Now, assume $\ f(a)\ne f(b).\ $ Then $\ f^{-1}([f(a);f(b)])\ \cap\ [a;b]\ $ is a closed subset of $\ [a;b].\ $ Next, consider arbitrary $\ x\ y \in [a;b]\cap f^{-1}([f(a);f(b)],\ $ and $\ x\ne y.\ $ If $\ f(x)=f(y)\ $ then again


$$ [x;y]\ \subseteq f^{-1}(x)\ \subseteq\ f^{-1}([f(a);f(b)]) $$


And if $\ f(x)\ne f(y)\ $ then, due to continuity of $\ f\ $ (and of the nature of $\ \mathbb R$) we have


$$ f([x;y])\ \supseteq\ [f(x);f(y)] $$


Thus there exists $\ w\in[x;y]\ $ such that


$$ f(w)\ =\ \frac {f(x)+f(y)}2 $$


We see that $\ w\in(x;y)\ $ belongs to the interior of the interval, and $\ w\in f^{-1}[f(a);f(b)].\ $ This shows that $[a;b]\cap f^{-1}([f(a);f(b)])\ $ is dense in $\ [a;b],\ $ hence $\ [a;b]\subset f^{-1}(C).\ $ **END of PROOF**



> 
> After this exercise we get:
> 
> 
> 


**THEOREM 1**   Let $\ f:\mathbb R^2\rightarrow \mathbb R\ $ be sliced. Then there exists $\ (a\ b)\in\mathbb R^2\setminus\{(0\ 0)\}\ $ such that:


$$\forall\_{(x\ y)\,\ (x'\ y')\,\in\,\mathbb R^2 }\ \ \left(\ a\cdot x+b\cdot y = a\cdot x'+b\cdot y'\ \ \Rightarrow\ \ f(x\ y)=f(x'\ y')\ \right)$$


**PROOF**   The case of a constant function is trivial. Otherwise there exists $\ h\in\mathbb R\ $ such that both sets $\ f^{-1}((-\infty\;h))\ $ and $\ f^{-1}((h;\infty))\ $ are non-empty. Then these two sets are disjoint open half-planes, i.e. they are non-empty, open and convex, and the complement of each of them is non-empty, closed and convex. Thus there exist $\ s\ t\in\mathbb R\ $ and $\ (a\ b)\in\mathbb R^2\setminus\{(0\ 0\}\ $ such that $\ s<t\ $ and


$$f(x\ y) = h\quad\Leftrightarrow\quad s\ \le\ a\cdot x+b\cdot y\ \le\ t$$


Then this $\ (a\ b)\ $ is the one required by the theorem. **END of PROOF**



> 
> This is about all about the general structure of the sliced functions.
> 
> 
> 


A sliced function is constant in the direction perpendicular to the vector $\ (a\ b)\in\mathbb R\setminus\{(0\ 0)\}\ $ (see above), and it is monotone along that direction: let $\ \phi:\mathbb R\rightarrow\mathbb R\ $ be given by:


$$\forall\_{u\in\mathbb R}\ \ \phi(u)\ :=\ f\left(u\cdot(a\ b)\right)$$


Then $\ \phi\ $ is monotonne. Thus each slide function is differentiable almost everywhere.


