# Approximation by smooth functions by changing values at arbitrarily small interval

Assume $f\in C[0,1]$ is smooth (i.e. infinitely many times differentiable) on $(0,\frac 12)$ and $(\frac 12,1)$. Let $\epsilon>0$ be arbitrarily small.

Can we approximate $f$ in supremum norm by functions $f_n$ smooth on $(0,1)$ and such that $f_n(x)=f(x)$ for $x\in[0,\frac 12-\epsilon)\cup(\frac 12+\epsilon,1]$? Is there a construction of such approximation?

• On interval $[0,1]$. – lucas Jul 19 '18 at 20:02
• I guess you can. Let $f_n$ be constantly $f(1/2)$ on $(1/2-\epsilon/2,1/2+\epsilon/2)$ and connect the rest smoothly. – amsmath Jul 19 '18 at 20:03
• Check out smooth bump functions or smooth step functions. – user357980 Jul 20 '18 at 0:10
• Provided that f(x) is continuous at x=1/2 Otherwise, no. – DanielWainfleet Jul 20 '18 at 20:20

It is true that there exists a sequence of smooth functions that converge to $f$ in the sup norm, e.g. the Bernstein polynomial. But your statement is clearly false. Indeed, if $f_n(x) = f(x)$ on $[0,\frac{1}{2}−\epsilon)∪(\frac{1}{2}-\epsilon,1]$, then we see $f_n$ is differentiable at $x=1/2$ if and only if $f$ is. Indeed, this follows from differentiation is a local property. So if $f$ is not differentiable at $x=1/2$ then $f_n$ cannot be as well, so a counter example would be $f(x)=|x-1/2|$. However, here's a proof of $f_n \rightarrow f$ on sup norm even if $f$ is just continuous on $[0,1]$.
This can only possibly be true on subsets of $[0,1]$ as if $f_n \rightarrow f$ with the sup norm where $f_n$ are smooth, then they converge uniformly, so $f$ is continuous. Hence, this theorem can possibly only hold on subsets of $[0,1]$ as we do not know the continuity of $f$ outside of $[0,1]$.
Now let $[a,b] \subset [0,1]$, then we see $f$ is uniformly continuous on $[a,b]$ in fact any interval will work as $f$ is uniformly continous on $[0,1]$. Now by Weiestrass's Approximation Theorem (https://en.wikipedia.org/wiki/Stone%E2%80%93Weierstrass_theorem#Weierstrass_approximation_theorem)
there exists a sequence of polynomials $p_n$ such that $p_n \rightarrow f$ uniformly, hence $\sup_{x \in [0,1]}||f-p_n|| \rightarrow 0$. In particular, the $p_n$ are the Bernstein polynomials (https://en.wikipedia.org/wiki/Bernstein_polynomial). (I'll let you read wikipedia for the constructive proof)