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.

Consider the function $f : [0, 1] \to \mathbb{R}$, given by
$$\begin{cases}
x & 0 \leq x < 1\\
0 & x = 1.
\end{cases}$$
Note that $f$ is continuous and differentiable on $(0, 1)$, and $f(0) = f(1)$, but $f'(x) = 1$ for all $x \in (0, 1)$; in particular, there is no $c \in (0, 1)$ such that $f'(c) = 0$.
As the above example shows, continuity on the open interval only is insufficient for Rolle's Theorem.
