# 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. – user2970357 Jun 16 '14 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 Jun 16 '14 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! – user2970357 Jun 16 '14 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 – user2970357 Jun 16 '14 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$.) – David Mitra Jun 16 '14 at 21:07
• very nice and elegant, thanks – user2970357 Jun 16 '14 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). – davidlowryduda Jun 16 '14 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 – user2970357 Jun 16 '14 at 20:32