To evaluate the integral \(\int \frac{x + \sin x}{1 + \cos x} \, dx\), we can break it down into simpler parts. Here’s a step-by-step solution:
### Step 1: Rewrite the Integral
We can separate the integral into two parts:
\[
\int \frac{x + \sin x}{1 + \cos x} \, dx = \int \frac{x}{1 + \cos x} \, dx + \int \frac{\sin x}{1 + \cos x} \, dx
\]
### Step 2: Simplify the Second Integral
For the second integral \(\int \frac{\sin x}{1 + \cos x} \, dx\), we can use the substitution:
Let \(u = 1 + \cos x\), then \(du = -\sin x \, dx\) or \(-du = \sin x \, dx\). The limits change accordingly, but since we are dealing with an indefinite integral, we can ignore the limits.
Thus, we have:
\[
\int \frac{\sin x}{1 + \cos x} \, dx = -\int \frac{1}{u} \, du = -\ln |u| + C = -\ln |1 + \cos x| + C
\]
### Step 3: Evaluate the First Integral
Now we focus on the first integral \(\int \frac{x}{1 + \cos x} \, dx\). This integral can be approached using integration by parts:
Let:
- \(u = x\) \(\Rightarrow du = dx\)
- \(dv = \frac{1}{1 + \cos x} \, dx\)
To find \(v\), we need to evaluate \(\int \frac{1}{1 + \cos x} \, dx\). We can rewrite \(1 + \cos x\) using the identity:
\[
1 + \cos x = 2 \cos^2 \left(\frac{x}{2}\right)
\]
Thus,
\[
\int \frac{1}{1 + \cos x} \, dx = \int \frac{1}{2 \cos^2 \left(\frac{x}{2}\right)} \, dx = \frac{1}{2} \int \sec^2 \left(\frac{x}{2}\right) \, dx
\]
The integral of \(\sec^2\) is:
\[
\frac{1}{2} \cdot 2 \tan \left(\frac{x}{2}\right) = \tan \left(\frac{x}{2}\right)
\]
So, \(v = \tan \left(\frac{x}{2}\right)\).
### Step 4: Apply Integration by Parts
Now, applying integration by parts:
\[
\int u \, dv = uv - \int v \, du
\]
We have:
\[
\int \frac{x}{1 + \cos x} \, dx = x \tan \left(\frac{x}{2}\right) - \int \tan \left(\frac{x}{2}\right) \, dx
\]
### Step 5: Evaluate \(\int \tan \left(\frac{x}{2}\right) \, dx\)
To evaluate \(\int \tan \left(\frac{x}{2}\right) \, dx\), we can use the identity:
\[
\tan \left(\frac{x}{2}\right) = \frac{\sin \left(\frac{x}{2}\right)}{\cos \left(\frac{x}{2}\right)}
\]
The integral can be solved using a substitution or known integral formulas.
### Step 6: Combine Results
Putting everything together, we have:
\[
\int \frac{x + \sin x}{1 + \cos x} \, dx = x \tan \left(\frac{x}{2}\right) - \int \tan \left(\frac{x}{2}\right) \, dx - \ln |1 + \cos x| + C
\]
### Final Result
The final result is:
\[
\int \frac{x + \sin x}{1 + \cos x} \, dx = x \tan \left(\frac{x}{2}\right) - \ln |1 + \cos x| + C
\]