Let $w(x) = x \log{x}$

$x \sim Gamma(\alpha = 3.7, \lambda = 1)$

Find $E[w(x)]$

I have set up the following integral:

$\int_0^{\infty} x\log{x} \frac{\lambda^{\alpha}}{\Gamma(\alpha)} x^{\alpha -1} e^{-(\lambda)x}dx$

Brute-forcing it doesn't seem to be working, but I can't find the "trick".

I know from simulation that it should be approximately 5.32, I just need to compare it to the analytical solution.

  • $\begingroup$ you are missing $x^{\alpha-1}$ in the Gamma density $\endgroup$ – Lii Mar 29 at 15:29
  • $\begingroup$ Thank you, unfortunately I have not made that typo on my page - it's still a baffling integral. $\endgroup$ – jbpib27 Mar 29 at 15:37
  • $\begingroup$ The solutions at stats.stackexchange.com/questions/370880 apply with little change. $\endgroup$ – whuber Mar 29 at 18:56
  • $\begingroup$ I’ve used it in my post @whuber $\endgroup$ – gunes Mar 29 at 19:02
  • 1
    $\begingroup$ @gunes Yes, I noticed that after posting my comment (and upvoted your answer, btw). $\endgroup$ – whuber Mar 29 at 19:08

$$\begin{align}E[X\log X]&=\int_0^\infty \log x \frac{\lambda^\alpha}{\Gamma(\alpha)}x^\alpha e^{-\lambda x}dx\\&=\frac{\Gamma(\alpha+1)}{\Gamma(\alpha)\lambda}\int_0^\infty\log x\frac{\lambda^{\alpha+1}}{\Gamma(\alpha+1)}x^{(\alpha+1)-1}e^{-\lambda x}dx\\&=\frac{\Gamma(\alpha+1)}{\Gamma(\alpha)\lambda}E[\log Y]\end{align}$$ where $Y\sim \text{Gamma}(\alpha_y=\alpha+1, \lambda_y=\lambda)$. From here, the expected value of the logarithm of a gamma RV is: $$E[\log Y]=-\log\lambda+\psi(\alpha+1)$$ where $\psi$ stands for polygamma function.

So, the overall result is (put $\alpha=3.7, \lambda=1$): $$E[X\log X]=\underbrace{\frac{\Gamma(4.7)}{1\times\Gamma(3.7)}}_{3.7}(-\log 1 +\psi(4.7))\approx5.32$$

I've used Matlab's psi function to calculate the polygamma function.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.