An "Easy" Truncation Procedure Let $X$ be a real random variable on a probability space $(\Omega,F,P)$ of mean $0$ and variance $1$. I am asked to prove that that for every $\epsilon>0$ there is a function $\phi: \mathbb{R} \to \mathbb{R}$ that satisfies all of the following:

*

*$\phi$ is bounded and continuous in $\mathbb{R}$.

*If $Y=\phi \circ X$, then $Y$ still has mean $0$ and variance $1$.

*The random variable $Z=X-Y$ has variance at most $\epsilon^2$.

Here is my attempt:
Although I am asked to prove the result, it seems to me that this is not doable. Let $\mu$ be the law of $X$. If such a $\phi$ exists, then we have:
\begin{equation*}
0=\mathbb{E}[X]=\int_{\mathbb{R}}xd\mu(x) = \int_{\mathbb{R}}\phi(x)d\mu(x)=\mathbb{E}[\phi \circ X]
\end{equation*}
Then $\phi(x)=x$ almost everywhere with respect to $\mu$. But $x$ is obviously not bounded so I am stuck here. Hints would be really appreciated and a specific example of $\phi$ is even better. I think whoever designs the question has a specific example of $\phi$ in mind but I was not able to find it.
Edit: as it is pointed out in comments, I somehow thought that $\int_{\mathbb{R}}|x-\phi(x)|d\mu(x)=0$ and concluded $\phi=x$ in my attempt, which is simply not right. So the problem is more likely to be solvable. However, I am still stuck on approaching the problem.
 A: The following two lemmas do the trick. I wrote a lot of details, because I haven't used rigorously the dominated convergence theorem in a long time!
Lemma: Let $X$ be a random variable with finite second moment. For every $\epsilon>0$, one can find a continuous, bounded $\phi$ such that
$\mathbb{E}[\left(X-\phi \circ X\right)^2] < \epsilon$.
Proof:
Let $n \in \mathbb{N}$ and let $\phi_n : x \mapsto \max \{-n,\min\{x,n\}\}$.
Now, define $Y_n := \phi_n\circ X$.
We have $X-Y_n = \textbf{1}_{n < X} \left(X-n\right) + \textbf{1}_{-n > X} \left(X+n\right)$.
Therefore, we have the pointwise convergence $\lim_{n \to \infty} X - Y_n = 0$.
Moreover, we have $(X-Y_n)^2 \leq (X-n)^2+(X+n)^2 \in L^1(\Omega)$, so, by the dominated convergence theorem, $\lim_{n \to \infty} \mathbb{E}[(X-Y_n)^2] = 0$.
Lemma:
Let $X$ be a random variable such that $\mathbb{E}[X^2]= 1$ and $\mathbb{E}[X] = 0$. Let $(Y_n)_{n \in \mathbb{N}}$ be a sequence of random variables such that $\Vert \cdot \Vert_1-\lim_{n \to \infty} (X-Y_n)^2 = 0$.
Then $\Vert \cdot \Vert_1-\lim_{n \to \infty} \left(X - \frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2 = 0$.
Proof:
Let $m_n := \mathbb{E}[Y_n]$ and $\lambda_n := \sqrt{\mathbb{E}[\left(Y_n-m_n\right)^2]}$.
From Cauchy-Schwarz' inequality, $\mathbb{E}[\vert X - Y_n\vert] \leq \sqrt{\mathbb{E}[(X-Y_n)^2]} \to 0$, so $\vert m_n \vert = \vert \mathbb{E}[X - Y_n] \vert \leq \mathbb{E}[\vert X - Y_n \vert] \to 0$.
Moreover, since $Y_n$ converges to $X$ in $L^2$, $Y_n - m_n$ converges to $X$ in $L^2$ as well, so $\lambda_n$ converges to $1$, and therefore, we have the pointwise limit $\lim_{n \to \infty} \left(X - \frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2 = 0$.
Let $n_0$ such that for all $n \geq n_0$, $\frac{1}{2} \leq \lambda_n \leq 2$ and $m_n \leq 1$.
We have
$\begin{array}{rcl}
\left(X-\frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2 &= &\left(\frac{\lambda_n X-Y_n}{\lambda_n} + \frac{ m_n}{\lambda_n}\right)^2\\
&\leq &2\left(\frac{\lambda_n X-Y_n}{\lambda_n}\right)^2 + 2\left(\frac{ m_n}{\lambda_n}\right)^2\\
&\leq &8(\lambda_n X - Y_n)^2 + 8m^2_n\\
&\leq &64X^2 + 16Y^2_n + 8\\
\end{array}$
and since $\left(\mathbb{E}[Y^2_n]\right)_n$ is bounded, then the sequence $\left(\left(X - \frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2\right)_n$ is bounded in $L^1$, so we can apply the dominated convergence theorem and we are done.
