# Examples of continuous functions that are monotone along all lines

I am looking for different examples (or even a complete characterization if this is possible) of continuous functions that are monotone along all lines. By that I mean functions $$f\colon X\to\mathbb{R}$$ such that for all $$x,y\in X$$ the function $$g_{x,y}:[0,1]\to\mathbb{R}$$, $$\alpha\mapsto f(\alpha x + (1-\alpha)y)$$ is monotone. $$X\subset\mathbb{R}^n$$ should be convex so that everything is well defined.

If $$n=1$$ and $$X$$ is an interval then obviously these are just the the usual monotone functions. Also for general $$n$$, every affine function is monoton allong all lines since $$f(\alpha x + (1-\alpha)y)=\alpha f(x) + (1-\alpha) f(y)$$. What other examples of functions are there satisfying this property?

Note that there are easy examples of functions $$\big(\text{ like }f(x)=\Vert x\Vert^2\big)$$ such that if you fix a certain $$x$$ (here $$x=0$$ ), then $$g_{x,y}$$ is monotone for all $$y$$. However $$f$$ is still not monotone allong all lines. Also this choice of $$f$$ shows that there seems to be no easy criterion, like looking at partial derivatives for example.

• Do you know any non-trivial such functions in dimension 2? For example, If $X$ is the unit disk in $\mathbf{R}^2$, $f(0,0)=0$, $f(0,1)=1,$ and $f(1,0)\geq1.$ Then for any $0<b\leq1$. There are $0<x_b\leq1$ and $0<y_b\leq1$ such that $f(x_b,0)=f(0,y_b)=b$. Hence, for any $b$, $f$ is constant on the line $\alpha(0,y_b)+(1-\alpha)(x_b,0)$. My gut says a bit more effort shows $f$ must be constant or linear. Commented May 17 at 13:50
• I think you mean $X=[0,1]^2$. Unfortunately I don't have any non-trivial examples for $n\geq2$. Commented May 17 at 14:10
• For instance, any affine function $\Bbb R^n \to \Bbb R$ followed by a monotone function $\Bbb R \to \Bbb R$ is an example, giving many non-affine examples (eg $(x, y) \mapsto x^3$). In general we can observe that the level sets of such a function must all be convex, though. Commented May 17 at 15:01

As I commented, there are many examples of the form "a monotone function $$\Bbb R \to \Bbb R$$ composed with a linear functional $$\Bbb R^n \to \Bbb R$$". In general, not all examples are of this type. For instance, if $$X$$ is the open upper half-disc in $$\Bbb R^2$$, then the function that sends the point $$(x, y)$$ to its polar angle $$\theta$$ is line-monotone, but is not of that form (since the level sets are not parallel to each other). I will show in this answer that if $$X$$ is open (which you can assume without loss of generality) then most of the level sets are intersections of a hyperplane with $$X$$, so in general to think of examples you can "sweep out $$X$$ by continuously moving a hyperplane". I think this can be probably made into some sort of general characterisation, but I am not sure how useful that is. More usefully, it follows from this that in the case $$X = \Bbb R^n$$, all examples are actually of the above form of a "linear-monotone composition", roughly because the only possible way to sweep is by sweeping in a straight line with a hyperplane that doesn't change orientation.

So suppose that $$X \subseteq \Bbb R^n$$ is convex. We can assume that $$X$$ has non-empty interior, by passing to the affine subspace of $$\Bbb R^n$$ spanned by $$X$$. In this case, we might as well just work with the interior of $$X$$ - so suppose that $$X$$ is open. Suppose $$f: X \to \Bbb R$$ is continuous and line-monotone. What follows is some $$n$$-dimensional convex geometry. I would recommend assuming that $$n = 2$$ or $$n = 3$$ if you need to visualise anything. I am not fully working out all the details, and will use some intuitive "geometric" language in favour of heavy notation.

Lemma. If a level set $$f^{-1}(y)$$ is non-empty, then its affine span has dimension at least $$n - 1$$.

Proof. We know $$f^{-1}(y)$$ is convex. Let $$H$$ be the affine span of $$f^{-1}(y)$$. If $$H$$ has dimension less than $$n - 1$$, then we can take a two-dimensional plane $$P$$ in $$\Bbb R^n$$ that intersects $$H$$ at a single point $$x \in f^{-1}(y)$$. Then $$f|_{P \cap X}$$ has an extremum at $$x$$, since the values taken by $$f$$ on $$(P \cap X) \setminus \{x\}$$ are a connected subset of $$\Bbb R \setminus \{y\}$$. But this is clearly absurd by the line-monotonicity of $$f$$. So the affine span of $$f^{-1}(y)$$ has dimension at least $$n - 1$$. QED.

Lemma. If a level set $$f^{-1}(y)$$ is non-empty but has empty interior, then $$f^{-1}(y)$$ is the intersection of a hyperplane with $$X$$.

Proof. By the above, the affine span $$H$$ of $$f^{-1}(y)$$ has dimension at least $$n - 1$$. We know $$f^{-1}(y)$$ contains some affinely independent points spanning $$H$$, and hence $$f^{-1}(y)$$ contains some convex set $$U \subseteq H$$ which is open in $$H$$. Since $$f^{-1}(y)$$ is assumed to have empty interior, it follows that $$H$$ is $$(n - 1)$$-dimensional (that is, a hyperplane). Let $$\pi: X \to H$$ be the orthogonal projection map.

Consider the set $$\pi^{-1}(U)$$. Note that this set is convex, and it's split into two halves by $$U$$. Any line between points from the two different halves must cross through $$U$$. It follows then from line-monotonicity that $$f > y$$ on one half and $$f < y$$ on the other half of $$\pi^{-1}(U)$$. Let's say that the half where $$f > y$$ is in the "positive direction from $$H$$".

Note also that $$X$$ itself is split into two halves by $$H$$. Suppose a point $$x \in X \setminus H$$ is in the positive direction from $$H$$. Let $$x'$$ be a point in $$\pi^{-1}(U)$$, in the negative direction from $$H$$. By taking $$x'$$ very close to $$U$$, we can assume that the line segment $$[x, x']$$ intersects $$U$$ ("if you stand sufficiently close to a window in $$H$$, then you can see the entire half-space on the other side of the window"). Since $$f(x') < y$$, we must have $$f(x) > y$$, by line-monotonicity. Similarly, if $$x \in X \setminus H$$ is in the negative direction from $$H$$, then $$f(x) < y$$. So, we can extend the inequalities $$f > y$$ and $$f < y$$ to all of $$X \setminus H$$. Now by continuity, it follows that $$f = y$$ on $$H$$ - so $$f^{-1}(y) = X \cap H$$, as desired. QED.

Note that it is possible for a level set to have a non-empty interior. For example, consider the function $$x \mapsto \max\{0, x\}$$. However, this lemma is strong enough to obtain the following:

Lemma. If $$X = \Bbb R^n$$, then every line-monotone function is a composition of a linear functional with a monotone function.

Proof. If $$f$$ is constant, then are done. So we can assume the image of $$f$$ is a nondegenerate interval. In particular, $$f$$ has uncountably many level sets, and only countably many of them can have a non-empty interior (as $$\Bbb R^n$$ is separable). All of the level sets with an empty interior are hyperplanes, by the previous lemma. These hyperplanes must all be parallel, as otherwise they would intersect. Let the union of all these hyperplanes be $$X'$$.

Let $$\varphi$$ be a linear functional whose kernel is parallel to these hyperplanes, such that if $$x' \in X'$$ and $$x \in X$$ then $$f(x') < f(x)$$ if and only if $$\varphi(x') < \varphi(x)$$. (In other words, $$\varphi$$'s sign is chosen to be consistent with the "positive direction").

Now in general, if $$y$$ is any point in the image of $$f$$, then $$f(x) = y$$ is equivalent to $$f(x) > y'$$ for all $$y' \in f(X') \cap (-\infty, y)$$ and $$f(x) < y'$$ for all $$y' \in f(X') \cap (y, \infty)$$. This is because $$f(X')$$ contains all but countably many points of the image of $$f$$, so $$y$$ can be approached from above and below by points in $$f(X')$$.

From this it follows that $$f^{-1}(y)$$ is a "thick hyperplane" $$\varphi^{-1}([a, b])$$ where $$a = \sup\varphi(\{x \in X' : f(x) < y\})$$ and $$b = \inf\varphi(\{x \in X' : f(x) > y\})$$.

Hence $$f$$ can be written as a function of $$\varphi$$, which must of course be monotone. This function can be realised up to scaling as the restriction of $$f$$ to a complement of the kernel of $$\varphi$$, which is an easy way to see that it's continuous. QED.

• This is awesome! Commented May 17 at 19:47

As Izaak van Dongen has pointed out in the comments, one could try to think about convexity of the level sets. This yields a characterization of the continuous functions which are monotone along all lines.

Let $$X\subseteq \mathbb{R}^n$$ be convex (and nonempty) and $$f: X\rightarrow \mathbb{R}$$ continuous.

Assume that $$f$$ is monotone along all lines. Let $$x,y\in f^{-1}(\{a\})$$. As $$f_{x,y}$$ is continuous, monotone and $$f_{x,y}(1)=f(x)=a=f(y)=f_{x,y}(0)$$, we get that $$f_{x,y}\equiv a$$ is constant. This implies that $$f^{-1}(\{a\})$$ is convex.

On the other hand, if $$f$$ is not monotone along all lines, then there exists $$x,y\in X$$ such that $$f_{x,y}$$ is not monotone. As $$f_{x,y}$$ is continous, this means that there exists $$0\leq\lambda_1<\lambda_2<\lambda_3\leq 1$$ such that $$f_{x,y}(\lambda_1)=f_{x,y}(\lambda_3)=:a$$ and $$f_{x,y}(\lambda_2)\neq f_{x,y}(\lambda_1)$$. This implies that $$f^{-1}(\{a\})$$ is not convex.