This question is a duplicate,but still I'm posting it because the answers given in the previously asked questions(by other users) are not satisfactory and since my reputation in the website isn't high enough, yet, I couldn't post any comments in the previous questions to get doubts clarified.
So, why is it defined in open $(a,b)$ rather than closed $[a,b]$.
Could you explain with an example?
Note: preiously asked questions(whose answers are not satisfactory) are:
Continuous and differentiable function in Rolle's theorem
Reason for the diferentiability of function on open interval in Rolle's Theorem
Let $f:[a,b] \to \mathbb R$ a continuous function, which is differentiable on $(a,b)$. If $f(a)=f(b)$, then Rolle's theorem says: there is $s \in (a,b)$ such that $f'(s)=0$.
Look at a proof of this theorem, then you will see:
and