Evaluate the integral: I = integral ((1+e^x)²)/(1+e^2x) dx
Evaluate the integral: $$ I = \int \frac{(1+e^x)^2}{1+e^{2x}}\,dx. $$
Explanation of Method
Expanding the numerator splits the integral into three pieces. Two of the pieces — the constant term and the $e^{2x}$ term — combine to cancel completely after rewriting $e^{2x}/(1+e^{2x})=1-1/(1+e^{2x})$, leaving only a simple polynomial term plus a standard arctangent integral from the middle $e^x$ term.
- Expand the numerator and split into three terms.
- Rewrite the $e^{2x}/(1+e^{2x})$ term to reveal a cancellation.
- Integrate the remaining $e^x/(1+e^{2x})$ term via substitution.
- Combine all results.
Step 1 · Expand the numerator
Expanding $(1+e^x)^2=1+2e^x+e^{2x}$, the integral splits into three terms:
$$ I = \int \frac{1}{1+e^{2x}}\,dx + 2\int \frac{e^x}{1+e^{2x}}\,dx + \int \frac{e^{2x}}{1+e^{2x}}\,dx. $$
Step 2 · Simplify the third term
Rewrite the third term:
$$ \frac{e^{2x}}{1+e^{2x}} = 1 - \frac{1}{1+e^{2x}}, $$
so that:
$$ \int \frac{e^{2x}}{1+e^{2x}}\,dx = x - \int \frac{1}{1+e^{2x}}\,dx. $$
Adding this to the first term, the two $\int \frac{1}{1+e^{2x}}\,dx$ pieces cancel exactly, leaving just $x$.
Step 3 · Evaluate the middle term
For $\displaystyle 2\int \frac{e^x}{1+e^{2x}}\,dx$, let $t=e^x$, so $dt=e^x\,dx$:
$$ 2\int \frac{dt}{1+t^2} = 2\arctan t = 2\arctan(e^x). $$
Step 4 · Combine all results
Adding the pieces from Steps 2 and 3:
$$ I = x + 2\arctan(e^x) + C. $$
Summary Table
| Piece | Contribution |
|---|---|
| $1/(1+e^{2x})$ and $e^{2x}/(1+e^{2x})$ combined | $x$ |
| $2e^x/(1+e^{2x})$, via $t=e^x$ | $2\arctan(e^x)$ |
Additional Notes
- The integrand is defined for all real $x$, since $1+e^{2x}>0$ always.
- The key simplification is recognizing that splitting off a "$1$" from $e^{2x}/(1+e^{2x})$ produces a term that exactly cancels the leftover $1/(1+e^{2x})$ piece from the constant term in the expansion — this avoids ever having to integrate $1/(1+e^{2x})$ directly.
- The result can be checked by differentiating $x+2\arctan(e^x)$: $\;1+\dfrac{2e^x}{1+e^{2x}}\;$, and verifying this equals $\dfrac{(1+e^x)^2}{1+e^{2x}}=\dfrac{1+2e^x+e^{2x}}{1+e^{2x}}=1+\dfrac{2e^x}{1+e^{2x}}$.
Result
The solution to the integral is: