# Let $X$ be compact and $f:X\to\mathbb{R}$ s.t. each $x\in X$ has a nbh where $f$ attains its minimum. Show $f$ attains minimum on $X$.

Consider a compact topological space $$X$$ and a map $$f:X\to\mathbb{R}$$ such that each $$x\in X$$ has a neighborhood where $$f$$ attains its minimum. Show that $$f$$ attains its minimum on $$X$$.

My attempt:

I was thinking of covering $$X$$ with all the neighborhoods where $$f$$ attains a minimum, so something like $$X\subseteq \bigcup_{x\in X} U_x$$. Then, by compactness, there would be a finite subcover. I don't see how I can conclude that a minimum is attained from this information: I could possibly go over all sets of the subcover and take the overall minimum that $$f$$ attains (which exists, as the subcover is finite), but am I guaranteed that this minimum is the minimum of $$f$$ on $$X$$?

• I'm confused, isn't it true that every function $f: X \rightarrow \mathbb R$ where $X$ is compact has a global minimum? Why the condition on $f$? – Noel Lundström May 30 '20 at 0:48
• Note that it's not given whether $f$ is continuous or not. – Zachary May 30 '20 at 8:27
• Map means continuous function. In general it's better to write something like "given a possibly discontinuous function $f$" to make that fact clear. – Noel Lundström May 30 '20 at 12:08

For each $$x\in X$$ we have open neighborhood $$U_x$$ of $$x$$ such that there is $$t_x\in U_x$$ such that $$f(t_x)\leq f(t) \ \forall t\in U_x$$.
By compactness of $$X$$, we have finite subcover $$\{U_{x_1},...,U_{x_n}\}$$ of $$X$$.
Hence ,$$f(t_{x_i})\leq f(t) \ \forall t\in U_{x_i}$$ for $$i=1,2,...,n.$$
$$\min\{f(t_{x_i})\}_{i=1}^n =f(t_0)$$ is required minimum.