Looking for a differentiable function which behaves somewhat like $\min(x,1)$ Is there a differentiable function $f : [0,2] \rightarrow [0,1]$ such that $f(x) = 0$ iff $x=0$ and $f(x) = 1$ iff $x \in [1,2]$? What about $n$ times differentiable for any $n$, or infinitely differentiable? Thank you!
 A: First, let
$$f(x)=\begin{cases}e^{\frac{-1}{x}}&x>0\\0&x\le0\end{cases}$$
It can be shown that $f$ is smooth.  Then one such desired function is
$$g(x)=\frac{f(x)}{f(x)+f(1-x)}$$
Since $f$ is smooth, and $f(x)+f(1-x)$ is never $0$, $g$ is also smooth.  $g$ takes values $0$ for $x<0$, and values $1$ for $x>1$.  It's called a smooth transition function.
A: How about 
$$f_n(x) = \left\{
\begin{array}{ll}
  1-(-1)^n(x-1)^n & 0\leq x \leq 1 \\
  1 & 1\leq x\leq 2.
\end{array} \right.
$$
This will be $n-1$-times differentiable for any integer $n\geq 2$.
The graphs of these functions for $n=1$ through $10$ look like so:

As Jared has already shown, we can make the function infinitely differentiable at $x=1$. A minor variation of his example is
$$f(x) = \left\{
\begin{array}{ll}
  1 - e^{1 - 1/(1 - x)} & 0\leq x \leq 1 \\
  1 & 1\leq x\leq 2,
\end{array} \right.
$$
which looks like so:

A: This just addresses the "does there exist such a function" with only one differentiation.
We want $f'(x) = 0$ for $x \in [1, 2]$ so that the function is constantly $1$.  We could define such a function piecewise:
$$f(x) = \begin{cases}
\sin^2\frac{\pi x}{2} & 0\le x \lt 1 \\
1 & 1 \le x \le 2
\end{cases}$$
