Approximation of $L^1$ function with compactly supported smooth function with same mass and same uniform bounds Recently, I have asked this question. Now, I even want to make this better. 
Given $f\in L^1(\mathbb{R})$ with $0\leq f\leq 1$, I can find for any $\epsilon>0$ a $g\in C_c^\infty(\mathbb{R})$ such that $\|f-g\|_{L^1}\leq \epsilon$. 
Can I assume wlog that $\|f\|_{L^1} = \|g\|_{L^1}$ and $0\leq g \leq 1$?
 A: Yes, you can find such a $g$. First, for any $\epsilon_1 > 0$ we can find a $g_0 \in C_c(\mathbb{R})$ such that $\lVert f-g_0\rVert_{L^1} < \epsilon_1$. Then define $g_1(x) = \max \{ 0, \min \{ 1, g_0(x)\}\}$, this gives $g_1 \in C_c(\mathbb{R})$ with $0 \leqslant g_1 \leqslant 1$, and for every $x\in \mathbb{R}$ we have $\lvert f(x) - g_1(x)\rvert \leqslant \lvert f(x) - g_0(x)\rvert$, so
$$\lVert f-g_1\rVert_{L^1} \leqslant \lVert f-g_0\rVert_{L^1} < \epsilon_1.$$
Next, we mollify $g_1$ to obtain $g_2\in C_c^{\infty}(\mathbb{R})$ with $0 \leqslant g_2 \leqslant 1$ and $\lVert f-g_2\rVert_{L^1} < 2\epsilon_1$. For that, take $\varphi \in C_c^{\infty}(\mathbb{R})$ with $0 \leqslant \varphi$ and $\int_{\mathbb{R}} \varphi(x)\,dx = 1$, and define
$$h_{\eta}(x) = (g_1 \ast \varphi_{\eta})(x) = \int_{\mathbb{R}} g_1(x-\eta\cdot y)\varphi(y)\,dy$$
for $\eta > 0$. Then $h_{\eta} \in C_c^{\infty}(\mathbb{R})$, $0 \leqslant h_{\eta} \leqslant 1$, and $h_{\eta} \to g_1$ as $\eta \to 0$ in $L^1$ (and uniformly), so we can choose $\eta$ small enough that $\lVert g_1 - h_{\eta}\rVert_{L^1} < \epsilon_1$ and set $g_2 = h_{\eta}$.
If we already have $\lVert g_2\rVert_{L^1} = \lVert f\rVert_{L^1}$ we are done now. If $\lVert g_2\rVert_{L^1} > \lVert f\rVert_{L^1}$, we multiply with the scaling factor $\frac{\lVert f\rVert_{L^1}}{\lVert g_2\rVert_{L^1}}$ to obtain $g_3 \in C_c^{\infty}(\mathbb{R})$ with $0 \leqslant g_3 \leqslant \frac{\lVert f\rVert_{L^1}}{\lVert g_2\rVert_{L^1}} < 1$ and $\lVert f - g_3\rVert_{L^1} < 4\epsilon_1$. If finally $\lVert g_2\rVert_{L^1} < \lVert f\rVert_{L^1}$, choose $h \in C_c^{\infty}(\mathbb{R}^n)$ with $0 \leqslant h \leqslant 1$ and $\int h(x)\,dx = \lVert f\rVert_{L^1} - \lVert g_2\rVert_{L^1}$ and set $g_3(x) = g_2(x) + h(x-s)$, where $s\in \mathbb{R}$ is so large that the supports of $g_2$ and $h(\,\cdot\, - s)$ don't intersect. The latter guarantees that we still have $0 \leqslant g_3 \leqslant 1$, and the positivity of $g_2$ and $h$ ensures $\lVert g_3\rVert_{L^1} = \lVert g_2\rVert_{L^1} + \lVert h\rVert_{L^1} = \lVert f\rVert_{L^1}$. Since $\lVert g_2\rVert_{L^1} \geqslant \lVert f\rVert_{L^1} - 2\epsilon_1$, it follows that here too we have $\lVert f - g_3\rVert < 4\epsilon_1$, so for a given $\epsilon > 0$, we choose $\epsilon_1 = \frac{1}{4}\epsilon$ for our construction.
