Polynomial approximation (Weierstrass theorem) with bounds Consider the closed interval $[0,1]$ and let $f \in C[0,1]$. Let $g$ be a real valued function on $[0,1]$ such that $g \leq f$.

*

*Suppose $g = f$ at atmost finitely many points. Does there exist a polynomial $p$ such that $g \leq p \leq f$? As pointed out in comments below, if $f^{(n)}(x) = g^{(n)}(x)=0$ for some $x \in [0,1]$ and for every $n \geq 0$, any such polynomial must be identically zero. Are there other conditions that also pose an obstruction to the existence of such polynomials?


*What minimum extra assumptions does one need to make on $f,g$ for such polynomials to exist?
 A: As I have commented, if $f,g:[0,1]\rightarrow\mathbb{R}$ are $C^{\infty}$ functions, and $c\in(0,1)$ is a real number with $f^{(n)}(c)=g^{(n)}(c)$ for each $n$, and $f(x)\leq g(x)$ for each $x\in[0,1]$, then there can be at most one polynomial $p$ with $f(x)\leq p(x)\leq g(x)$ for each $x\in[0,1]$, and one can easily set up $f,g$ so that there are no polynomials $p$ such that $f(x)\leq p(x)\leq g(x)$.
On the other hand, we shall see that if
$f,g:[0,1]\rightarrow\mathbb{R}$ are $C^{\infty}$-functions with

*

*$f\leq g$


*there are only finitely many points $c\in[0,1]$ with $f(c)=g(c)$,


*if $c\in[0,1]$ and $f(c)=g(c)$, then there is some $n$ with $f^{(n)}(c)\neq g^{(n)}(c)$,
then there is some polynomial $p$ such that $f(x)\leq p(x)\leq g(x)$ whenever $x\in[0,1]$.
To get a generalized version of this result, we will need the following powerful generalization of the Stone-Weierstrass theorem from complex analysis.

Theorem: (Mergelyan's Theorem) Suppose that $K\subseteq\mathbb{C}$ and
$K$ is compact and $K\setminus\mathbb{C}$ is connected. Then whenever
$f:K\rightarrow\mathbb{C}$ is a continuous function that is
holomorphic on $K^{\circ}$ and $\epsilon>0$, there is some polynomial
$p$ such that $|(f-p)(z)|<\epsilon$ whenever $z\in K$.

Mergelyan's theorem is a well-known result from complex analysis. We are using Mergelyan's theorem because we need the maximum modulus theorem in order to get $f\leq h\leq g$ around the points $c$ where $f(c)=g(c)$ (we have more to work with if we approximate a holomorphic function rather than simply a continuous function as we would with the Stone-Weierstrass theorem). We will need a slight and easy to prove strengthening of Mergelyan's theorem.

Corollary: Suppose that $K$ is a compact subset of $\mathbb{C}$ and
$K\setminus\mathbb{C}$ is connected. Suppose furthermore that
$c_{1},\dots,c_{r}\in K^{\circ}$ and $n$ is a natural number. Let
$f:K\rightarrow\mathbb{C}$ be a continuous function that is
holomorphic on $K^{\circ}$. Then for each $\epsilon>0$, there is a
polynomial $q$ such that $|(f-q)(z)|<\epsilon$ for each $z\in K$ and
where $f^{(m)}(c_{k})=q^{(m)}(c_{k})$ whenever $1\leq k\leq r$ and
$0\leq m\leq n$.

Proof: There is some $N$ and polynomials $p_{k,s}$ of degree at most $N$ where
$p_{k,s}^{(m)}(c_{j})=\delta_{k,j}\delta_{s,m}$ whenever $1\leq k\leq r,1\leq j\leq r,1\leq m\leq n,1\leq s\leq n$. Now, for $1\leq j\leq r$, let
$\rho_{j}$ be the largest real number such that $B_{\rho_{j}}(c_{j})\subseteq K$.
Suppose that $\delta>0$. Then from Mergelyan's theorem, there exists a polynomial $p$ such that $|(f-p)(x)|<\delta$ for each $x\in K$. In this case, we have $$|(f-p)^{(m)}(c_{j})|\leq\frac{m!\cdot\delta}{\rho_{j}^{m}}$$ for $0\leq m\leq n,1\leq j\leq r$.
Let $$q=p+\sum_{k=1}^{r}\sum_{s=0}^{n}p_{k,s}\cdot(f-p)^{(s)}(c_{k}).$$ Then
$q^{(m)}(c_{j})=f^{(m)}(c_{j})$. Therefore, $$|(q-p)(z)|\leq\sum_{k=1}^{r}\sum_{s=0}^{n}|p_{k,s}(z)(f-p)^{(s)}(c_{k})|
\leq\sum_{k=1}^{r}\sum_{s=0}^{n}|p_{k,s}(z)|\cdot\frac{s!\delta}{\rho_{l}^{s}}.$$
Therefore, if $M_{k,s}=\max\{|p_{k,s}(z)|:z\in K\}$, then
$$|(q-p)(z)|\leq\sum_{k=1}^{r}\sum_{s=0}^{n}M_{k,s}\cdot\frac{s!\delta}{\rho_{l}^{s}}
=\delta\cdot\sum_{k=1}^{r}\sum_{s=0}^{n}M_{k,s}\cdot\frac{s!}{\rho_{l}^{s}}$$
whenever $z\in K$. Therefore, if $z\in K$, then
$$|(f-q)(z)|\leq|(f-p)(z)|+|(p-q)(z)|=\delta\cdot[1+\sum_{k=1}^{r}\sum_{s=0}^{n}M_{k,s}\cdot\frac{s!}{\rho_{l}^{s}}].$$
Since the quantity $$\delta\cdot[1+\sum_{k=1}^{r}\sum_{s=0}^{n}M_{k,s}\cdot\frac{s!}{\rho_{l}^{s}}]$$ can be made arbitrarily close to zero, the theorem holds. Q.E.D.

Theorem: Suppose the following:

*

*$f,g:[0,1]\rightarrow\mathbb{R}$ are continuous functions such that $f(x)\leq g(x)$ for all $x\in[0,1]$.


*there are only finitely many points $c$ with $f(c)=g(c)$.


*$f(0)<g(0)$ and $f(1)<g(1)$.


*If $f(c)=g(c)$, then there exists some polynomial $p$, natural number $n$, constant $\alpha>0$, and open neighborhood $U$ of $c$ such
that $$f(x)\leq p(x)-\alpha|x-c|^{n}\leq p(x)+\alpha|x-c|^{n}\leq
 g(x)$$ for all $x\in U$.


Then there exists a polynomial $p$ such that
$f(x)\leq p(x)\leq g(x)$ for each $x\in[0,1]$.

Proof: Let $\{c_{1},\dots,c_{r}\}$ be the set of all points $c$ such that $f(c)=g(c)$. Assume that $c_{1}<\dots<c_{r}$. Then there exists some $n$,$\alpha>0$, and $\rho>0$ along with polynomials $p_{1},\dots,p_{r}$ such that
$$f(x)\leq p_{j}(x)-\alpha|x-c_{j}|^{n}\leq p_{j}(x)+\alpha|x-c_{j}|^{n}\leq g(x)$$ whenever $|x-c_{j}|<\rho$.
Now, there is a polynomial $P(x)$ along with $\beta>0$ and a $\delta>0$ such that
$$f(x)\leq P(x)-\beta|x-c_{j}|^{n}\leq P(x)+\beta|x-c_{j}|^{n}\leq g(x)$$
whenever $|x-c_{j}|<\delta$ and $1\leq j\leq r$; the polynomial $P(x)$ is simply a polynomial such that $P^{(m)}(c_{j})=p_{j}^{(m)}(c_{j})$ for $0\leq m\leq n$. Therefore, if we set $f^{\sharp}=f-P,g^{\sharp}=g-P$, then $$f^{\sharp}(x)\leq-\beta|x-c_{j}|^{n}\leq\beta|x-c_{j}|^{n}\leq g^{\sharp}(x)$$ whenever $|x-c_{j}|<\delta,1\leq j\leq r$.
Now let $\delta_{0}<\delta$, and let $$C=[0,1]\cup \overline{B_{\delta_{0}}(c_{1})}\cup\dots\overline{B_{\delta_{0}}(c_{1})}$$ where the balls $B_{\delta_{0}}(c_{j})$ are in the complex plane. Now, let $h:C\rightarrow\mathbb{R}$ be a continuous function such that $f^{\sharp}(x)\leq h(x)\leq g^{\sharp}(x)$ for $x\in[0,1]$ and where $h(z)=0$ whenever $z\in \overline{B_{\delta_{0}}(c_{j})},1\leq j\leq r$, and where $f^{\sharp}(x)<h(x)<g^{\sharp}(x)$ whenever $x\in[0,1]\setminus(B_{\delta_{0}}(c_{1})\cup\dots B_{\delta_{0}}(c_{1}))$
Now, let $\epsilon>0$ and apply our extension of Mergelyan's theorem to obtain a polynomial $q$ such that $|q(z)-h(z)|<\epsilon$ for each $z\in C$ and where $q^{(m)}(c_{j})=0$ whenever $0\leq m<n,1\leq j\leq r$.
Now, since $q^{(m)}(c_{j})=0$ for $0\leq m<n$, the function $\frac{q(z)}{(z-c_{j})^{n}}$ is holomorphic on $B_{\delta_{0}}(c_{j})$ and does not have modulus greater than $\frac{\epsilon}{\delta_{0}^{n}}$ on the boundary $\partial B_{\delta_{0}}(c_{j})$. Therefore, by the maximum modulus theorem, we know that
$|\frac{q(z)}{(z-c_{j})^{n}}|\leq\frac{\epsilon}{\delta_{0}^{n}}$ for each
$z\in B_{\delta_{0}}(c_{j})$. Therefore, $|q(z)|\leq(z-c_{j})^{n}\cdot\frac{\epsilon}{\delta_{0}^{n}}$ for each $z\in B_{\delta_{0}}(c_{j})$.
Now, if we set $\epsilon$ small enough so that $\frac{\epsilon}{\delta_{0}^{n}}\leq\beta$, then $|q(z)|\leq\beta|z-c_{j}|^{n}$ for each $z\in B_{\delta_{0}}(c_{j})$.
Now, $q(z)$ is a complex polynomial with complex coefficients, but we need a real polynomial. Therefore, define $Q(z)=(q(z)+\overline{q(\overline{z})})/2$. Then if $x$ is real, then $Q(x)=\text{Re}(q(x))$. Therefore, if $|x-c_{j}|<\delta_{0}$, then
$$f^{\sharp}(x)\leq-\beta|x-c_{j}|^{n}\leq Q(x)\leq\beta|x-c_{j}|^{n}\leq g^{\sharp}(x).$$
Now, observe that $$|Q(x)-h(x)|\leq|q(x)-h(x)|<\epsilon$$ whenever $x\in[0,1]$. Now, let
$$B=[0,1]\setminus(B_{\delta_{0}}(c_{1})\cup\dots B_{\delta_{0}}(c_{1})).$$ Then $B$ is a compact set and $f^{\sharp}(x)<h(x)<g^{\sharp}(x)$ for each $x\in B$. Therefore, since
$$\min(g^{\sharp}(x)-h(x),h(x)-f^{\sharp}(x))>0$$ for each $x\in B$, by compactness, there is some $\zeta>0$ such that $$\min(g^{\sharp}(x)-h(x),h(x)-f^{\sharp}(x))\geq\zeta$$ for each $x\in B$. Therefore, if we select $\epsilon$ small enough so that $\epsilon<\zeta$, then we have
$$f^{\sharp}(x)<h(x)-\epsilon<Q(x)<h(x)+\epsilon<g^{\sharp}(x)$$ for each $x\in B$. We therefore conclude that if $\epsilon$ is small enough, then $f^{\sharp}(x)\leq Q(x)\leq g^{\sharp}(x)$ for all $x\in[0,1]$.
Therefore, $f=f^{\sharp}+P\leq Q+P\leq g^{\sharp}+P=g$. Q.E.D.
We have obtained necessary and sufficient conditions for when one can find infinitely many polynomials $p$ with $f\leq p\leq g$.

Corollary: Suppose that $f,g:[0,1]\rightarrow\mathbb{R}$ are
continuous functions with $f(0)<g(0),f(1)<g(1)$ and $f\leq g$. Then
there are infinitely many polynomials $p$ with  $f(x)\leq p(x)\leq g(x)$ if and only if

*

*there are only finitely many points $c\in[0,1]$ with $f(c)=g(c)$, and


*if $f(c)=g(c)$, then there is a polynomial $p$ along with an open neighborhood $U$ of $c$, a natural number $n$ and a constant
$\alpha>0$ such that $f(x)\leq p(x)-\alpha|x-c|^{n}\leq
 p(x)+\alpha|x-c|^{n}\leq g(x)$ for each $x\in U$.

A: Here is a purely real-analytic proof that is a bit simpler than my other answer and just relies on the Stone-Weierstrass theorem rather than complex analysis and Mergelyan's theorem.

Theorem: Suppose that $f,g:[0,1]\rightarrow\mathbb{R}$ are functions
such that $f\leq g,f(0)<g(0),f(1)<g(1)$, and there are finitely many
points $c$ such that $f(c)=g(c)$. Furthermore, suppose that if
$f(c)=g(c)$, then there is a real number $\alpha>0$, a natural number
$n>0$, a polynomial $p$, and a $\delta>0$ such that if $|x-c|<\delta$,
then $$f(x)\leq p(x)-\alpha|x-c|^{n}\leq p(x)+\alpha|x-c|^{n}\leq
 g(x).$$ Then there is a polynomial $p$ such that $f(x)\leq p(x)\leq
 g(x)$ for each $x\in[0,1]$.

Proof: As before, let $c_{1},\dots,c_{r}$ be the set of all points $c$ such that
$f(c)<g(c)$, and assume that $c_{1}<\dots<c_{r}.$ Let

*

*$P$ be a polynomial,


*$\alpha>0$ be a real number,


*$n>0$ be an even integer (we need evenness so that $\alpha^{n}$ is always positive), and let


*$\delta>0$ be a real number such that
if $1\leq j\leq r$ and $|x-c_{j}|<\delta$, then
$$f(x)\leq P(x)-\alpha(x-c_{j})^{n}\leq P(x)+\alpha(x-c_{j})^{n}\leq g(x).$$
Let $f^{\sharp}=f-P,g^{\sharp}=g-P$. Then if $1\leq j\leq r$ and $|x-c_{j}|<\delta$, then
$$f^{\sharp}(x)\leq-\alpha(x-c_{j})^{n}\leq\alpha(x-c_{j})^{n}\leq g^{\sharp}(x).$$
Now, let $\delta_{0}<\delta$ and let $F,G:[0,1]\rightarrow\mathbb{R}$ be mappings such that

*

*$f^{\sharp}\leq F\leq G\leq g^{\sharp}$


*if $|x-c_{j}|<\delta_{0}$, then $F(x)=-\alpha(x-c_{j})^{n},G(x)=\alpha(x-c_{j})^{n}$, and


*if $x\in[0,1]\setminus[(c_{1}-\delta_{0},c_{1}+\delta_{0})\cup\dots\cup(c_{r}-\delta_{0},c_{r}+\delta_{0})]$, then $F(x)<G(x)$.
Let $F^{\flat},G^{\flat}:[0,1]\rightarrow\mathbb{R}$ be the continuous mappings where
$$F^{\flat}(x)=F(x)\cdot\prod_{j=1}^{r}(x-c_{j})^{-n},G^{\flat} (x)=G(x)\cdot\prod_{j=1}^{r}(x-c_{j})^{-n}$$ whenever $x\in[0,1]\setminus\{c_{1},\dots,c_{r}\}$.
Then observe that $F^{\flat}(x)<G^{\flat}(x)$ for all $x\in[0,1]$. Therefore, by applying the Stone-Weierstrass theorem and some compactness to $(F^{\flat}+G^{\flat})/2$, we obtain a polynomial $p$ such that $F^{\flat}(x)\leq p(x)\leq G^{\flat}(x)$ for all $x$. Therefore, if $p_{1}(x)=p(x)\cdot\prod_{j=1}^{r}(x-c_{j})^{n}$, then
$$f^{\sharp}(x)\leq F(x)\leq p_{1}(x)\leq G(x)\leq g^{\sharp}(x)$$ for all $x$. Therefore, if we let $p_{2}=p_{1}+P$, then $$f=f^{\sharp}+P\leq p_{2}\leq g^{\sharp}+P=g.$$ Q.E.D.
