# Why exactly does a function need to be continuous on a closed interval for the intermediate value theorem to apply?

I apologize if this question is too basic. The intermediate value theorem states that if $f$ is continuous on a closed interval $[a,b]$, then for every value $c$ between $f(a)$ and $f(b)$ there exists some $x \in (a,b)$ such that $f(x) = c$. This, or some very similar variant thereof, is how the intermediate value is usually presented in textbooks. What bugs me, however, is the condition that $f$ need be continuous on the closed interval $[a,b]$ rather than the less strict condition of only being continuous on the open interval $(a,b)$. To illustrate this point, consider $f:[-1,1] \rightarrow \mathbb{R}$ where $f(x)= e^x$. This is only continuous on the open interval $(-1,1)$ but surely the IVT applies to it. A less artificial example would be the inverse sine function. Would this reasoning not apply to all such (continuous/well-behaved) functions?

As an alternative, wouldn't the following definition from Proofwiki be superior (in that it is slightly more general)?

Let $I$ be a real interval. Let $a,b \in I$ such that $(a,b)$ is an open interval. Let $f:I \rightarrow \mathbb{R}$ be a real function continuous in $(a,b)$. Then for every value $c \in \mathbb{R}$ between $f(a)$ and $f(b)$ there exists some $x \in (a,b)$ such that $f(x) = c$

• The function $f:[-1,1] \to \mathbb R$ such that $f(x) = e^x$ is continuous on the closed interval $[-1,1]$. – littleO Dec 11 '15 at 1:51
• $\sin^{-1}$ is continuous on $[-1,1]$. – Milo Brandt Dec 11 '15 at 1:51
• @Milo Brandt Wait...there's no consideration of left-continuity and right-continuity? – YouKnowNothing Dec 11 '15 at 1:52
• @YouKnowNothing Not really; the definition of continuity in this context is $\lim_{x\rightarrow c}f(x)=f(c)$ and we only allow the $x$ in the limit to range in the domain of $f$. So, being near undefined regions does not fail to make $f$ continuous. In fact, we could consider a function defined only at a single point - and it would be continuous. Really, with continuity we have to think of more regions as causing more problems - so removing regions of the domains cannot make a function discontinuous. – Milo Brandt Dec 11 '15 at 1:56
• @Milo Brandt Oh, okay, then that's my main misapprehension. Weird how they don't mention these subtle points in calculus textbooks (or, at least mine) :P. – YouKnowNothing Dec 11 '15 at 2:01

The function

$$f(x) = \begin{cases}10 & x = -1\\ 0 & x\in (-1,1) \\ 20 & x=1\end{cases}$$ does not satisfy the IVT. There is no $x\in(-1,1)$ such that $f(x)$ is between $f(-1)$ and $f(1)$.

However, clearly $f$ is continuous on $(-1,1)$.

I think what you are trying to say is that requiring continuous on closed interval is a bit too much. But at least for the time being note that (classic) IVT does not even make sense if $f(a),f(b)$ is not defined.

The essence of IVT is the fact that the notion of connectedness is preserved under continuous mapping. Consider for example the fucntion

$$f(x)=1/x \;\; \forall x\in(0,1)$$

Classic IVT cannot possibly be applied here since $f(0)$ is not even defined. But it is still true that, for every $c\in (1,\infty)$ we can find some $x_0\in (0,1)$ such that $f(x_0)=c$.

This is because $f$ is continuous, and that $(0,1)$ is connected, so that $f((0,1))$ is necessarily connected.

• @fred When I said classic I was referring to the one requiring $f$ being continuous on $[a,b]$ - this obviously requires $f(a),f(b)$ to be defined. Unless I'm missing something, the one on ProofWiki as stated is not correct. 5xum's example is a direct counterexample. – user160738 Dec 11 '15 at 3:26
• I posted my comment to the incorrect answer. I apologize. – fred Dec 11 '15 at 3:32

I think 5xum's answer gives a good example. The general reason you need continuity on a closed interval is that you need to tie the values $f(a)$ and $f(b)$ to the values the function takes on the rest of the interval. If the function is not continuous at the end points then its value at the endpoints need have nothing to do with the values the function takes on the interior of the interval.

If you did want to change the IVT to work for an open interval you could use the following modification.

Let $f(x)$ be continuous on an open interval $(a,b)$ and let $c,d\in (a,b)$ such that $f(c)<f(d)$, then $\forall e\; (f(c)<e<f(d))$ there exists a $g\in (a,b)$ such that $f(g)=e$.