# Identity for the single-variable Gaussian expectation

I was reading The deep learning theory book and encountered this transformation: \begin{align} \frac{d}{dK}\left[\frac{1}{{\sqrt{2\pi K}}}\int_{-\infty}^{\infty}dz\space e^{\frac{-z^{2}}{2K}}{F(z)}\right] &= \frac{1}{2K^{2}}\left[\frac{1}{{\sqrt{2\pi K}}}\int_{-\infty}^{\infty}dz\space e^{\frac{-z^{2}}{2K}}F(z){(z^{2}-K)}\right] \\ &= \frac{1}{2K}\left[\frac{1}{{\sqrt{2\pi K}}}\int_{-\infty}^{\infty}dz\space e^{\frac{-z^{2}}{2K}}{z\space \frac{d}{dz}F(z)}\right] \end{align} They said to go from the second equality to the third equality, they integrated by parts but I couldn't figure out how to do it. Can anyone provide me a detail explanation of this transform. I'm really appreciated!

• I tried to improve the formatting, please check. In particular, $k$ and $K$ are different variables ? Commented Aug 14, 2021 at 20:05
• sorry. It's the same actually, it's the variance of the distribution. Commented Aug 14, 2021 at 20:08
• ok. What's your doubt? How to go from eq.2 to eq3, or what? Commented Aug 14, 2021 at 20:11
• yes! I'm confused about that part. Commented Aug 14, 2021 at 20:13

They said to go from the second equality to the third equality, they integrated by parts but I couldn't figure out how to do it.

$$\int_{-\infty}^{\infty} \underbrace{e^{-z^2/(2K)}(z^2-K)}_{g'}\times \underbrace{F(z)}_{h} dz$$

Where $$g=-K z e^{-z^2/(2K)}$$

soving it by parts you get

$$\int h\times g'=h\times g-\int h'\cdot g=0+k\int_{-\infty}^{\infty}ze^{-z^2/(2K)}\cdot f_Z(z)dz$$

as requested.

$$K$$ simplifies with $$\frac{1}{2K^2}$$ out of the integral in your original formula and I wrote $$\frac{d}{dz}F(z)=f_Z(z)$$ as F is the CDF and $$f$$ is the pdf

• thank you very much! Commented Aug 15, 2021 at 12:42