Essential Supremum with the continuous function?

Solution 1:

Yes, you're right, the equality

$$\operatorname{ess sup}\limits_E f = \sup_E f\tag{1}$$

does not hold for continuous functions on all (Lebesgue) measurable subsets $E \subset \mathbb{R}^n$. If $E$ is a nonempty null set, we have $\operatorname{ess sup}\limits_E f = -\infty < \sup\limits_E f$, and we can construct counterexamples to $(1)$ whenever $E$ contains a point $e$ such that $\mu(E\cap V) = 0$ for some neighbourhood $V$ of $e$. But if $E$ is such that $\mu(E\cap U) > 0$ for every open set $U$ intersecting $E$, then $(1)$ holds.

Solution 2:

It is done under the assumption that $E$ is open. (More generally, under the assumption that, for every $x_0\in E$, and every $\delta>0$, we have that $m\big(E\cap(x_0-\delta,x_0+\delta)\big)>0$.)

It suffices to show that if $f:E\to\mathbb R$ continuous and upper bounded, then $\mathrm{ess\,sup}\, f\ge \mathrm{sup}\,f$. Or equivalently, if $a<\mathrm{sup}\, f$, then $a<\mathrm{ess\,sup}\, f$.

In not, there would an $a$ such that $a<\mathrm{sup}\, f$ and $a\ge\mathrm{ess\,sup}\, f$. Then there exists $x_0\in E$, such that $a<f(x_0)\le\sup f$. Let $\varepsilon=(a-f(x_0))/2>0$. Since $f$ is continuous, there is a $\delta>0$, such that $f(x)>a+\varepsilon$, for every $x\in E\cap(x_0-\delta,x_0+\delta)$. But this would imply that $\mathrm{ess\,sup}\, f\ge a+\varepsilon$. Which is a contradiction.