Suppose $f:\Bbb R\to\Bbb R$ is continuous such that $f(x)\to0$ as $|x|\to\infty$. Prove that $f$ attains either a maximum or a minimum.
My attempt at the question :
Given $\epsilon > 0 \ \ \exists \ \alpha > 0$ such that
$\ |f(x)| < \epsilon\ \ \ \forall \ \ \ \ |x| > \alpha$
Now, when $\ \ x \in [-\alpha,\ \alpha] $, by the Extreme value theorem, since $f(x)$ is a continuous function on a closed interval, it attains a maximum (say $ M$) and a minimum (say $m$).
I am stuck at this part. I think the way to move forward is by using the fact that we can make $ \epsilon $ as small as possible. But I don't know how to prove that it will surely attain a maximum or a minimum or both.