TITLE: a custom designed cutoff function whose derivative is bounded above.
QUESTION [5 upvotes]: I am trying to find a $C^\infty$ function $\phi(t)$ with the following 
properties.

$\phi(t) =1$ for $\lvert t \rvert \le 1$
$\phi(t)$=0 for $t \geq 2$
$\lvert \phi'(t) \rvert \le 2 $

I have tried the obvious function $\exp\left(\frac{1}{t^2-1} \right)$ as follows.
$$ \phi(t)=\begin{cases}
1 & \mbox{if} & \lvert t \rvert \le 1\\
\exp\left(\frac{1}{t^2-1}\right) & \mbox{if} & -2 < t < -1 \; \mbox{or} \; 1 < t < 2 \\
0 & \mbox{if}& \lvert t \rvert \geq 2
\end{cases} $$
But I can't seem to get the required bound on the derivative of $\phi(t)$.
Question?: What am I doing wrong here?. How can I adjust/improve this to get the bound I want?. Any suggestions?

REPLY [7 votes]: Ok, let me elaborate on my comment.
The point is that we don't need convergence of the derivative, but only a bound on the derivative (which - for differentiable functions - is the same as a Lipschitz estimate).
Take any "mollifier" $\varphi \in C_c^\infty (\Bbb{R})$ with $\varphi \geq 0$, $\int \varphi \, dx = 1$ and $\rm{supp}(\varphi) \subset (-1,1)$.
Now, take any $g : \Bbb{R} \to \Bbb{R}$ with $g |_{ [-1-\frac{1}{10}, 1 + \frac{1}{10}] }\equiv 1$ and $g(x) =0$ for $|x| \geq 2 - \frac{1}{10}$ and so that $g$ is Lipschitz with Lipschitz constant at most $2$. Take e.g.
$$
g\left(x\right)=\begin{cases}
0, & <x-2+\frac{1}{10},\\
\frac{10}{8}\cdot\left(x+2-\frac{1}{10}\right), & x\in\left[-2+\frac{1}{10},-1-\frac{1}{10}\right],\\
1, & x\in\left[-1-\frac{1}{10},1+\frac{1}{10}\right],\\
-\frac{10}{8}\left(x-2+\frac{1}{10}\right), & x\in\left[1+\frac{1}{10},2-\frac{1}{10}\right],\\
0, & x>2-\frac{1}{10}.
\end{cases}
$$
This $g$ is Lipschitz with Lipschitz constant $10/8 < 2$.
Now, let $\varphi_\varepsilon (x) = \varepsilon^{-1} \cdot \varphi(x/\varepsilon)$ for $\varepsilon > 0$. Using $\int \varphi_\varepsilon \, dx = 1$ and the support condition on $\varphi$, it is easy to see that $g_\varepsilon := g \ast \varphi_\varepsilon$ satisfies you conditions (1) and (2) for $\varepsilon < \frac{1}{10}$.
But standard arguments, $g_\varepsilon \in C_c^\infty ( \Bbb{R})$. It remains to verify the bound on the derivative. To this end, note
\begin{eqnarray*}
\left|g_{\varepsilon}\left(x+h\right)-g_{\varepsilon}\left(x\right)\right| & = & \left|\int_{\mathbb{R}}\left[g\left(x+h-y\right)-g\left(x-y\right)\right]\cdot\varphi_{\varepsilon}\left(y\right)\, dy\right|\\
 & \leq & \int_{\mathbb{R}}\left|g\left(x+h-y\right)-g\left(x-y\right)\right|\cdot\varphi_{\varepsilon}\left(y\right)\, dy\\
 & \leq & \frac{10}{8}\cdot\left|\left(x+h-y\right)-\left(x-y\right)\right|\cdot\int_{\mathbb{R}}\varphi_{\varepsilon}\left(y\right)\, dy\\
 & = & \frac{10}{8}\cdot\left|h\right|.
\end{eqnarray*}
This estimate in general shows that convolution with $L^1$ functions preserves Lipschitz properties.
Using the definition of the derivative, we conclude (we know that the limit exists, because $g_\varepsilon$ is smooth):
$$
\left|g_{\varepsilon}'\left(x\right)\right|=\lim_{h\rightarrow0}\left|\frac{g_{\varepsilon}\left(x+h\right)-g_{\varepsilon}\left(x\right)}{h}\right|\leq\lim_{h\rightarrow0}\frac{\frac{10}{8}\cdot\left|h\right|}{\left|h\right|}=\frac{10}{8}.
$$
This shows that condition (3) is also satisfied.
Incidentally, an easy modification of the above proof even shows that one can take any constant strictly larger than $1$ instead of $2$ in condition (3).