How to show that a continous function $f:\mathbb{R}^m \to \mathbb{R}$ has a maximum? My task is this:
Suppose $f:\mathbb{R}^m \to \mathbb{R}$ is a positive, continous function such that $\lim_{\mid \textbf{x}\mid \to \infty} f(\textbf{x}) = \textbf{0}$.
Show that $f$ has a maximum.
I am not sure exactly how to show this since the domain of $f$ is all of $\mathbb{R}^m$. According to the extreme value theorem, we need $A\subset \mathbb{R}^m$ to be closed, bounded and that $f:A\to\mathbb{R}$ to be continous (which it is over the entire $\mathbb{R}^m$). I am thinking that if we could somehow split up the domain into closed sets and take the union, one could probably show that $f$ had a maximum, but I am not sure if that's the right approach. Any help would be more than welcome!
 A: $f(0)>0$ by hypothesis, and since $f(x)\to 0$ as $|x|\to\infty$, there exists $R$ such that $f(x)\leq f(0)$ for all $x$ with $|x|\geq R$.
$f(x)$ has a maximum $M$ on the set $B=\{x:|x|\leq R\}$ since $f$ is continuous and $B$ is closed and bounded, and $M\geq f(0)$ since $0\in B$. Therefore the choice of $R$ guarantees that $M$ is a global maximum.
A: Two ways:
First:
Compactifying $\mathbb{R}^m$ with one point and defining $f(\infty)=0$ makes this function continuous on a compact set, hence achieves a maximum somewhere. Since it is positive on $\mathbb{R}^m$ and $0$ on $\infty$, it must be on $\mathbb{R}^m$ and not on $\infty$. Therefore, the restriction back to $\mathbb{R}^m$ has a maximum.
Second:
Take $\epsilon:=f(0)/2$. Let $K$ be a compact set so big that out of it, $f(x)<\epsilon$ (this is possible by hypothesis). Since $f$ is smaller than $\epsilon$ outside of $K$, and $\epsilon$ is smaller than $f(0)$, what matters is all inside $K$. But $K$ is compact.
A: Here is the idea, which I leave to you to make rigorous. If $f$ is identically $0$, then the conclusion is clear, so suppose there is some $\alpha \in \mathbb{R}^{n}$ such that $L := f(\alpha) > 0$. Since $f(x) \to 0$ as $|x| \to \infty$, there exists an $r > 0$ such that $|x| > r$ implies $f(x) < L/2$; clearly, $r > \alpha$ since $f(\alpha) = L > L/2$. Thus, the maximum of $f$ (if it exists) must occur in the closed ball of radius $r$. This is a compact subset of $\mathbb{R}^{n}$, and so $f$ attains its maximum on this subset. 
Edit: I suppose by positive you probably meant $f(x) > 0$ for all $x \in \mathbb{R}^{n}$, in which case one can avoid this business at the beginning and just choose $\alpha = 0$. Since the above shows that the claim still holds even if positive is replaced with the (slightly) weaker hypothesis of non-negative, I'll leave it as is.
