Why is it important that we use the Mean value theorem on an interval? In every instance that I've seen mean value theorem is stated with one condition that I haven't understood, namely the condition of  "$f:[a,b] \rightarrow \mathbb{R}$". I know that there are some other important conditions like the function must be continuous on the closed interval $[a,b]$ and it has to be differentiable on the open interval $(a,b)$ but these are easier to observe and give a counterexample for. So why is it important that the function is defined on a closed interval to begin with? Shouldn't it work the same for a polynomial that is continuous and differentiable on $\mathbb{R}$?
 A: The theorem is of course applicable to a function continuous and differentiable on the real line. But the theorem's conclusion needs a particular interval to be fixed in the discussion, to make any sense.
That is, the real values $a,b$ must be specified in order to form the concluding statement. (Recall that the theorem's conclusion involves the real numbers $b-a$ and $f(b)-f(a)$.)
The meaning of "$f:[a,b] \rightarrow \mathbb{R}$" is: there is a function taken as given, which assigns to every real $x$ satisfying $a\leqslant x\leqslant b$ a unique real number $f(x).$
A: The key assumption in mean value theorem is the connectedness of $[a,b]$. Roughly speaking connectedness means "the interval is made of one piece". If you loose this then the usual inequalities/equalites between a function increasing rate and its derivative cannot hold. For instance consider $ f : [0,1] \cup [2,3] \ \longrightarrow \mathbb R$ defined by
$$
f(x) = \begin{cases}
0, \ x \in [0,1] \\
1, \ x \in [2,3]
\end{cases}
$$
It is a very regular function but yet if you try to apply the mean value theorem in $[a,b] \cap ([0,1] \cup [2,3])$ you would get that $f$ is constant which is not the case.
