Can we use Rolle's Theorem if $f : [a, b] \to \mathbb{R}$ is continuous on $(a, b)$ only? Why in Rolle's theorem the function is given to be continuous on the closed interval $[a, b]$ and differentiable on the open interval $(a,b)$? What if we take open interval for continuity as well? Please answer if anyone knows.

The theorem does not hold. For instance, consider the function $f: [0,1] \to \mathbb{R}$
$$    f\left(x\right) = \left\{
     \begin{array}{lr}
       x & \text{if}  \ x \in (0,1) \\
       0 & \text{otherwise}
     \end{array}
   \right.\\ $$
All of the hypotheses of the theorem hold (except continuity on the extremal points), but $f'(x)=1$ for every $x \in (0,1)$.
