# Right and left differentiability

Suppose $f:[a,b]\rightarrow \mathbb R$ is differentiable on (a,b) and continuous on [a,b]. Does it follow that $f$ is right-differentiable at $a$ and left-differentiable at $b$?

I guess it does not follow since $f:[a,b]\rightarrow \mathbb R$ can be differentiable at a point, call it $c \in (a,b)$ but not at the end points since the interval is open.

Is it right? If so, how do i formally prove?

Thanks!

• Think of square roots... – Amitai Yuval Dec 4 '14 at 23:29
• am I assuming right? – needhelp Dec 4 '14 at 23:31
• Yes yes you are. – Amitai Yuval Dec 4 '14 at 23:31

Consider the function given by $$f(x)=\cases{x\cos(1/x)&if 0<x\le1\cr 0&if x=0.\cr}$$ It is clear that $f$ is continuous on $(0,1]$ and differentiable on $(0,1)$. Moreover, $$\lim_{x\to0^+}f(x)=0$$ by the pinching theorem (sandwich theorem, squeeze theorem), so $f$ is also continuous at $0$ and the assumptions in your question are satisfied. However, $f$ is not right-differentiable at $0$ since $$\frac{f(x)-f(0)}{x-0}=\cos\Bigl(\frac1x\Bigr)$$ has no limit as $x\to0^+$.
• Would it be still valid if $f$ is continuous on [0,1]? – needhelp Dec 4 '14 at 23:42
• In my example, $f$ is continuous on $[0,1]$. – David Dec 4 '14 at 23:43