Find a function $f:[a,b] \to R$ such that
- $f(x)>0$ for all $x \in [a,b)$
- $f(b)=0$
- f is differentiable in $[a,b]$
There is no $ε>0$ such that
$f'(x)<0$ for all $x \in (b-ε,b)$
I thought of trying to divide $[a,b]$ in infinite many intervals like $A_{i}=\left[a+\sum^{i-1}_{k=1}{\dfrac{b-a}{2^{k}}},a+\sum^{i}_{k=1}{\dfrac{b-a}{2^{k}}}\right]$ for $i=\{1,2,\dots\}$
and make f a non strictly decreasing function in each one of those $A_i$ but I couldn't guarantee that f would be differentiable.
This is not a problem from a book/lesson or anything.
If $a=-\frac12$ and $b=0$, you can take$$f(x)=\begin{cases}x^2\sin\left(\frac 1x\right)-\frac x2&\text{ if }x<0\\0&\text{ if }x=0.\end{cases}$$