I am trying to solve the following integral,
$$\int_0^1 \frac{1}{1+e^{-x}}\cdot Beta(x|\alpha, \beta)dx$$
where $Beta(x|\alpha, \beta)=\frac{1}{B(\alpha,\beta)}x^{\alpha-1}(1-x)^{\beta-1}$ is a beta distribution and $B(\alpha,\beta)=\frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)}$ is beta function.
My approach is to use integration by parts (which I show as follows) but I reached a strange result, which is 0. Could someone help spot the possible errors or suggest some other ways to solve it?
- Solving with integration by parts
By definition, $$\int f(x)g'(x)dx=f(x)g(x)-\int f'(x)g(x)dx$$ Let $f(x)=\frac{1}{1+e^{-x}}$ and $g'(x)=Beta(x|\alpha,\beta)$, and we take the interval (0, 1) into account, so the equation above becomes
$$\int_0^1 f(x)g'(x)dx=f(x)g(x)\big\vert_0^1 - \int_0^1 f'(x)g(x)dx$$ so the left hand side of the above should be the term we would like to solve. Next, since $g(x)=1$ (because it is integrated over 0 to 1, and it's total probability), reaching $$\int_0^1 f(x)g'(x)dx=f(x)\big\vert_0^1-\int_0^1f'(x)dx=f(x)\big\vert_0^1-f(x)\big\vert_0^1=0$$ So, I kind of feel something might be wrong in my derivations, could somebody help me out with it? Thanks!
Indeed, you want to compute this integral $$I=\int_0^1 \frac{1}{1+e^{-x}}x^{\alpha-1}(1-x)^{\beta-1}dx$$ Other Way
Sigmoid function has Maclaurin series $$\color{red}{\frac{1}{1+e^{-x}}=\sum_{n=0}^{\infty}\frac{(-1)^n(2^{n+1}-1)}{n+1}B_{n+1}x^n}$$ therefore $$I=\sum_{n=0}^{\infty}\left(\frac{(-1)^n(2^{n+1}-1)}{n+1}B_{n+1}\int_0^1 x^{n+\alpha-1}(1-x)^{\beta-1}dx\right)$$ $$I=\Gamma(\beta)\sum_{n=0}^{\infty}\left(\frac{(-1)^n(2^{n+1}-1)}{n+1}\frac{\Gamma(n+\alpha)}{\Gamma(n+\alpha+\beta)}B_{n+1}\right)$$ where $B_n$ is Bernoulli number.