Answer :

To solve the integral [tex]\(-\int \frac{x^2 + x + 2}{x + 5} \, dx\)[/tex], we'll break down the process into comprehensible steps, ensuring clarity in how each part contributes to the solution.

### Step 1: Simplify the integrand

First, let's rewrite the integrand by performing polynomial division on the function [tex]\(\frac{x^2 + x + 2}{x + 5}\)[/tex].

Perform the division:

1. Long Division Process:

1. Divide the leading term of the numerator [tex]\(x^2\)[/tex] by the leading term of the denominator [tex]\(x\)[/tex]:
[tex]\[ \frac{x^2}{x} = x. \][/tex]

2. Multiply [tex]\(x\)[/tex] by the denominator [tex]\((x + 5)\)[/tex]:
[tex]\[ x \cdot (x + 5) = x^2 + 5x. \][/tex]

3. Subtract this result from the original numerator:
[tex]\[ (x^2 + x + 2) - (x^2 + 5x) = (x + 2) - 5x = -4x + 2. \][/tex]

4. Now, divide the new leading term [tex]\(-4x\)[/tex] by [tex]\(x\)[/tex]:
[tex]\[ \frac{-4x}{x} = -4. \][/tex]

5. Multiply [tex]\(-4\)[/tex] by the denominator [tex]\((x + 5)\)[/tex]:
[tex]\[ -4 \cdot (x + 5) = -4x - 20. \][/tex]

6. Subtract this result from [tex]\(-4x + 2\)[/tex]:
[tex]\[ (-4x + 2) - (-4x - 20) = 2 + 20 = 22. \][/tex]

From this division, we get:
[tex]\[ \frac{x^2 + x + 2}{x + 5} = x - 4 + \frac{22}{x + 5}. \][/tex]

### Step 2: Rewrite the integral

Now the original integral becomes:
[tex]\[ -\int \frac{x^2 + x + 2}{x + 5} \, dx = -\int \left(x - 4 + \frac{22}{x + 5}\right) \, dx. \][/tex]

### Step 3: Integrate term-by-term

Integrate each term separately:

1. [tex]\(\int x \, dx = \frac{x^2}{2}\)[/tex],
2. [tex]\(\int (-4) \, dx = -4x\)[/tex],
3. [tex]\(\int \frac{22}{x + 5} \, dx = 22 \ln |x + 5|\)[/tex].

The integral becomes:
[tex]\[ - \left( \frac{x^2}{2} - 4x + 22 \ln |x + 5| \right). \][/tex]

### Step 4: Apply the negative sign

Distribute the negative sign through the integral result:
[tex]\[ -\int \left(x - 4 + \frac{22}{x + 5}\right) \, dx = -\left( \frac{x^2}{2} - 4x + 22 \ln |x + 5| \right). \][/tex]

### Step 5: Simplify the result

Simplify the result to get:
[tex]\[ -\frac{x^2}{2} + 4x - 22 \ln |x + 5| + C, \][/tex]
where [tex]\(C\)[/tex] is the constant of integration.

So, the final answer is:
[tex]\[ -\frac{x^2}{2} + 4x - 22 \ln |x + 5| + C. \][/tex]