# Function differentiable on $(a,b)$ but not continuous on $[a,b]$

Is there any function $f$ which is differentiable on an open interval $(a,b)$ but is not continuous on (and also cannot be extended continuously to) the closed interval $[a,b]$?

• $f(x)=1$ if $x\in(0,1)$, $f(0)=f(1)=0$. – David Mitra Nov 26 '14 at 12:38
• I have written the very same example... – ajotatxe Nov 26 '14 at 12:39
• @Anne You should tell us what attempts you have made to find a function like this – terrace Nov 26 '14 at 14:35
• "not continuous on $[a,b]$" and "can't be extended continuously to $[a,b]$" are not the same things - which one did you mean? (the answers here seem to suppose the first meaning) an example of the latter kind: $sin(1/x)$ on $(0,1)$ – Dániel G. Nov 26 '14 at 15:26

$$\Large\dot{}\!\!\underline{\qquad\qquad\qquad}\!\!\Large\dot{}$$



• What is it? Some sort of joke? – ajotatxe Nov 26 '14 at 12:45
• It is supposed to be a graph of such a function :) – Zubin Mukerjee Nov 26 '14 at 12:46
• ._.$\phantom{2}$ – Upc Mar 30 '18 at 19:37

$$f(x)=\frac1{(x-a)(x-b)},\qquad f(a)=f(b)=0.$$

The easiest function I can think of is

$$f(x)=\begin{cases}\sqrt x&,\;\;x\in (0,1]\\{}\\18&,\;\;x=0\end{cases}$$

• @Timbuc How did you think of it (I mean, rationale)? – hola Nov 26 '14 at 14:53
• @pushpen.paul, the square root is my box example of function defined and continuous on a certain interval but not differentiable in one point there. – Timbuc Nov 26 '14 at 15:10

Consider $f(x)=x-\lfloor x\rfloor$ at any interval $(n,n+1)$ with integer endpoints.

Differentiability implies continuity, but the intervals $(a,b)$ and $[a,b]$ were not the same; the first was open second was closed. This means at the points $a$ and $b$ it can be not continuous and it will still be differentiable on open $a,b$.

Thusly you can have a function that does what you said.

For example, you could have $f(a) = 5$ and $f(x) =2$ otherwise (when $x \neq a$). This function will have a discontinuity at $x=a$.