Nowhere continuous functions $f: \mathbb{R} \to \mathbb{R}$ such that $f\bigl(f(x)\bigr) = \frac{f(2x)}{2}$ [closed]

I'm looking for a function $f: \mathbb{R} \to \mathbb{R}$ that is continuous at no point and satisfies the identity $$f\bigl(f(x)\bigr) = \frac{f(2x)}{2}$$ for all $x \in \mathbb{R}$.

This is not a homework question, but rather a curiosity of mine. There is absolutely no context, I just thought of it.

$f(x)=x$ is the example that made me think of this problem, but there are other solutions of the functional equation obviously, for example $f(x)=0$ for all $x$.

I was only able to notice that if $f$ is not identically $0$ then $f(\mathbb{R})$ is an infinite set.


Pick a basis $a_r$ of $\mathbb R$ over $\mathbb Q$ that contains $1$ (this of course assumes the Axiom of Choice at least in some weaker forms but is standard in usual math).

Let $f: \mathbb R \to \mathbb Q$ the additive function defined in the usual way by the basis so if $x=\sum q_ra_r, q_r \in \mathbb Q, q_r=0$ for all but finitely many $r$ (and of course $q_r$ unique) , then $f(x)=\sum q_r$, hence $f(x+y)=f(x)+f(y)$ and in particular $f(2x)/2=f(x)$ for all $x \in \mathbb R$

Then $f(q)=q$ for $q \in \mathbb Q$ since $1$ is in the basis and since for any $x \in \mathbb R$ we have $f(x) \in \mathbb Q$, we get $f(f(x))=f(x)=f(2x)/2$ and of course $f$ is highly discontinuous and there are lots of such.


Using the axiom of choice, you can show that there exists an additive function $ f : \mathbb R \to \mathbb R $ satisfying $$ f \bigl ( f ( x ) \bigr ) = \frac { f ( 2 x ) } 2 \tag 0 \label 0 $$ for all $ x \in \mathbb R $, such that $ f $ is discontinuous at every $ x \in \mathbb R $; i.e. not only $ f $ satisfies \eqref{0}, but also Cauchy's functional equation $$ f ( x + y ) = f ( x ) + f ( y ) \tag 1 \label 1 $$ for all $ x , y \in \mathbb R $. Taking a look at the post "Overview of basic facts about Cauchy functional equation", you can see that such functions are widely known and well studied, and thus I'll skip some details that you can find in the links. The proof of existence of such functions is done using linear algebra of infinite dimensional vector spaces, and may seem a little bit complicated if you're not familiar with that area. But as it is quite standard, and I don't know about simpler examples of functions satisfying \eqref{0}, I will go with it.

First of all, note that an additive function $ f : \mathbb R \to \mathbb R $ satisfies $$ f ( 2 x ) = 2 f ( x ) $$ for all $ x \in \mathbb R $. Thus, it's sufficient to prove the existence of an additive function satisfying $$ f \bigl ( f ( x ) \bigr ) = f ( x ) \tag 2 \label 2 $$ for all $ x \in \mathbb R $. For that, consider $ \mathbb R $ as a vector space over the field of scalars $ \mathbb Q $. The axiom of choice implies the existence of a Hamel basis $ \mathcal B $ for $ \mathbb R $. Consider a subset $ \mathcal A $ of $ \mathcal B $, and take $ g : \mathcal B \to \operatorname {span} \mathcal A $ such that $ g ( a ) = a $ for all $ a \in \mathcal A $. Then, if you take $ f $ to be the unique linear function extending $ g $ (which exists, since $ \mathcal B $ is a basis), $ f $ will satisfy \eqref{2}. That's because by linearity of $ f $, you get $ f ( x ) = x $ for all $ x \in \operatorname {span} ( \mathcal A ) $, and as $ g ( b ) \in \operatorname {span} ( \mathcal A ) $ for all $ b \in \mathcal B $ and $ f $ is a linear extension of $ g $, we get \eqref{2} for all $ x \in \mathbb R $.

As any additive function that is not of the form $ f ( x ) = a x $ for a constant $ a \in \mathbb R $ is discontinuous at every point, you only need to ensure that the function $ f $ is not of this particular form. For that, It's for example sufficient to take $ \mathcal A $ and $ \mathcal B \setminus \mathcal A $ both nonempty. That's because you will then have $ f ( x ) = x $ for some nonzero $ x \in \mathbb R $, while at the same time there will be another $ y \in \mathbb R $ with $ f ( y ) \ne y $.