Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new here and hope you can help.

It's really late here in South Africa, maybe my mind just doesn't want to function now! But I need to figure out how to get a closed form expression hopefully for $E(\ln X)$ and even $E(\ln (X^2))$ if $X$ is $\Gamma(a,b)$ distributed. Any help would be greatly appreciated!!


share|cite|improve this question
Is it $E(\ln (X^2))$ or $E(\ln^2 (X))$ ? – Pedro Tamaroff Apr 28 '12 at 23:01
$\ln (X^2)$ is the same as $2\ln(X)$, so its expected value is just $2$ times that of $\ln X$. If you meant $(\ln X)^2$, that should be written differently. – Michael Hardy Apr 29 '12 at 0:00
Wikipedia says, and Maple confirms, that $E(\ln X) = -\ln b + \psi(a)$, where $\psi(t) = \frac{d}{dt} \ln \Gamma(t)$ is the digamma function. – Nate Eldredge Apr 29 '12 at 0:10

The probability density function for the gamma distribution is $$f(x;a,b) = \frac{1}{b^a\Gamma(a)} x^{a-1}e^{-x/b},$$ so the integral we must consider is $$\mathbb{E}(\ln (X^n)) = \frac{1}{b^a \Gamma(a)} \int_0^\infty dx\, x^{a-1} e^{-x/b} \ln x^n.$$ Let $z=x/b$. We find $$\begin{eqnarray*} \mathbb{E}(\ln (X^n)) &=& \frac{n}{\Gamma(a)} \int_0^\infty dz\, z^{a-1} e^{-z}\ln (b z) \\ &=& n\ln b + \frac{n}{\Gamma(a)} \int_0^\infty dz\, z^{a-1} e^{-z}\ln z \\ &=& n\ln b + \frac{n}{\Gamma(a)} \frac{d}{d a} \int_0^\infty dz\, z^{a-1} e^{-z} \\ &=& n\left(\ln b + \frac{\Gamma'(a)}{\Gamma(a)}\right) \\ &=& n\left(\ln b + \psi(a)\right), \end{eqnarray*}$$ where we have used the definition of the gamma function, $\Gamma(a) = \int_0^\infty d x \, x^{a-1} e^{-x}$, and the digamma function, $\psi(z) = \Gamma'(z)/\Gamma(z)$.

Addendum 1: It is possible to show (using the fact that $\ln x\leq z^s/s$ for all $s>0$) that $\int_0^\infty dz\, z^{a-1} e^{-z}\ln z$ converges uniformly for $1< a < \infty$. This justifies the trick of differentiating $\Gamma(a)$.

Addendum 2: There is a possibility that the OP is interested in $\mathbb{E}((\ln X)^n)$. @Sasha dealt with this below. It can also be handled with the derivative trick, $$\begin{eqnarray*} \mathbb{E}((\ln X)^n) &=& \frac{1}{\Gamma(a)} \int_0^\infty dz\, z^{a-1} e^{-z}(\ln (b z))^n \\ &=& \frac{1}{\Gamma(a)} \int_0^\infty dz\, z^{a-1} e^{-z}(\ln b + \ln z)^n \\ &=& \frac{1}{\Gamma(a)} \int_0^\infty dz\, z^{a-1} e^{-z} \sum_{k=0}^n {n \choose k} (\ln b)^{n-k} (\ln z)^k \\ &=& \frac{1}{\Gamma(a)} \sum_{k=0}^n {n \choose k} (\ln b)^{n-k} \int_0^\infty dz\, z^{a-1} e^{-z} (\ln z)^k \\ &=& \frac{1}{\Gamma(a)} \sum_{k=0}^n {n \choose k} (\ln b)^{n-k} \frac{d^k}{d a^k} \int_0^\infty dz\, z^{a-1} e^{-z} \\ &=& \frac{1}{\Gamma(a)} \sum_{k=0}^n {n \choose k} (\ln b)^{n-k} \Gamma^{(k)}(a). \end{eqnarray*}$$ This is equivalent to the solution given by @Sasha. For $n=2$ we arrive at $$\mathbb{E}((\ln X)^2) = (\ln b + \psi(x))^2 + \psi^{(1)}(a),$$ where $\psi^{(m)}(z) = d^{m+1}(\ln \Gamma(z))/d z^{m+1}$ is the polygamma function.

share|cite|improve this answer

The exponential generating function for expectations of the powers of $\log(X)$ is $$\begin{eqnarray} \sum_{r=0}^\infty \frac{t^r}{r!} \mathbb{E}(\log^r(X)) &=& \mathbb{E}(\sum_{r=0}^\infty \frac{t^r}{r!} \log^r(X)) = \mathbb{E}\left(X^t\right) = \int_0^\infty x^t \frac{b^{-a}}{\Gamma(a)} x^{a-1} \mathrm{e}^{-\frac{x}{b}} \mathrm{d} x = b^{t} \frac{\Gamma(t+a)}{\Gamma(a)} \end{eqnarray} $$ Hence: $$ \mathbb{E}\left(\log(X)\right) = \left. \frac{\mathrm{d}}{\mathrm{d} t} b^{t} \frac{\Gamma(t+a)}{\Gamma(a)} \right|_{t=0} = \log(b) + \psi(a) $$ $$ \mathbb{E}\left(\log^2(X)\right) = \left. \frac{\mathrm{d}^2}{\mathrm{d} t^2} b^{t} \frac{\Gamma(t+a)}{\Gamma(a)} \right|_{t=0} = \log^2(b) + 2 \log(b) \psi(a) + \psi(a)^2 + \psi^{(1)}(a) $$ where $\psi(a)$ denotes the digamma function, and $\psi^{(1)}(a)$ denotes the trigamma function.

share|cite|improve this answer
Thanks for the edit. Looking at the generating function for $\mathbb{E}(\log^r X)$ is very clever. (+1) – user26872 Apr 29 '12 at 6:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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