Compute some expectations involving beta and gamma distributions a) Let $X \sim {\text {Beta}}(a,b)$, with density $f(x) = \frac{x^{a-1}(1-x)^{b-1}} {B (a,b)}$. Find the expectation of $X \ln X$ and $\frac{1}{X+1}.$ 
b) Let $Y \sim {\text {Gamma}}(\alpha,\beta)$, with density $g(y) = {\frac {\beta ^{\alpha }}{\Gamma (\alpha )}}y^{\alpha \,-\,1}e^{-\beta y}$. Find the expectation of $Y \ln Y$ and $\frac{1}{Y+1}.$ 
c) Assume $X,Y$ are independent. Find $\Bbb E [\frac{1}{XY+1}]$ and $\Bbb E [\frac{1}{Y-XY+1}]$.
I reduced my previous question to the above much simpler questions. Any help with this question will help the previous question as well. Any help with any of above expectation calculations will be very much appreciated.
 A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$\ds{\Large\left.a\right)}$
\begin{align}
&\bbox[13px,#ffd]{\int_{0}^{1}{x^{a - 1}\pars{1 - x}^{b - 1} \over \mrm{B}\pars{a,b}}\,x\ln\pars{x}\,\dd x} =
\left.{1 \over \mrm{B}\pars{a,b}}\,\partiald{}{\nu}
\int_{0}^{1}x^{a + \nu}\pars{1 - x}^{b - 1}\,\dd x\,\right\vert_{\ \nu\ =\ 0}
\\[5mm] = &\
\left.{1 \over \mrm{B}\pars{a,b}}\,\partiald{\mrm{B}\pars{a + \nu + 1,b}}{\nu}
\,\right\vert_{\ \nu\ =\ 0} =
\left.{1 \over \mrm{B}\pars{a,b}}\,\partiald{}{\nu}
{\Gamma\pars{a + \nu + 1}\Gamma\pars{b} \over \Gamma\pars{a + \nu + 1 + b}}
\,\right\vert_{\ \nu\ =\ 0}
\\[5mm] = &\
{\Gamma\pars{b} \over
\Gamma\pars{a}\Gamma\pars{b}/\Gamma\pars{a + b}}
\bracks{\Gamma\pars{1 + a}\,{H_{a} - H_{a + b} \over \Gamma\pars{1 + a + b}}}
\\[5mm] = &\
{\Gamma\pars{a + b} \over
\Gamma\pars{a}}\bracks{%
a\,\Gamma\pars{a}\,{H_{a} - H_{a + b} \over \pars{a + b}\Gamma\pars{a + b}}} =
\bbx{{a \over a + b}\pars{H_{a} - H_{a + b}}}
\end{align}



\begin{align}
&\bbox[13px,#ffd]{\int_{0}^{1}{x^{a - 1}\pars{1 - x}^{b - 1} \over \mrm{B}\pars{a,b}}
\,{1 \over x + 1}\,\dd x} =
{1 \over \mrm{B}\pars{a,b}}\int_{0}^{1}x^{a - 1}\pars{1 - x}^{b - 1}
\bracks{1 - \pars{-1}x}^{\,-1}\,\dd x
\\[5mm] = &\
{1 \over \mrm{B}\pars{a,b}}\bracks{%
\mrm{B}\pars{a,b}\,\mbox{}_{2}\mrm{F}_{1}\pars{1,a;a + b;-1}} =
\bbx{\mbox{}_{2}\mrm{F}_{1}\pars{1,a;a + b;-1}}\label{1}\tag{1}
\end{align}

\eqref{1} is evaluated as an 'Euler Type' expression for the Hypergeometric Function: It's given in
  this link.


$\ds{\Large\left.b\right)}$
\begin{align}
&\bbox[13px,#ffd]{\int_{0}^{\infty}{\beta^{\alpha} \over \Gamma\pars{\alpha}}
\,y^{\alpha - 1}\expo{-\beta y}y\ln\pars{y}\,\dd y} =
{\beta^{\alpha} \over \Gamma\pars{\alpha}}
\left.\partiald{}{\nu}\int_{0}^{\infty}y^{\alpha + \nu}\expo{-\beta y}\,\dd y
\,\right\vert_{\ \nu\ =\ 0}
\\[5mm] = &\
{\beta^{\alpha} \over \Gamma\pars{\alpha}}
\partiald{}{\nu}\bracks{{1 \over \beta^{\alpha + \nu + 1}}
\int_{0}^{\infty}y^{\alpha + \nu}\expo{-y}\,\dd y}_{\ \nu\ =\ 0} =
{\beta^{\alpha} \over \Gamma\pars{\alpha}}
\partiald{}{\nu}\bracks{{\Gamma\pars{\alpha + \nu + 1} \over
\beta^{\alpha + \nu + 1}}}_{\ \nu\ =\ 0}
\\[5mm] = &\
{\beta^{\alpha} \over \Gamma\pars{\alpha}}\braces{%
-\beta^\pars{-1 - \alpha}\,\Gamma\pars{1 + \alpha}\bracks{\ln\pars{\beta} - H_{\alpha} + \gamma}} =
\bbx{{\alpha \over \beta}\bracks{H_{\alpha} - \gamma - \ln\pars{\beta}}}
\end{align}
A: Have you tried a computer algebra system? 
Part (a): For $X \sim \text{Beta}(a,b)$ with pdf $f(x)$:

Then here is the output generated by mathStatica / Mathematica to the first problem:

... where HarmonicNumber[n] denotes the $n^\text{th}$ harmonic number $H_n=\sum _{i=1}^n \frac{1}{i}$, and

where Hypergeometric2F1Regularized[a,b,c,z] denotes ${_2}F{_1}(a,b;c;z) / \Gamma(c)$, and Expect is a mathStatica function (of which I am one of the authors). 

Part (b): For $Y \sim \text{Gamma}(\alpha,\beta)$ with pdf $g(y)$:

... you seek:

... where EulerGamma is Euler's constant (approx 0.577), and:

where ExpInteralE[$\alpha$, $\beta$ ] is the exponential integral function $\int _1^{\infty} \frac{1}{t^\alpha} e^{-\beta t} dt$

Part (c): Find $\Bbb E [\frac{1}{XY+1}]$ and $\Bbb E [\frac{1}{Y-XY+1}]$.
These two questions are essentially the same. To see this, note that if $X \sim \text{Beta}(a,b)$, then $(1-X) \sim \text{Beta}(b,a)$, and that $\Bbb E [\frac{1}{Y-XY+1}] = \Bbb E [\frac{1}{(1-X)Y+1}]$ which is thus also of form  $\Bbb E [\frac{1}{XY+1}]$ (just with the $X$ parameters swapped). So we only need to solve the first part.
Given independence, the joint pdf of $(X,Y)$, say $h(x,y) = f(x) g(y)$:

Then $\Bbb E [\frac{1}{XY+1}]$ is:

While this expression looks rather cumbersome, it appears to be correct, and works fine for non-integer parameter values. For instance, when ${a = 2.2, b = 3.3, \alpha = 4.1, \beta = 5.2}$, the above expression returns a value of 0.780101 for the expectation (which is consistent with Monte Carlo simulation).
