I need to solve the following exercise:
Let $Z$ be a random variable with the standard normal $N(0,1)$- distribution. Prove that
\begin{align*} P(\left|Z\right|\leq z) &= \sqrt{\frac{2}{\pi}}\frac{e^{-z^2/2}}{z} - \sqrt{\dfrac{2}{\pi}}\int_z^\infty x^{-2}e^{-x^2/2} \, dx \\ &= \sqrt{\frac{2}{\pi}}\frac{e^{-z^2/2}}{z} \left(1 + \mathcal{O} \left(\frac{1}{z^2}\right)\right). \end{align*}
I know (at least I think I do) that
$$ P(\left|Z\right|\geq z) = \int_z^\infty\frac{1}{\sqrt{2\pi}}\exp\left(-\frac{x^2}{2}\right) \, dx $$
Knowing what I need to show, I think I need to apply integration by parts. Unfortunately, I have no idea how. If I let $\dfrac{1}{\sqrt{2\pi}}$ be $f$ and $\exp\left(-\frac{z^2}{2}\right)$ be $g'$ then I have no idea how I could use
$$\int fg' \, dx = fg - \int f'g \, dx$$
to arrive at the first equality...
Question: How should I solve this exercise?
Notice that
\begin{align*} P(|Z|\geq z) &= \sqrt{\frac{2}{\pi}} \int_{z}^{\infty} e^{-x^2/2} \, dx \\ &= \sqrt{\frac{2}{\pi}} \left( \left[ -e^{-x^2/2} \cdot \frac{1}{x} \right]_{z}^{\infty} - \int_{z}^{\infty} \frac{e^{-x^2/2}}{x^2} \, dx \right) \\ &= \sqrt{\frac{2}{\pi}} \left( \frac{e^{-z^2/2}}{z} - \int_{z}^{\infty} \frac{e^{-x^2/2}}{x^2} \, dx \right). \end{align*}
As a by-product, if $z > 0$ then we have
$$ \int_{z}^{\infty} e^{-x^2/2} \, dx \leq \frac{e^{-z^2/2}}{z}. $$
Then, again assuming $z > 0$, we find that
$$ \int_{z}^{\infty} \frac{e^{-x^2/2}}{x^2} \, dx \leq \frac{1}{z^2} \int_{z}^{\infty} e^{-x^2/2} \, dx \leq \frac{e^{-z^2/2}}{z^3}. $$
This is enough to conclude the desired asymptotic formula.