I would like to ask for help with the proof of the following proposition:
Let f be a real continuous function, defined on a closed set $X \subset \mathbb{R}^n$, which is coercive, i.e. for every sequence $\{x_n\}_{n=1}^\infty$ with $||x_n|| \to \infty$ we have $f(x_n) \to +\infty$. Then $f$ achieves global minimum on $X$.
My idea for a proof: If $X$ is bounded we are done by the Weierstrass extreme value theorem. But we only have closeness. So let $f^* = \inf\limits_{x\in X}f$ which is achieved at $x^*$ for which we don't know if $x^* \in X$. Let $Y$ be the closed ball of radius $||x^*||+1$. It surely contains $x^*$ and is bounded and so is $$ Z = X \cap Y \subset Y $$ Now we know that $Z$ is compact and $f$ achieves its minimum there. But are we sure (and if yes, why) that this minimum is actually $f^*$ and thus $x^* \in X$?