# Min/max of a continuous function

Let $f:\mathbb{R}\rightarrow\mathbb{R}$ be a continuous function with

$\lim_{0\to +\infty}f(x)=\lim_{0\to -\infty}f(x)=0$

I need to show, that the function $f$ attains a minimum and/or a maximum.

To apply the extreme value theorem, the function must be defined on a closed and bounded interval $[a,b]$. So I think I can't use it here.

It's clear however, since both limits are zero and $f$ is continuous, that there must exist an upper bound $a\geq f(x),\forall x\in\mathbb{R}$ and a lower bound $b\leq f(x),\forall x\in\mathbb{R}$

But how can I prove it rigorously?

• If $f$ is identically $0$ there is nothing to prove. So there is an $x$ where $x$ is positive, or one where it is negative. Take the positive case, and suppose $f(a)=c\gt 0$. There is a $P$ such that for all $x\lt P$ we have $f(x)\lt c/2$, also a $Q$ such that for all $x\gt Q$ we have $f(x)\lt c/2$. Now look at the closed interval $[P,Q]$. Note that in this case $f$ need not attain an absolute minimum. Commented Dec 7, 2015 at 23:40

Without loss of generality, assume that $f(0)$ is positive. There is an $M$ such that $$|x| > M \implies |f(x)| < f(0)$$ given the limits at $\pm \infty$. Now apply your theorem to the interval $[-M, M]$ to conclude that $f$ not only attains a maximum, but does so within $[-M, M]$.
• A minimum doesn't necessarily exist if $f(0)>0$. Commented Dec 7, 2015 at 23:34
• @Bernard Sure; my wording is a little vague, sorry. If $f(0) < 0$, then the function does attain a minimum and the argument for its existence is similar.