Any lower semicontinuous function $f: X \to \mathbb{R}$ on a compact set $K \subseteq X$ attains a min on $K$. I've been thinking about this problem for a long time right now, and feel stuck. 
Given that $X$ is a topological space, and that for $f$ to be lower semicontinuous, for any $x \in X$ and $\epsilon > 0$, there is a neighborhood of $x$ such that $f(x) - f(x') < \epsilon$ for all $x'$ in the neighborhood of $x$. Also, for the compact definition, I can only think of using every open cover of $K$ has a finite subcover for the topological definition of compact sets.
I don't know where I went wrong, but I don't see where I used the fact of $K$ being compact. So I'll put what I did.
Suppose that $\inf f(K)$ exists, then let's call it $a \in \mathbb{R}$. By the intermediate value theorem, we know that there exists some $x_0 \in X$ such that $f(x_0) = a$. So given that $f$ is lower-semicontinuous, then for $x_0 \in X$ and $\epsilon > 0$, there is a neighborhood of $x_0$ such that $f(x_0) - f(x') < \epsilon$ for all $x'$ in the neighborhood of $x_0$. Note there is an open set in the neighborhood of $x_0$ that contains $x_0$. Then since $K$ is compact, there is a finite open subcover of $K$. So call this finite subcover of $K$, $J$ and call the open set that contains $x_0$, $L$. Hence, $J \cup L$ is an open cover of $K$ and $f$ attains a minimum on $K$.
If the infimum of $f(K)$ does not exist, then we can't consider the case above. Take any $c \in f(K)$. Consider the set of the form $f_c := \{x \in X | f(x) \leq c\}$. Then we see each  $f_c$ is closed since $f$ being lower-semicontinuous implies $f^{-1}(-\infty,a]$ is closed for any $a \in \mathbb{R}$ and $f(K)$ being unbounded. For all $c \in f(K)$, we have that the intersection of all $f_c$ gives us that the intersection of the $f_c$ is closed. Not sure if this fact is in contrary of $K$ being compact. I got stuck here.
 A: So this won't help the person who needed it for homework, but for future visitors, here's an approach which is similar to the one above, but uses a contradiction of compactness.
Suppose $f$ has no minimum in $K$, then $\neg(\exists x\in K)(\forall y\in K)(f(x)\leq f(y))$ which is equivalent to $(\forall x\in K)(\exists y\in K)(f(y)<f(x))$ which is equivalent to $(\forall x\in K)(\exists y\in K)(x\in f^{-1}((f(y), +\infty)))$. 
But this means the collection of open sets $\{f^{-1}((f(y), +\infty)):y\in K\}$ is an open cover of $K$. 
We claim this open cover has no finite subcover.
Suppose $\{y_1, \cdots, y_n\}\subset K$ is finite, and define $N = \displaystyle\arg\min_{1\leq k\leq n}f(y_k)$, then $\displaystyle\bigcup_{1\leq k\leq n}(f(y_k),+\infty) = (f(y_N), +\infty)$. Then we have $\displaystyle y_N\in K$, but  $y_N \notin f^{-1}((f(y_N), +\infty))= f^{-1}(\bigcup_{1\leq k\leq n}(f(y_k),+\infty)) = \bigcup_{1\leq k\leq n}f^{-1}((f(y_k),+\infty))$ and so $\{f^{-1}((f(y_k),+\infty)):1\leq k \leq n\}$ doesn't cover $K$.
This contradicts the compactness of $K$.     
A: Lower semicontinuity need not imply intermediate value property(IVP), and a function on a compact interval in $\mathbb{R}$ which satisfies IVP can fail to have the minimum.
But your $\inf = -\infty$ case proof can be elaborated to conclude that $f$ cannot be unbounded below. What you need is the finite intersection property of a compact set. Or, you can just consider the open cover (why?) formed by the open sets $U_c = \{ x : f(x) > c \}$ to obtain the boundedness of $f$.
Here is another possible approach:
Suppose $f$ has no minimum, and let $\alpha = \inf f(K)$. Then for each $x \in K$, we have $\alpha < f(x)$ and there is $\epsilon(x) > 0$ satisfying
$$\alpha < f(x) - \epsilon(x).$$
Then by lower-semicontinuity, there exists a neighborhood $U(x)$ of $x$ such that $f(x) - \epsilon(x) < f(y)$ for all $y \in U(x)$. Now $U(x)$ covers $K$, so there are finitely many $x_1, \cdots, x_n \in K$ where
$$K \subset U(x_1) \cup \cdots \cup U(x_n).$$
Let $\beta$ be given by
$$ \beta = \min \{ f(x_k) - \epsilon(x_k) : k = 1, \cdots, n \}.$$
Then clearly $\alpha < \beta$, and for any $y \in K$, $y \in U(x_k)$ for some $k$ and hence $\beta \leq f(x_k) - \epsilon(k) < f(y)$, which means that $\beta \leq \inf f(K) = \alpha$, a contradiction! Therefore $f$ must attain its minimum at some point in $K$.
