If $f$ continuous and $\lim_{x\to-\infty }f(x)=\lim_{x\to\infty }f(x)=+\infty $ then $f$ takes its minimum.

Solution 1:

Your proof is correct. You can simplify it a bit by starting with a single point instead of an interval. Also it is not necessary to distinguish whether $f(x)\geq M$ for all $x\in [N_1,N_2]$ or not:

Let $a \in \mathbb R$ and $M := f(a)$. There exist $N_1 < a$ and $N_2 > a$ such that $f(x) \ge M$ for $x < N_1$ and for $x > N_2$. $f$ takes a minimum $m$ on the compact interval $[N_1, N_2]$. Since $m \le f(a) = M$, this is also a global minimum.