Proof $f$ has a minimum if $f$ is continuous and $\lim_{x \rightarrow \infty}(f(x))=\infty=\lim_{x \rightarrow -\infty}(f(x))$ I have a question about the validity of this proof I wrote:
Claim: If $f$ is continuous on $\mathbb{R}$ and $\lim_{x \rightarrow \infty}(f(x))=\infty=\lim_{x \rightarrow -\infty}(f(x))$, then $f$ has a minimum.
My proof:
Lower Bound Theorem) If $g$ is continuous on $[a,b]$, then $\exists z \in [a,b]: \forall x \in [a,b]: f(z)\leq f(x)$
(1) $\forall N_1: \exists n_1>0: \text{if } x>n_1 \text{ then } f(x)>N_1$ (Definition)
(2) $\forall N_2: \exists n_2<0: \text{if } x<n_2 \text{ then } f(x)>N_2$ (Definition)
(3) Given $N_1, N_2$: Let $I = [n_2, n_1]$
(4) $\therefore f$ is continuous on $I$
(5) $\therefore \exists y \in I: \forall x \in I:f(y) \leq f(x)$ (Using Lower Bound Theorem)
(6) If $x \in \mathbb{R}$ but $x \notin I$, then $x < n_2$ or $x>n_1$.
(7) $\therefore f(x) > N_1$ or $f(x) > N_2$
(8) Choose $N_1, N_2: f(y)<N_1$ and $f(y)<N_2$
(9) $\therefore \forall x \in \mathbb{R}:f(y) \leq f(x)$
Thanks for reading. I'm not sure about line 8. I already defined $N_1$ and $N_2$ in line 3, and constructed $y$ based on that in line 5. So if I redefine $N_1$ and $N_2$ based on $y$ in line 8, that could potentially redefine $y$ in line 5, which could redefine $N_1$ and $N_2$ in line 8, which could redefine $y$ in line 5, etc. etc. I'm pretty sure either this is just a little technicality that can be fixed easily but I'm not sure how, or it's not a problem at all and I'm overthinking. Can someone help?
 A: As an alternative, let consider the restriction $f:[a,\infty) \to \mathbb R$ then if $f(a)$ is not a minimum for the restriction by IVT $\exists b>a$ such that $f(b)=f(a)$ and $f(x)\ge f(b) \,\forall x\ge b$, then by EVT the restriction attains a minimum $f(c)$ at $c\in [a,b]$.
We can use the same argument for the restriction $f:(-\infty,a] \to \mathbb R$ to show that the restriction attains a minimum $f(c')$ at $c'\in [b',a]$.
Then $$\min (f(x))=\min(f(c),f'(c))$$
A: Another way to see that result is the following. I just give the lines of the proof, one can prove the details by itself : consider
$$A = f^{-1}\left((-\infty, f(0)]\right)$$

*

*$A$ is closed.

*$A$ is bounded, because $\lim_{x \rightarrow \pm \infty} f(x) = +\infty$.

So $A$ is compact, so $f$ has a minimum on $A$.


*this minimum is a global minimum of $f$.

A: Your argument can be modified as follows.
Let $N$ be any positive number such that $N>f(0).$ By the given assumptions, there exist $n_1>0$ and $n_2<0$ such that $$f(x)>N,\forall x>n_1$$ and $$f(x)>N,\forall x<n_2.$$
Since $f$ is continuous on $\mathbb R$, $f$ is continuous on $[n_2,n_1]$. By Weierstrass’s Theorem (or the Lower Bound Theorem in your proof), $$\exists z\in [n_2,n_1] ~{\rm such~that~}f(z)\leq f(x),\forall x\in [n_2,n_1].$$ In particular $f(z)\leq f(0)<N.$ Clearly $f(z)$ is the minimum of $f$ on $\mathbb R$. QED
A: Let $x_0$ be some point in $\mathbb{R}$. Since $\lim_{x\to\pm\infty} f(x)=\infty$ and $f$ is  continuous, there exists an $M>0$ such that $$f(x_1)>f(x_0)$$ for any $x$ satisfying $|x|>M$. Since any minimizer $x^*$ of $f$ over $\mathbb{R}$ satisfies $f(x^*)\leq f(x_0)$, it follows that the set of minimizers of $f$ over $\mathbb{R}$ is the same as the set over $\mathbb{R}\cap B_{|\cdot|}[0,M]$, which is compact and non-empty. This is because both $\mathbb{R}, B_{|\cdot|}[0,M]$ are closed and $B$ is bounded and contains $x_0$. Therefore by Weierstrass Theorem for closed functions, there exists a minimizer of $f$ over $\mathbb{R}\cap B_{|\cdot|}[0,M]$ and hence also over $\mathbb{R}$.
P.S.
The above holds for every coercive function $f$ and closed non-empty set $S$.
