I am trying to solve an integral like this: $$ I=\int \frac{x^2 e^x}{(e^x+1)^2} dx $$ And I get this answer: $$ \int \frac{x^2 e^x}{(e^x+1)^2}dx=x^2-\frac{x^2}{e^x+1}-2x\text{ln}(e^x+1)+2\int\text{ln}(e^x+1)dx $$ Where ln denotes natural logarithm. The last integral can be rewritten as Li$_2(-e^x)$: \begin{gather} \int\text{ln}(e^x+1)dx=\begin{cases} u=e^x\\ du=e^xdx\Rightarrow dx={du\over u}\end{cases}\Rightarrow\\ \Rightarrow \int\text{ln}(e^x+1)dx=\int\frac{\text{ln}(u+1)}{u} du \end{gather} As Li$_1(z)=-\text{ln}(1-z)\Rightarrow \text{ln}(u+1)=\text{ln}(1-(-u))=-\text{Li}_1(-u)$, it yields: \begin{gather} \int\frac{\text{ln}(u+1)}{u} du=-\int\frac{\text{Li}_1(-u)}{u}du=-\text{Li}_2(-u)=-\text{Li}_2(-e^x) \end{gather} Finally: \begin{gather} \int \frac{x^2 e^x}{(e^x+1)^2} dx=\int \frac{x^2 e^x}{(e^x+1)^2}dx=x^2-\frac{x^2}{e^x+1}-2x\text{ln}(e^x+1)-2\text{Li}_2(-e^x) \end{gather} Now, I need to evaluate $I$ from $-\infty$ to $\infty$. I have solved it in Wolfram Alpha, but although it often shows the step by step option, in this case, it doesn't. The result is $\pi^2/3$, which is barely $\zeta(2)$, where $\zeta(\cdot)$ is the Riemann's zeta function, closely related to polylogarithms. So the question is how to evaluate this integral from $-\infty$ to $\infty$. Thank you in advance.
How to solve this integral: $\int_{-\infty}^\infty\frac{x^2 e^x}{(e^x+1)^2}\:dx$
451 Views Asked by Miguel Angel Jimenez Herrera https://math.techqa.club/user/miguel-angel-jimenez-herrera/detail AtThere are 3 best solutions below
Often, with such complicated primitives, I suggest not to calculate the primitive, but to use some trick, like introducing a parameter and differentiate with respect to it. Read below if you are interested in such a way to calculate this integral. Tell me if this is far from what you looked for.
First, since the integrand is even, your integral equals $$ 2\int_0^{+\infty}\frac{x^2e^x}{(1+e^x)^2}\,dx. $$ Introduce $$ f(a)=\int_0^{+\infty}\frac{x}{1+e^{ax}}\,dx. $$ Then, your integral equals $-2f'(1)$. To calculate $f(a)$, we note that $$ \frac{x}{1+e^{ax}}=x\bigl(e^{-ax}-e^{-2ax}+e^{-3ax}-\cdots\bigr) $$ and $$ \int_0^{+\infty}(-1)^{k+1}xe^{-akx}\,dx=\frac{1}{a^2}(-1)^{k+1}\frac{1}{k^2}. $$ We get that $$ f(a)=\frac{1}{a^2}\sum_{k=1}^{+\infty}(-1)^{k+1}\frac{1}{k^2}=\frac{1}{a^2}\frac{\pi^2}{12}. $$ It remains to check that $$ -2f'(1)=-2\cdot(-2)\cdot\frac{\pi^2}{12}=\frac{\pi^2}{3}. $$
Edit
There are many ways of calculating $\sum_{k=1}^{+\infty}(-1)^{k+1}1/k^2$. One is by using the Basel problem $$ \frac{\pi^2}{6}=\sum_{k=1}^{+\infty}\frac{1}{k^2}=-\int_0^1\frac{\ln x}{1-x}\,dx $$ together with (I leave the calculations to you) $$ \sum_{k=1}^{+\infty}(-1)^{k+1}\frac{1}{k^2}=\int_0^1\frac{\log(1+x)}{x}\,dx=-\frac{1}{2}\int_0^1\frac{\ln x}{1-x}\,dx. $$ Another is by inserting $x=0$ in the Fourier series (for $x=0$ the $\sim$ below can be replaced by $=$ by a well-known theorem on convergence of Fourier series) $$ x^2\sim \frac{\pi^2}{3}+4\sum_{k=1}^{+\infty}(-1)^k\frac{\cos kx}{k^2}. $$ There must be questions on the "alternating Basel problem" on this site, but my search did not find it. Good luck, and tell me if something is still unclear.
Because $\frac{x^2e^x}{(e^x+1)^2}=\frac{x^2}{\left(e^{x/2}+e^{-x/2}\right)^2}$ is even, we can integrate by parts and use the Dirichlet eta function: $$ \begin{align} \int_{-\infty}^\infty\frac{x^2e^x}{(e^x+1)^2}\,\mathrm{d}x &=2\int_0^\infty\frac{x^2e^x}{(e^x+1)^2}\,\mathrm{d}x\\ &=-2\int_0^\infty x^2\,\mathrm{d}\frac1{e^x+1}\\ &=4\int_0^\infty\frac{x}{e^x+1}\,\mathrm{d}x\\ &=4\Gamma(2)\,\eta(2)\\[6pt] &=2\zeta(2)\\ &=\frac{\pi^2}3 \end{align} $$
Hint. Observe that we have $$ \begin{align} \int_{-\infty}^\infty \frac{x^2 e^x}{(e^x+1)^2}\:dx&=\int_{-\infty}^0 \frac{x^2 e^x}{(e^x+1)^2}\:dx+\int_0^\infty \frac{x^2 e^x}{(e^x+1)^2}\:dx\\\\ &=2\int_0^\infty \frac{x^2 e^x}{(e^x+1)^2}\:dx\\\\ &=2\int_0^\infty \frac{x^2e^{-x} }{(1+e^{-x})^2}\:dx\\\\ &=2\sum_{n=1}^{\infty}n(-1)^{n-1}\underbrace{\int_0^\infty x^2e^{-nx} \:dx}_\color{red}{{\large 2/n^3}}\\\\ &=4\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{n^2}\\\\ &=\frac{\pi^2}3. \end{align} $$