Problem 120
Medium Exponential and Logarithmic

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.

  1. Expand the numerator and split into three terms.
  2. Rewrite the $e^{2x}/(1+e^{2x})$ term to reveal a cancellation.
  3. Integrate the remaining $e^x/(1+e^{2x})$ term via substitution.
  4. 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

Result

The solution to the integral is:

$$ I = x + 2\arctan(e^x) + C. $$