I'm trying to determine an expected value of a random variable related to the Gumbel/Extreme Value Type 1 distribution. I think the answer follows the same process as expected value of the Gumbel itself, but I can't figure out the derivation of the expected value of the Gumbel.
I found here a derivation, but there's a step in the middle where magic happens. Need to understand what's going on there to see if I can apply it to my other problem.
Recall, the density of the Gumbel distribution is $f(x) = e^{-e^{-x}}e^x$. The derivation at the link shows that
$$ \int_{-\infty}^{\infty}x e^{-x} e^{-e^{-x}}dx = - \int_{0}^{\infty}{\ln y}e^{-y}dy\quad [y=e^{-x}]\\ = -\frac{d}{d\alpha}\int_0^\infty y^\alpha e^{-y}dy\bigg|_{\alpha=0}\\ =-\frac{d}{d\alpha}\Gamma(\alpha+1)\bigg|_{\alpha=0}\\ =\Gamma'(1) = \gamma \approx 0.577... $$
The jump from the first line to the second is the one I can't follow. I've tried doing integration by parts on one or the other to demonstrate the equivalence, but I end up with a floating 1 or infinity.
Thanks in advance!
The step in question employs a trick called "differentiating under the integral." The idea is to introduce a parameter in the integrand, and express the integrand as a derivative with respect to this parameter, then change the order of integration and differentiation (assuming certain regularity conditions hold).
Explicitly, suppose we let $f(y,\alpha) = y^\alpha e^{-y}.$ Then $$\frac{\partial f}{\partial \alpha} = y^\alpha \log y \, e^{-y}.$$ Then letting $\alpha = 0$ gives us the integrand in the first line of the solution; hence $$-\int_{y=0}^\infty \log y \, e^{-y} \, dy = -\int_{y=0}^\infty \frac{\partial}{\partial \alpha}\left[y^\alpha e^{-y}\right]_{\alpha = 0} \, dy = -\frac{\partial}{\partial \alpha} \left[\int_{y=0}^\infty y^\alpha e^{-y} \, dy \right]_{\alpha = 0}.$$