To evaluate the integral
\[
I = \int \frac{x^2 + 2}{x + 1} \, dx,
\]
we will follow these steps:
### Step 1: Polynomial Long Division
Since the degree of the numerator \(x^2 + 2\) is greater than the degree of the denominator \(x + 1\), we can perform polynomial long division.
1. Divide \(x^2\) by \(x\) to get \(x\).
2. Multiply \(x\) by \(x + 1\) to get \(x^2 + x\).
3. Subtract \(x^2 + x\) from \(x^2 + 2\):
\[
(x^2 + 2) - (x^2 + x) = 2 - x.
\]
Thus, we can rewrite the integral as:
\[
I = \int \left( x + \frac{2 - x}{x + 1} \right) \, dx.
\]
### Step 2: Split the Integral
Now we can split the integral into two parts:
\[
I = \int x \, dx + \int \frac{2 - x}{x + 1} \, dx.
\]
### Step 3: Evaluate the First Integral
The first integral is straightforward:
\[
\int x \, dx = \frac{x^2}{2} + C_1.
\]
### Step 4: Simplify the Second Integral
Now we need to simplify the second integral:
\[
\int \frac{2 - x}{x + 1} \, dx.
\]
We can split this into two separate fractions:
\[
\int \frac{2}{x + 1} \, dx - \int \frac{x}{x + 1} \, dx.
\]
### Step 5: Evaluate the Second Integral
1. The first part:
\[
\int \frac{2}{x + 1} \, dx = 2 \ln |x + 1| + C_2.
\]
2. The second part can be simplified as follows:
\[
\frac{x}{x + 1} = 1 - \frac{1}{x + 1}.
\]
Thus,
\[
\int \frac{x}{x + 1} \, dx = \int \left( 1 - \frac{1}{x + 1} \right) \, dx = \int 1 \, dx - \int \frac{1}{x + 1} \, dx.
\]
This gives us:
\[
x - \ln |x + 1| + C_3.
\]
### Step 6: Combine All Parts
Now we can combine all parts of the integral:
\[
I = \frac{x^2}{2} + \left( 2 \ln |x + 1| - \left( x - \ln |x + 1| \right) \right) + C.
\]
This simplifies to:
\[
I = \frac{x^2}{2} - x + 3 \ln |x + 1| + C.
\]
### Final Answer
Thus, the final result for the integral is:
\[
\int \frac{x^2 + 2}{x + 1} \, dx = \frac{x^2}{2} - x + 3 \ln |x + 1| + C.
\]
---