Give an example of a function \(f:\RR\to\RR\) such that
- \(f(x)=0\) for \(x<0\) and for \(x>2\);
- \(f'(1)=1\);
- \(f\) has derivatives of all orders.
Solution
Define \[ \eta(t) \coloneqq \begin{cases} e^{-1/t},&t>0,\\ 0,&t\le0, \end{cases} \] and then define \[ \boxed{ f(x)\coloneqq e(x-1)\eta\bigl(x(2-x)\bigr). } \]
1. The function \(\eta\) is \(C^\infty\) on \(\RR\), and\[ \eta^{(k)}(0)=0 \]for every \(k\ge0\).
For \(t>0\), repeated differentiation shows that for every \(k\ge0\) there is a polynomial \(P_k\) such that \[ \eta^{(k)}(t) = P_k(1/t)e^{-1/t}. \] For every integer \(m\ge0\), \[ \lim_{t\downarrow0}t^{-m}e^{-1/t}=0, \] because after putting \(s=1/t\) this becomes \[ \lim_{s\to\infty}s^me^{-s}=0. \] Hence every derivative from the right tends to \(0\) at \(t=0\). On \((-\infty,0]\), the function is identically zero. Inductively, the one-sided derivatives of every order match at \(0\), all with value \(0\). Thus \(\eta\in C^\infty(\RR)\) and is flat at \(0\).
2. The function\[ \phi(x)\coloneqq\eta\bigl(x(2-x)\bigr) \]is \(C^\infty\) on \(\RR\) and vanishes for \(x\le0\) and for \(x\ge2\).
By step 1, \(\eta\) is smooth, and \(x\mapsto x(2-x)\) is a polynomial, so their composition \(\phi\) is smooth. If \(x\le0\) or \(x\ge2\), then \[ x(2-x)\le0, \] and therefore \(\phi(x)=0\) by the definition of \(\eta\).
3. The displayed function \(f\) is \(C^\infty\) and satisfies\[ f(x)=0 \]for \(x<0\) and for \(x>2\).
By step 2, \(\phi\) is smooth, so the product \[ f(x)=e(x-1)\phi(x) \] is smooth. The same step shows that \(\phi\), hence \(f\), vanishes outside \([0,2]\).
4. The derivative of \(f\) at \(1\) is\[ \boxed{f'(1)=1.} \]
The product rule gives \[ f'(x)=e\phi(x)+e(x-1)\phi'(x). \] Since \[ 1(2-1)=1, \] we have \[ \phi(1)=\eta(1)=e^{-1}. \] Therefore \[ f'(1)=e\phi(1)=e\cdot e^{-1}=1. \]
5. Q.E.D.
Step 3 proves the support and smoothness requirements, and step 4 proves the prescribed derivative condition.