A fundamental construction in a first course on manifolds is to build a smooth function $\psi\colon \mathbb{R} \to \mathbb{R}$ with the property that for some $0<\delta<\epsilon$ we have

- $\psi(x)=1$ for $|x|\leq\delta$;
- $\psi(x)=0$ for $|x|\geq\epsilon$.

Using this "bump function", one can do all sorts of "gluing" tricks: for example, if $f\colon \mathbb{R}^n \to \mathbb{R}^n$ is any smooth map and $\epsilon>0$ is such that $|f(x)|<\epsilon$ for all $|x|\leq\delta$, then we can build a smooth map $F\colon \mathbb{R}^n\to \mathbb{R}^n$ such that

- $F(x) = f(x)$ for $|x|\leq\delta$;
- $F(x) = x$ for $|x|\geq\epsilon$.

However, the map we obtain in this manner does not necessarily preserve all the nice properties of $f$. For example, if $f$ is a local diffeomorphism, it does not immediately follow from the above construction that $F$ can also be taken to be a local diffeomorphism.

Intuitively, it seems clear that this is (usually) the case:

- For linear maps with $n=1$, it's just a matter of drawing a smooth curve that starts on the line $y=\lambda x$ and goes to the line $y=x$ without ever having a horizontal tangent. (Of course we must take $\lambda>0$ for this.)
- For linear maps with $n=2$, the image of a small ball is an ellipse, so by smoothly deforming the ellipse into a ball, rotating so that the map is a multiple of the identity, and then using the trick from $n=1$ to make the eigenvalues equal to $1$, we can find a smooth homotopy $f_t$ such that $f_0=f$ and $f_1$ is the identity, and furthermore, setting $F(x) = f_t(x)$ for $|x| = \delta + t(\epsilon - \delta)$ makes $F$ a diffeomorphism.
- Since linear maps approximate arbitrary maps, the above procedure ought to generalise. (Modulo the restriction that $Df(0)$ should have positive determinant.)

I expect that there's a general result along these lines, and that it is quite standard and well-known. But I don't know it (and I'd rather re-invent the wheel as few times as possible). Can someone help me out with a statement of a general theorem, and ideally a reference?

**Edit**: Since that was kind of rambling, here's the specific question. Let $B(r)$ denote the (open) ball of radius $r$ in $\mathbb{R}^n$ centred at the origin. Suppose $f\colon B(\delta) \to \mathbb{R}^n$ is a diffeomorphism onto its image, and suppose $\overline{f(B(\delta))} \subset B(\epsilon)$. Let $\delta' < \delta$. Does there necessarily exist a diffeomorphism $F\colon \mathbb{R}^n \to \mathbb{R}^n$ that agrees with $f$ on $B(\delta')$ and is the identity map outside of $B(\epsilon)$?

I think we need to require that $Df(0)$ have positive determinant. Are there any other obstructions? If there are, can they be removed (for a given $f$) by decreasing $\delta$ so that $f$ is close to being a linear map? Is there a general theorem from which all this follows?