# If a function is defined on a closed interval $[a,b]$, does it necessarily achieve a max and min value on that interval?

The extreme value theorem requires that a function be continuous on a closed interval $[a,b]$ for it to necessarily take on a max and min, but I've been thinking and it seems to me that as long as it is defined for all numbers in a closed interval it will take on a max and min on that interval.

Is this correct?

Consider $f:[-1,1] \to \mathbb{R},$

$$f(x)=\begin{cases} |x| &, x\in [-1,1]\setminus \{ 0\}\\ 1&, x=0 \end{cases}$$

then this function does not have a global minimum.

Another function would be $g: [-1,1] \to \mathbb{R}$,

$$g(x)=\begin{cases} \frac{1}{x+1}+\frac{1}{x-1} &, |x| \leq 1\\ 0&, |x|=1 \end{cases}$$

Consider the function: $$f(x) = \begin{cases}\frac{1}{x} & x\neq 0 \\ 0 & x = 0\end{cases}$$ on any interval $[a,b]$ such that $0\in (a,b)$. It has no global maximum or minimum, and is even continuous (and infinitely differentiable) on the entire interval besides $0$.

• I'm just going over this chapter in my calculus class, so perhaps I'm mistaken, but I meant to ask if a maximum on the interval $[a,b]$ could exist, rather than a global maximum--- am I wrong in thinking such a distinction exists? My textbook defines a maximum point as "Let $f$ be a function and $A$ a set of numbers contained in the domain of $f$. A point $x$ in $A$ is a maximum point for $f$ on $A$ if $f(x) \geq f(y)$ for every $y$ in $A$." By this definition couldn't you examine [0,1] on your function and have a min at 0 and max at 1 (though not global ones), or am I wrong? somewhere? Commented Dec 3, 2017 at 7:48
• Sorry, I meant any closed interval $[a,b]$ where $0\in (a,b)$. You're correct that for your interval, you'd have a min at $0$. You wouldn't have a max at $1$ though, because $f(1) = 1$, but $f(1/2) = 2\geq f(1)$. No number will end up being a max, because if you tell me $p$ is a max, then $f(p) = 1/p$, but $f(p/2) = 2/p\geq f(p)$. If you choose the interval correctly (as I mention in the beginning of my comment), a similar argument shows there can be no min on the interval as well. Commented Dec 3, 2017 at 8:25