Infinity norm of continuous function. 
Let $f$ be a continuous function on the measure space $\mathbb{R}^n,\mathcal{L},\lambda$(Lebesgue measure). Prove that
$\|f\|_\infty = \sup\{|f(x)|$ $|$ $x \in \mathbb{R}^n\}$

I saw same problem but I couldn't understand the answer.
My idea is this:
Let $\|f\|_\infty=K$. Since $f$ is continuous, a small neighborhood of any $x\in  \mathbb{R}^n$, say $p$ should satisfy $|f(p)|\leq M,$ for $M>K$. So I can take $supremum$ over p.
But I don't know how to proceed rigorously.
Any help will be thankful.
 A: Let $S\equiv\sup_{x\in\mathbb R^n}|f(x)|$. By definition, the essential supremum norm is defined as follows:
$$\|f\|_{\infty}=\inf_{c\geq 0}\big\{\lambda(\{x\in\mathbb R^n\,|\,|f(x)|>c\})=0\big\}.$$ In words, $\|f\|_{\infty}$ is the infimum of such non-negative numbers above which the function $|f|$ takes values only on a measure-zero set. Intuitively, $\|f\|_{\infty}$ is the least “almost upper bound” on the values of $|f|$ (hence the term “essential supremum”), in the sense that if you take it as an upper bound, you'll only miss a set of measure zero and this is the least number with this property.
First, I will show that $\|f\|_{\infty}\leq S$. To see this, note that for all $x\in\mathbb R^n$, one has $|f(x)|\leq S$. Hence, the set $\{x\in\mathbb R^n\,|\,|f(x)|>S\}$ is empty and thus has measure zero. By the definition of infimum, this readily yields that $\|f\|_{\infty}\leq S$.
Now to show that $\|f\|_{\infty}\geq S$ (which will complete the proof), assume, for the sake of contradiction, that $\|f\|_{\infty}< S$. By the definitions of infimum and $\|f\|_{\infty}$, there is some $\varepsilon>0$ such that $$\|f\|_{\infty}+\varepsilon<S$$ and  the set $$V\equiv\{x\in\mathbb R^n\,|\,|f(x)|>\|f\|_{\infty}+\varepsilon\}$$ has zero measure: $\lambda(V)=0$. On the other hand, by the definitions of supremum and $S$, there is some $x^*\in\mathbb R^n$ such that $\|f\|_{\infty}+\varepsilon<|f(x^*)|\leq S$. Since the function $|f|$ is continuous (it is the composition of $f$ and the absolute-value function, both being continuous), the set $$V=\{x\in\mathbb R^n\,|\,|f(x)|>\|f\|_{\infty}+\varepsilon\}$$ is open—since it is the pre-image of the open interval $(\|f\|_{\infty}+\varepsilon,\infty)$—and, as one has seen, it contains $x^*$. Since non-empty open subsets of $\mathbb R^n$ have positive Lebesgue measure, it follows that $\lambda(V)>0$. This is a contradiction and the proof is complete.
A: Since the Lebesgue measure is $\sigma$-finite we have that $$\|
{f}\|_{\infty}=\inf\left\{M\geq 0:\,\lambda(\left\{x: |f(x)| > M\right\})=0 \right\}$$
Clearly $\lambda(\left\{x: |f(x)| > \sup_{x \in \mathbb{R}^{d}}|f(x)|\right\})=0$
Now suppose there is a constant $M < \sup_{x \in \mathbb{R}^{d}}|f(x)|$, that satisfies the above critera. It should be fairly easy to reach a contradiction due to continuity of f
