To solve the integral \( I = \int \frac{e^x}{e^x + e^{-x}} \, dx \), we can follow these steps:
### Step 1: Rewrite the integral
We start with the integral:
\[
I = \int \frac{e^x}{e^x + e^{-x}} \, dx
\]
We can rewrite \( e^{-x} \) as \( \frac{1}{e^x} \):
\[
I = \int \frac{e^x}{e^x + \frac{1}{e^x}} \, dx
\]
This simplifies to:
\[
I = \int \frac{e^{2x}}{e^{2x} + 1} \, dx
\]
### Step 2: Split the integral
Next, we can split the integral into two parts:
\[
I = \int 1 \, dx - \int \frac{1}{e^{2x} + 1} \, dx
\]
This gives us:
\[
I = x - \int \frac{1}{e^{2x} + 1} \, dx
\]
### Step 3: Substitution for the second integral
For the second integral, we can use the substitution \( t = e^x \). Then, \( dt = e^x \, dx \) or \( dx = \frac{dt}{t} \). The limits change accordingly, but since we are dealing with indefinite integrals, we focus on the expression:
\[
\int \frac{1}{e^{2x} + 1} \, dx = \int \frac{1}{t^2 + 1} \cdot \frac{dt}{t}
\]
This simplifies to:
\[
\int \frac{1}{t(t^2 + 1)} \, dt
\]
### Step 4: Partial fraction decomposition
We can decompose \( \frac{1}{t(t^2 + 1)} \) into partial fractions:
\[
\frac{1}{t(t^2 + 1)} = \frac{A}{t} + \frac{Bt + C}{t^2 + 1}
\]
Multiplying through by the denominator \( t(t^2 + 1) \) gives:
\[
1 = A(t^2 + 1) + (Bt + C)t
\]
Expanding and matching coefficients, we get:
\[
1 = At^2 + A + Bt^2 + Ct
\]
This results in:
\[
(A + B)t^2 + Ct + A = 1
\]
From here, we can set up the equations:
1. \( A + B = 0 \)
2. \( C = 0 \)
3. \( A = 1 \)
Solving these gives \( A = 1, B = -1, C = 0 \). Thus, we have:
\[
\frac{1}{t(t^2 + 1)} = \frac{1}{t} - \frac{t}{t^2 + 1}
\]
### Step 5: Integrate each term
Now we can integrate each term separately:
\[
\int \left( \frac{1}{t} - \frac{t}{t^2 + 1} \right) dt = \int \frac{1}{t} \, dt - \int \frac{t}{t^2 + 1} \, dt
\]
The first integral is:
\[
\int \frac{1}{t} \, dt = \ln |t|
\]
The second integral can be solved using the substitution \( u = t^2 + 1 \), giving:
\[
\int \frac{t}{t^2 + 1} \, dt = \frac{1}{2} \ln |t^2 + 1|
\]
### Step 6: Combine results
Putting it all together, we have:
\[
I = x - \left( \ln |t| - \frac{1}{2} \ln |t^2 + 1| \right) + C
\]
Substituting back \( t = e^x \):
\[
I = x - \ln |e^x| + \frac{1}{2} \ln |e^{2x} + 1| + C
\]
This simplifies to:
\[
I = x - x + \frac{1}{2} \ln |e^{2x} + 1| + C
\]
Thus, we arrive at the final result:
\[
I = \frac{1}{2} \ln |e^{2x} + 1| + C
\]