$\newcommand{\R}{\mathbb{R}}$I have a map $f\in C^0(X,\mathbb{R})$, where $X$ is a compact and Hausdorff topological space, which is a manifold outside of a compact subset $K\subset X$.


I would like to modify $f$, to obtain $\tilde f\in C^0(X,\mathbb{R})$ such that


1. $\tilde f\rvert\_K = f\rvert\_K$ and
2. $\tilde f\rvert\_{X\setminus K} \in C\_b^k(X\setminus K,\mathbb{R})$ where $C\_b^k$ denotes *bounded* functions continuously differentiable $k$-times (also the derivatives are bounded so to make this a Banach space).



> 
> Is this possible or are the hypothesis on $X$ too weak?
> 
> 
> 


**EDIT: as shown by Jochen Wengenroth the answer is negative, however as shown in Joseph Van Name's answer the answer is positive if we drop the requirement that the derivatives are bounded (i.e. instead of requiring $\tilde f\rvert\_{X\setminus K} \in C\_b^k(X\setminus K,\mathbb{R})$ we ask for $\tilde f\rvert\_{X\setminus K} \in C^k(X\setminus K,\mathbb{R})$). I accepted Joseph's answer without noticing this subtlety (beforee Jochen posting his answer) but, a posteriori, I regard both answers as relevant and on point as they give a complete picture.**



Smoothing a map $f:X\to \mathbb{R}$ while fixing it over a closed $C\subset X$
I claim that it is always possible (as long as one does not require the derivatives of $\tilde{f}\_{X\setminus K}$ to be bounded). This is actually an easy consequence of the approximation theorem of manifolds.


To state the approximation theorem of manifolds, suppose that
$0\leq s<\infty$, and $M,N$ are manifolds. Let $C^{s}(M,N)$ be the collection of $C^{s}$ mappings from $M$ to $N$. Then we shall let $C^{s}\_{S}(M,N)$ denote the topological space with underlying set $C^{s}(M,N)$ and where the basic open sets are the sets of the following form.


Suppose that $\iota\_{n}:U\_{n}\rightarrow M$ is a chart for each $n\geq 0$. Suppose that $(\iota\_{n}[U\_{n}])\_{n\geq 0}$ is locally finite. Suppose furthermore that $C\_{n}$ is a compact subset of $\iota\_{n}[U\_{n}]$ and $\epsilon\_{n}>0$ for all natural numbers $n$. Let $f\in C^{s}(M,N)$. Suppose now that $j\_{n}:V\_{n}\rightarrow N$ is a chart for each $n\geq 0$ and that $f[C\_{n}]\subseteq j\_{n}[V\_{n}]$. Let $O$ be the collection of all functions $g\in C^{s}(M,N)$ such that
$g[C\_{n}]\subseteq j\_{n}[V\_{n}]$ and where if $\alpha$ is a multi-index with $|\alpha|\leq s$, then
$$|D^{\alpha}(j\_{n}^{-1}f\iota\_{n})(x)-D^{\alpha}(j\_{n}^{-1}f\iota\_{n})(x)|<\epsilon\_{i}$$ for each $x\in \iota\_{n}^{-1}[C\_{n}]$. Then $O$ is a basic open set, and all basic open sets are of this form.


Theorem (approximation theorem): Let $M,N$ be $C^{q}$ manifolds where $1\leq q\leq\infty$. Suppose that $0\leq p<q$. Then the set $C^{q}(M,N)$ is dense in the space $C\_{S}^{p}(M,N)$.


A good textbook reference for the above result is the text Differential Topology by Morris Hirsch.


Suppose now that $X$ is a compact space, $K$ is a compact subset of $X$, and $X\setminus K$ is a $C^{\infty}$-manifold.


Then there exists a continuous function $h:X\rightarrow[0,1]$ where
$K=h^{-1}[\{0\}]$.


Let $O$ be the collection of all continuous functions $g:X\setminus K\rightarrow\mathbb{R}$ with $|(g-f)(x)|<h(x)$ for all $x\in X$. Then $O$ is open in $C\_{S}^{0}(X\setminus K,\mathbb{R})$, so by the approximation theorem, there exists a $C^{\infty}$-mapping
$g:X\setminus K\rightarrow\mathbb{R}$ with $g\in O$, and in this case, $|(g-f)(x)|<h(x)$ for each $x\in X$.


Observe that if $k\in\partial K$, then $\lim\_{x\in X\setminus K,x\rightarrow k}(g-f)(x)=0$, so $\lim\_{x\in X\setminus K,x\rightarrow k}f(x)=\lim\_{x\in X\setminus K,x\rightarrow k}g(x)$. Therefore, if we set $\overline{g}=g\cup f|\_{K}$, then $\overline{g}$ is a continuous function that extends $g$.


Pierre PC observed that we do not need the full strength of the approximation theorem and that the weaker result that is easier to state and prove will suffice:


Proposition: Whenever $M$ is a $C^{k}-$manifold for $1\leq k\leq\infty$, $f:M\rightarrow\mathbb{R}$ is continuous, and $h:M\rightarrow(0,\infty)$ is a continuous function, there exists some $C^{k}$-function $g:M\rightarrow\mathbb{R}$ with $|f-g|<h$.


To prove the above proposition, first observe that if $U\subseteq\mathbb{R}^{n}$, $U$ is open, and $f:U\rightarrow\mathbb{R}$ is continuous, then for all $\delta>0$, there is a $C^{\infty}$-function $g\_{\delta}:\mathbb{R}^{n}\rightarrow[0,\infty]$ where $g\_{\delta}(x)=0$ whenever $\|x\|>\delta$ and where $\int\_{\mathbb{R}^{n}}g\_{\delta}(\mathbf{x})d\mathbf{x}=1$. In this case, each $f\*g\_{\delta}$ is $C^{\infty}$ on $\{\mathbf{x}\mid B\_{\delta}(\mathbf{x})\subseteq U\}$ and $f\*g\_{\delta}\rightarrow f$ uniformly on compact sets. One can extend this approximation result to obtain a proof of our proposition using a $C^{k}$-partition of unity.


