Value of integral approximated by other integral Assume $f$ is an integrable function on $\mathbb{R}^N$. Then by definition, it is easily seen that
$$\int_{\mathbb{R}^N} |f| dx  = \sup \left\{ \int_{\mathbb{R}^N} g dx: 0 \le g \le |f| 
\right\}.$$
However, I'm looking for another formula. In particular, is it true that
$$\int_{\mathbb{R}^N} |f| dx  = \sup \left\{ \int_{\mathbb{R}^N} fg dx: g \in C^{\infty}_c(\mathbb{R}^N): -1 \le g \le 1
\right\}?$$
Thanks for your help.
 A: Hint: I think you can prove it by truncation and regularization of the sign function $\text{sgn}(f)$. You could define
$$g_n(x) = \rho_{n} * \left(\text{sgn}(f)\chi_{|x|\le n}\right)$$
with $\rho_n = n^N\rho(nx)$ and $0\le \rho\in {\cal C}_0^\infty({\mathbb R}^N)$ satisfies $\int \rho dx = 1$.
Then it seems reasonable to think that $f g_n\longrightarrow |f|$ almost everywhere (see the Lebesgue density theorem for example) and the result would follow by dominated convergence.
A: Consider $(g_n)$ a sequence of $C_c^{\infty}$ functions such that $ g_n(x) \to \chi_A(x)$, $0\leq g_n \leq \chi_A$ (with $\chi_A$ the indicator function of $A$).
Such sequence exists, indeed, we know how to construct compactly supported function that are $0$ outside of a compact set (thanks to convolution product) and equal to $1$ on a compact set inside the first one (see Urhyson lemma for smooth functions). We then take two increasing sequences of compact $(C_n)$ and $(\tilde C_n)$ such that $\tilde C_n ,C_n \to A$ and $\tilde C_n \subsetneq C_n \subset A$. And define $(g_n)$ a sequence of tests functions such that $g_n$ is $0$ outside of $C_n$ and $1$ inside $\tilde C_n$.
For example, take $C_n=\overline{B(0,n)} \cap\overline{A}$ and $\tilde C_n=C_n-(\partial C_n +B(0,\frac 1 n)).$
$g_n$ satisfies all the conditions.
Define $\chi_{\lbrace x,f(x) \geq 0 \rbrace}$ and $\chi_{\lbrace x,f(x) < 0 \rbrace}$. Consider $(h_n^+)$ and $(h_n^-)$ sequences of smooth cutoff functions converging to those two indicators functions as above.
$$\int_{\mathbb{R}^N} |f| dx  = \int_{\lbrace x,f(x) \geq 0 \rbrace} f+ \int_ {\lbrace x,f(x) < 0 \rbrace} -f=\int_{\mathbb{R^N}} f\chi_{\lbrace x,f(x) \geq 0 \rbrace}-\int_{\mathbb{R^N}} f\chi_{\lbrace x,f(x) < 0 \rbrace}.$$
But now :
$$\int_{\mathbb{R}^N} |f| dx = \lim_{n\to \infty} \int_{\mathbb{R}^N} fh^+_n(x)+\int_{\mathbb{R}^N} f(-h^-_n(x))=\lim_{n\to \infty} \int_{\mathbb{R}^N}f(h_n^+-h_n^-).$$
Since $h^+_n \leq \chi_{\{x,f(x)\geq0\}}$ and $h_n^- \leq \chi_{\{x,f(x)<0\}}$ and $h^+_n \to \chi_{\{x,f(x)\geq0\}}$, $h^-_n \to \chi_{\{x,f(x)<0\}}$ the sup is realized only at infinity. Hence the result.
