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

calculuscontinuityextreme-value-theorem

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?

Best Answer

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}$$

Related Question