A little problem about monotonous functions

Last entry was about the fundamental theorem of algebra, a big result at the time (beginning of the 19th century), although it is no longer considered difficult. Today a would just like to talk about a little problem a friend came up with. Actually it occurred while he was teaching first year students. They had to solve an exercise, one of them asked a question, he reformulated it, and finally he obtained the following question.

Consider the vector space over the field $\mathbb{R}$ of the functions from $\mathbb{R}$ to $\mathbb{R}$ (we will call it $\mathcal{F}(\mathbb{R},\mathbb{R})$). What are the subspaces of this vector space that contain only monotonous functions?

As he pointed out, there are three rather obvious examples:
-the null space (duh!),
-the line spanned by a monotonous function,
-the two-dimensional vector space spanned by a continuous function and a constant function (say $1$).
In fact those are the only possibilities. That is rather easy to prove, but a bit long. Maybe it can be shortened. Anyway, we first need to rule out the case of three-dimensional vector spaces and higher.

Lemma 1

Let $X$ be a set and $\mathbb{K}$ a (commutative) field. Let $\mathcal{F}(X, \mathbb{K})$ be the vector space over $\mathbb{K}$ of the functions from $X$ to $\mathbb{K}$. The functions $f_1,\dots,f_n$ taken in $\mathcal{F}(X,\mathbb{K})$ are linearly independent if, and only if, there exist $x_1,\dots,x_n \in X$ such that

$\displaystyle \left| \begin{array}{ccc} f_1(x_1)&\cdots&f_n(x_1)\\ \vdots&\ddots&\vdots\\ f_1(x_n)&\vdots&f_n(x_n) \end{array} \right| \neq 0.$

Proof. One of the implication is simpler. If we are given $f_1,\dots,f_n$ such that there is a non-zero determinant as stated, then $f_1,\dots f_n$ are linearly independent. Indeed, if $\alpha_1 f_1+\dots+\alpha_n f_n \equiv 0$, then we have in particular

$\displaystyle \left\{ \begin{array}{lcl} \alpha_1f_1(x_1)+\cdots+\alpha_n f_n(x_1)&=&0;\\ &\vdots&\\ \alpha_1 f_1(x_n)+\cdots+\alpha_n f_n(x_n)&=&0. \end{array} \right.$

Because its determinant is not zero, the system in $\alpha_1,\dots,\alpha_n$ has a unique solution, namely $\alpha_1=\dots =\alpha_n=0$.
The other implication is a rather straightforward induction on $n$. Assume that the implication holds for $n \in \mathbb{N}^*$. Let $f_1,\dots , f_n, f_{n+1}$ be linearly independent functions. By the induction hypothesis, there exist $x_1, \dots , x_n \in \mathbb{R}$ such that

$\displaystyle \left| \begin{array}{ccc} f_1(x_1)&\cdots&f_n(x_n)\\ \vdots &\ddots&\vdots \\ f_1(x_n)&\cdots&f_n(x_n) \end{array} \right| \neq 0.$

If, for all $x \in \mathbb{R}$,

$\displaystyle \left| \begin{array}{cccc} f_1(x_1)&\cdots&f_n(x_1)&f_{n+1}(x_1)\\ \vdots&\ddots&\vdots&\vdots\\ f_1(x_n)&\cdots&f_n(x_n)&f_{n+1}(x_n)\\ f_1(x)&\cdots&f_n(x)&f_{n+1}(x) \end{array} \right| =0.$

then by developping the determinant along the last column, we find $a_1, \dots ,a_n \in \mathbb{R}$ such that for all $x$,

$\displaystyle f_{n+1}(x)=a_1f_1(x)+\cdots +f_n(x).$
This obviously contradicts the assumption that the function $f_1, \dots , f_n, f_{n+1}$ are linearly independent.Therefore, there must be a $x_{n+1} \in \mathbb{R}$ such that the determinant is not zero.

As a consequence of this lemma, we see that a subspace of the vector space $\mathcal{F}(\mathbb{R},\mathbb{R})$ that contains only monotonous functions is of dimension at most two. Indeed, if $f, g, h \in \mathcal{F}$ are three linearly independent functions, then there exists $x,y,z \in \mathbb{R}$ such that

$\displaystyle \left| \begin{array}{lcl} f(x)&g(x)&h(x)\\ f(y)&g(y)&h(y)\\ f(z)&g(z)&h(z) \end{array} \right| \neq 0.$

Then for all $a, b, c \in \mathbb{R}$, there exists $\alpha, \beta, \gamma \in \mathbb{R}$ such that

$\displaystyle \left\{ \begin{array}{lcl} \alpha f(x) +\beta g(x) + \gamma h(x)&=&a;\\ \alpha f(y) +\beta g(y) + \gamma h(y)&=&b;\\ \alpha f(z) +\beta g(z) + \gamma h(z)&=&c. \end{array} \right.$

By choosing appropriate values for $a$, $b$ and $c$, we can make the function $\alpha f+ \beta g+\gamma h$ non monotonous.

We are halfway there. What we have to check now is that a two-dimensional subspace of $\mathcal{F}(\mathbb{R},\mathbb{R})$ that contains only monotonous functions must contain a constant function (that is not zero). I will give a proof by contraposition.

Lemma 2

Let $f, g \in \mathcal{F}(\mathbb{R},\mathbb{R})$ be two linearily independant functions such that none of the linear combinations
$\alpha f+\beta g$ is constant. Then one of these combinations is non-monotonous.

Proof. By the previous lemma, there are $x, y \in \mathbb{R}$ (we can assume that $x) such that

$\displaystyle \left| \begin{array}{cc} f(x)&g(x)\\ f(y)&g(y) \end{array} \right| \neq 0.$

Let us chose $a \neq 0$. There exist $\alpha, \beta \in \mathbb{R}$ such that

$\displaystyle \left\{ \begin{array}{lcl} \alpha f(x)+\beta g(x)&=&a;\\ \alpha f(y)+\beta g(y)&=&a. \end{array} \right.$

Since $h=\alpha f+ \gamma g$ is not a constant, there is $z \in \mathbb{R}$ such that $f(z) \neq a$. If $x, then $h$ is not monotonous. If $z \notin (0,1)$, then by applying one, or both, of the transformations $f(x) \mapsto -f(x)$ and $f(x)\mapsto f(-x)$
we only have to treat the case where $x and $h(z)>a$, which is convenient. We will show that a small perturbation of $h$ is non-monotonous.
We know that there exist $\gamma, \delta \in \mathbb{R}$ such that

$\displaystyle \left\{ \begin{array}{lcl} \gamma f(x)+\delta g(x)&=&1;\\ \gamma g(y)+\delta g(y)&=&-1. \end{array} \right.$

If we set $h_{\epsilon}=(\alpha+\epsilon\gamma)f+(\beta+\epsilon \delta)g$, then $h_{\epsilon}(x)=a+\epsilon$, $h_{\epsilon}(y)=a-\epsilon$ and $h_{\epsilon}(z)=h(z)+\epsilon(\gamma f(z)+\delta g(z))$. By choosing $\epsilon>0$ small enough, we get $h_{\epsilon}(x)>h_{\epsilon}(y)$ and $h_{\epsilon}(z)>h_{\epsilon}(x)$, and in that case $h_{\epsilon}$ is not monotonous.

Not much of a result, but it was fun to do (not so fun to write it up).