# Between any two continuous functions $f>g$, can we find a real-analytic function?

I asked myself a question which I thought was interesting, but I'm not sure how to approach it.

## The Question

The question is, given two continuous functions $f,g:\mathbb{R}\rightarrow\mathbb{R}$ such that $f > g$, is there a real analytic function $h$ between $f$ and $g$ (so that $f > h > g$)?

An easier version of the question can be asked over closed intervals. Given two continuous functions $f,g:[a,b]\rightarrow\mathbb{R}$ such that $f > g$, is there a real analytic function $h$ between $f$ and $g$?

In this case, the answer is yes, and the result is actually stronger than expected. Essentially, this is an application of the Weierstrass Approximation Theorem.

By the extreme value theorem, the function $H(x) = (f(x) - g(x))/2$ has a minimum $M > 0$. You can define $k(x) = (f(x) + g(x))/2$ and then apply the Weierstrass Approximation Theorem to get a polynomial $p:[a,b]\rightarrow\mathbb{R}$ such that $\lVert p - k\rVert < M$. Then $p$ is a polynomial such that $p(x)\in (k(x) - M, k(x) + M)\subseteq (g(x), f(x))$ for all $x\in[a,b]$.

However, you run into issues when the domain is the real line. Here are some thoughts I had so far.

## For

I am aware that there is a generalized Stone-Weierstrass Theorem on locally compact Hausdorff spaces $X$ concerning functions in $C_{0}(X)$. There are two issues though. The first is that our continuous functions $f,g$ don't necessarily tend to zero as $x\rightarrow\pm\infty$. The second is that the difference $f(x) - g(x)$ is allowed to get arbitrarily small as $x\rightarrow\pm\infty$.

The first issue isn't major to me, because I think I have a way to evade it. For all intents and purposes, we can assume that $f,g$ tend to zero if it suits our needs.

The second issue, though, seems to be fatal, and it seems like there is no way to modify the Stone-Weierstrass Theorem appropriately.

This makes me think I need a completely different approach.

## Against

If I want to make a counterexample, maybe I can use pathological functions like the Weierstrass function $w:\mathbb{R}\rightarrow\mathbb{R}$. I'm thinking that if we take $f(x) = w(x) + e^{-x^{2}}$ and $g(x) = w(x)$, we can force any intermediate function $h$ to become "more and more detailed" as it gets sandwiched closer and closer between $f,g$ for large $x$. Then this function might become "too detailed" to be analytic, but I have no rigorous way to express this idea.

Even worse, I'm having doubts that this would go anywhere because there is always "wiggle room" between $f$ and $g$, so maybe we can fit an analytic function between them after all.

Are there any suggestions on how to make progress on this question?

@NateEldredge mentioned a result of Carleman. It is indeed a beautiful theorem: Suppose $G:\mathbb R \to \mathbb R$ is continuous, and $\epsilon: \mathbb R \to (0,\infty)$ is any positive continuous function. Then there exists an entire function $F$ such that $|F(x)-G(x)| < \epsilon(x)$ for all $x\in \mathbb R.$
In your problem we can let $G = (f+g)/2$ and $\epsilon = (f-g)/2.$ Then
$$\frac{g-f}{2} < F - \frac{f+g}{2} < \frac{f-g}{2}\,\,\, \text { on }\,\, \mathbb R$$