# continuous function and max/min values

I would be happy if someone could give me a hand with this practice problem.

Given $f$ is continuous in the interval $[0, \infty)$, and $f(0) = \lim_{x\to\infty}f(x) = 0$, prove or disprove: $f$ attains a maximum and a minimum in the interval $[0, \infty)$.

Now, I approached this by creating a closed interval $[0,n]$, inside which $f$ is continuous. So by Weierstrass's second theorem I know that $f$ gets max/min values inside it. Now, if I'm given that the limit is zero when $x$ goes to $\infty$, I know that for any $\epsilon > 0$ , there exists $n>0$ such that, for any $x>n$, $|f(x)-0| < \epsilon \implies |f(x)| < \epsilon$.

I'm having trouble showing exactly how $f$ gets minimal or maximal values in the interval $[n, \infty)$. Also, I'm having trouble explaining how $f(0) = 0$ helps me define a minimal/maximal value when $x$ goes to $\infty$.

Thanks for any help.

• yes thats right sorry, was a misstype. Commented Jun 16, 2014 at 20:28
• I've added LaTeX code for the math in your question while also correcting grammatical and spelling errors I saw along the way. Take a look at the code to get a feel for how to write up questions in a readable way on Math.SE. For a more thorough reference regarding math syntax on this site, see this quick guide.
– Dan
Commented Jun 16, 2014 at 20:34

For a maximum: If $f(x)\le0$ for all $x$, there's nothing to show (the maximum value is $f(0)=0$). Otherwise, $f(c)=\alpha>0$ for some $c>0$. Choose $N>c$ so that $f(x)<\alpha/2$ for all $x\ge N$. This can be done since $\lim\limits_{x\rightarrow\infty} f(x)=0$.

Now, $f$ attains a maximum value on $[0,N]$. Show that this in fact is the global maximum value of $f$ (note the maximum value on $[0,N]$ is at least $\alpha$).

Argue in a similar manner to show $f$ attains a minimum value.

• thumbs up! that helped alot, cheers! Commented Jun 16, 2014 at 20:46
• one last thing, as for maximum it's clear , as my maximum in [0,N] >= eps, and when x>n f(x) < eps/2 for all x. what about min value? the min i chose for f(c) dosn't contradict f(x) < epsilon so arguing the same thing dosn't work for min case. I must be missing somthing Commented Jun 16, 2014 at 20:59
• @user2970357 For the min: If $f(x)\ge0$ for all $x$, we're done. Otherwise, choose $c>0$ with $f(c)=\alpha<0$. Choose $N>c$ so that $f(x)>\alpha/2$ for $x\ge N$... (Alternatively, $g=-f$ has a maximum value; this will be the minimum value of $f$.) Commented Jun 16, 2014 at 21:07
• very nice and elegant, thanks Commented Jun 16, 2014 at 21:13

Hint: take a look at the functions $f_1(x) = \frac{1}{x+1}$ and $f_2(x) = -\frac{1}{x+1}$. Does $f_1$ reach it's minimum? How about $f_2$, does it achieve its maximum?

• Your functions are not $0$ at $0$. (Not that it really matters too much). Commented Jun 16, 2014 at 20:30
• well f1 wont reach a min value as x goes to inf, but f will have an infimum = 0, .. f2 gets a suprimum for x goes to inf but no maximum Commented Jun 16, 2014 at 20:32

If $$f(x)\le0$$ for all $$x\in[0,\infty)$$, then the maximal value of $$f$$ is $$0$$, and it is attained in $$x=0$$.

If $$f(x_0)>0$$ for some $$x_0\in[0,\infty)$$, let $$a=f(x_0)>0$$ and $$\varepsilon=\dfrac{a}{2}$$.

Since $$f$$ is continuous and $$\lim_{x\to\infty}f(x)=0$$, then there exists $$N>0$$ such that $$|f(x)|<\varepsilon$$, for all $$x>N$$.

The interval $$[0,N]$$ is compact, therefore $$f$$ attains a maximum value in these interval, said $$M=f(x_m)$$. Clearly we have that $$M\ge a$$ and then $$M>\dfrac{a}{2} =\varepsilon> f(x)$$, for all $$x>N$$. Hence $$M$$ is the maximum value of $$f$$ in $$[0,\infty)$$ attained at $$x_m$$.

The case of the minimal value is analogous.

Remark: We need to have the hypothesis $$f(0)=\lim_{x\to\infty}f(x)$$, otherwise we can take an increasing or decreasing monotone function which never attains the maximum or the minimum value, respectively.