Show a continuous function $f$ attains a maximum value in $\Bbb{R}$. "Let $f:\Bbb{R}\to \Bbb{R}$ be a continuous function such that $f(0)=2$ and $\lim_{x\to{-\infty}}f(x)=0$, and $f$ is decreasing when $x\geq 3$ . Show $f$ attains a maximum value in $\Bbb{R}$."
Lets call the maximum value $M$. When $x\to \ -\infty$, we have that $f\to 0$. Let $\epsilon>0$ be given. This means there is a $N<0$ such that $$x<N \implies \vert f(x) \vert < \epsilon$$
In other words $f$ is arbitrarily small when $x<N$, therefore $M$ must exists at a point where $x\geq N$. Let $A=[N,0]$, and let $s$ be the point where $f(x)$ attains its maximum on $A$, that is $f(s)=sup(f(A))$. 
Since $f$ is decreasing when $x\geq 3$, $M$ can only occur at the point $3$, when $x\in [3,\infty)=B$.
So if $M$ exists in $A$, it is at the point $s$. Likewise, if $M$ exists in $B$, it is at $x=3$. Therefore   $M\in [s,3]$, since a continuous function attains a max and min value in a closed set and $f$ is continuous in $[s,3]$.
Is there a way to explicitly calculate $M$ with the given information? Also, to show the existence of $M$, is it enough to guarantee that $M$ exists in a closed set of $\Bbb{R}$ and then apply the extreme value theorem ( as I have tried )?
 A: Your proof isn't logically sound because you start with the assumption that a maximum $M$ exists and then go on to conclude that it must be in some given closed interval.
However, all you've shown is that if $M$ exists, then $M \in [s, 3].$ 
 (Which also doesn't make sense because $M$ is in the codomain and $[s, 3]$ is in the domain. You meant to conclude that $M = f(x_0)$ for some $x_0 \in [s, 3]$.)


In other words $f$ is arbitrarily small when $x < N$, 

This too doesn't make much sense. What you are saying is that $f$ becomes arbitrarily small when $x < N$ but that is not the case. (Note that you are fixing $N$.)
What is true is that $f$ can be made sufficiently small by choosing some "sufficiently negative" $N$.

However, your line of reasoning was sensible and one can polish it as follows:  


*

*Choose $\epsilon = 1$ specifically. Then, you know that there exists $N < 0$ such that $|f(x)| < 1$ for $x < N$.  

*For $x \ge 3$, you know that $f(x) \le f(3)$.  

*Consider the closed and bounded interval: $[N,3]$.
$f$ must attain its maximum on this. Call this maximum $M$.
(Now, we have actually shown the existence of $M$!)   

*Show that this $M$ is the maximum of $f$ on $\Bbb R$.
It is clear that $M \ge 2$ and $M \ge f(3)$. These two facts show that $M \ge f(x)$ for every $x \in (-\infty, N) \cup (3, \infty)$.  

*Thus, we are done.




Is there a way to explicitly calculate $M$ with the given information? 

No. In fact, try this exercise: Show that there exist two different functions $f$ satisfying the given conditions such that they have different maxima.


Also, to show the existence of $M$, is it enough to guarantee that $M$ exists in a closed set of $\Bbb R$ and then apply the extreme value theorem ( as I have tried )?

You have phrased it a bit incorrectly but the spirit is correct - the technique is often to show that the maximum that $f$ attains on some closed and bounded interval is going to be the maximum on $\Bbb R$ as well. (Note that you just wrote "closed", you also need "bounded".)
A: This proof as it stands is incorrect as it starts by assuming such an $M$ exists, then finding where it must occur; however the ideas shown in your proof are correct.
What you want to do is fix $N<0$ such that $$x<N\implies |f(x)|<1.$$ Then, as you described, find $a\in[N,3]$ such that $f(a)$ is maximal in this set -- which exists because this is a closed set and $f$ is continuous. Finally, you show that $f(a)\ge f(x)$ for all real $x$.
An outline would run as follows: if $x>3$, then $f(a)\ge f(3)\ge f(x)$.
If $x<N$, $|f(x)|<1<2=f(0)\le f(a)$ where the last inequality is by definition of $a$. Finally, we already know what happens if $x$ is in $[N,3]$.
(also to answer the additional questions -- explicitly calculating this maximum is impossible)
