17

I am trying to evaluate the following integral using integration by parts:

$$\int\frac{x}{1+e^x}dx$$

However, using $u = x$, $du = 1$, $dv = \frac{1}{1+e^x}$, $v = x-\log(e^x+1)$, I keep getting that the integral is $-\text{Li}_2(-e^x)+\frac{x^2}{2}-x\log(1+e^x)$, but Wolfram Alpha says that the integral is $\text{Li}_2(-e^{-x})-x\log(e^{-x}+1)$.

Can anyone tell me what I'm doing wrong here?

Nicky Hekster
  • 52,147

1 Answers1

52

Who says you went wrong? Subtract the two answers

$$-\operatorname{Li}_2(-e^x) - \operatorname{Li}_2(-e^{-x})+\frac{x^2}{2}-x\log(1+e^x) +x\log(e^{-x}+1)$$

$$=\frac{\pi^2}{6} +x^2 -x\log(1+e^x) +x\log(e^{-x}+1)$$

And since $x^2 = x\log e^x$, the rest of the terms collapse and we get that difference between the two answers is $\frac{\pi^2}{6}$, a constant.

Ninad Munshi
  • 37,891
  • 1
    Perhaps also cite the identity connecting $\operatorname{Li}_2(-e^x)$ and $\operatorname{Li}_2(-e^{-x})$. – GEdgar Aug 02 '23 at 08:25