# Why is integration by parts not working on this problem?

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?

• Have you tried differentiating your answer to see if you get the original integrand back? Commented Jul 26, 2023 at 2:01
• Write $\mathrm dx$ also in your integral. Commented Jul 26, 2023 at 8:07
• If $u=x$ then it is certainly true that $\frac{du}{dx}=1$, but it is not true that $du=1$. Commented Jul 27, 2023 at 12:15
• This is a beautiful example of a very common mistake in the real world. I've seen a lot of professors in engineering and science make it. You're in very good company. Commented Jul 28, 2023 at 15:59

$$-\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.
• Perhaps also cite the identity connecting $\operatorname{Li}_2(-e^x)$ and $\operatorname{Li}_2(-e^{-x})$. Commented Aug 2, 2023 at 8:25