Find the expression for the truncated squared Normal distribution The following is a question present in the book High-Dimensional Probability, by Roman Vershynin. The exercise is the following:
Let $g\sim N(0,1)$. Show that, for all $t\geq 1$
$$
E[g^2 \mathbb I_{\{g > t\}}] = t\frac{e^{-t^2/2}}{\sqrt{2\pi}}+P(g>t)
 \leq (1+1/t)\frac{e^{-t^2/2}}{\sqrt{2\pi}}$$
The inequality seems to be easily provable, since one can just use the Markov inequality. But, I've not been able to prove the expression for the expected value. The author gives a hint to use integration by parts, yet, I was still not able to solve it. Any help is welcomed.
 A: Using the information provided in the comment I was able to solve the question. So here is the complete answer (also proving the inequality).
We use integration by parts making $u=x$ and $dv/dx = x \frac{e^{-x^2/2}}{\sqrt{2\pi}}$.
One can prove that $v = \int _t^\infty x\frac{e^{-x^2/2}}{\sqrt{2\pi}}dx = -\frac{e^{-t^2/2}}{\sqrt{2\pi}}$.
Therefore:
$$
uv \bigg\rvert^\infty_t = t\frac{e^{-t^2/2}}{\sqrt{2\pi}} \ ,\ \text{and } \
\int_t^\infty v du = \int_t^\infty \frac{e^{-t^2/2}}{\sqrt{2\pi}} dx = P(g>t)
$$
We then showed that
$$
E[g^2 \mathbb I_{\{g>t\}}] = \int_t^\infty x^2\frac{e^{-x^2/2}}{\sqrt{2\pi}}dx=
t\frac{e^{-t^2/2}}{\sqrt{2\pi}} +P(g>t)
$$
Now, to prove the inequality, we can use the Markov inequality, hence:
$$
P(g>t) = P(g\mathbb I_{\{g>t\}}) \leq \frac{E[g\mathbb I_{\{g>t\}}]}{t} =
\frac{e^{-t^2/2}}{t\sqrt{2\pi}}
$$
A: The first term is already treated by @DavidBarreira. I comment on the second part for completeness.
Let $g\sim N(0,1)$. For $t \geq 1$ the tail is bounded by the density:
$$
\mathbb{P}\{g \geq t\} \leq \frac{1}{\sqrt{2 \pi}} e^{-t^{2} / 2}
$$
Proof: To obtain an upper bound on the tail
$$
\mathbb{P}\{g \geq t\}=\frac{1}{\sqrt{2 \pi}} \int_{t}^{\infty} e^{-x^{2} / 2} d x,
$$
let us change variables $x=t+y$. This gives
$$
\mathbb{P}\{g \geq t\}=\frac{1}{\sqrt{2 \pi}} \int_{0}^{\infty} e^{-t^{2} / 2} e^{-t y} e^{-y^{2} / 2} d y \leq \frac{1}{\sqrt{2 \pi}} e^{-t^{2} / 2} \int_{0}^{\infty} e^{-t y} d y,
$$
where we used that $e^{-y^{2} / 2} \leq 1$. Since the last integral equals $1 / t$, the desired upper bound on the tail follows.
