Answer :

To solve the integral [tex]\(\int \frac{x^2 + 2}{x^2 + 3x + 7} \, dx\)[/tex], we will break it down step by step.

1. Rewrite the Integrand:
We start by analyzing the integrand [tex]\(\frac{x^2 + 2}{x^2 + 3x + 7}\)[/tex]. Notice that the denominator is a quadratic polynomial. Our goal is to express the integrand in a form that is easier to integrate.

2. Complete the Square in the Denominator:
The denominator [tex]\(x^2 + 3x + 7\)[/tex] can be rewritten by completing the square:
[tex]\[ x^2 + 3x + 7 = \left(x^2 + 3x + \frac{9}{4}\right) + \frac{19}{4} = \left(x + \frac{3}{2}\right)^2 + \frac{19}{4} \][/tex]

3. Simplify the Numerator:
Next, we rewrite the integrand considering the new form of the denominator. Notice that [tex]\(x^2 + 2\)[/tex] can be written as:
[tex]\[ x^2 + 2 = (x^2 + 3x + 7) - 3x - 5 \][/tex]
Therefore, we have:
[tex]\[ \frac{x^2 + 2}{x^2 + 3x + 7} = \frac{(x^2 + 3x + 7) - 3x - 5}{x^2 + 3x + 7} = 1 - \frac{3x + 5}{x^2 + 3x + 7} \][/tex]

4. Integrate Each Term Separately:
Now, we split the integral:
[tex]\[ \int \frac{x^2 + 2}{x^2 + 3x + 7} \, dx = \int 1 \, dx - \int \frac{3x + 5}{x^2 + 3x + 7} \, dx \][/tex]

5. Integrate the First Part:
The first part is straightforward:
[tex]\[ \int 1 \, dx = x \][/tex]

6. Integrate the Second Part:
To integrate [tex]\(\int \frac{3x + 5}{x^2 + 3x + 7} \, dx\)[/tex], we can split the fraction and apply the method of partial fractions. First, rewrite the numerator [tex]\(3x + 5\)[/tex] as a sum of the derivative of the denominator plus a constant:
[tex]\[ 3x + 5 = 3(x^2 + 3x + 7)' - 9 + 5 = 3 (2x + 3) + (-4) \][/tex]
So now we can write:
[tex]\[ \frac{3x + 5}{x^2 + 3x + 7} = \frac{3(2x + 3) - 4}{x^2 + 3x + 7} = 3 \cdot \frac{2x + 3}{x^2 + 3x + 7} - \frac{4}{x^2 + 3x + 7} \][/tex]

First Sub-integral:
[tex]\[ \int 3 \cdot \frac{2x + 3}{x^2 + 3x + 7} \, dx = 3 \int \frac{2x + 3}{x^2 + 3x + 7} \, dx \][/tex]
Notice that [tex]\(2x + 3\)[/tex] is the derivative of [tex]\(x^2 + 3x + 7\)[/tex]:
[tex]\[ u = x^2 + 3x + 7, \quad du = (2x + 3) dx \][/tex]
So,
[tex]\[ 3 \int \frac{2x + 3}{x^2 + 3x + 7} \, dx = 3 \ln|x^2 + 3x + 7| \][/tex]

Second Sub-integral:
[tex]\[ - \int \frac{4}{x^2 + 3x + 7} \, dx \][/tex]
Use the completed square on the denominator:
[tex]\[ x^2 + 3x + 7 = (x + \frac{3}{2})^2 + \frac{19}{4} \][/tex]
Let [tex]\( v = x + \frac{3}{2} \)[/tex]:
[tex]\[ \int \frac{4}{(x + \frac{3}{2})^2 + \frac{19}{4}} \, dx = \int \frac{4}{v^2 + \left(\frac{\sqrt{19}}{2}\right)^2} \, dv \][/tex]
This is a standard arctangent form:
[tex]\[ \int \frac{1}{a^2 + x^2} dx = \frac{1}{a} \arctan(\frac{x}{a}) + C \][/tex]
Hence,
[tex]\[ -4 \cdot \frac{2}{\sqrt{19}} \arctan \left(\frac{2v - 3}{\sqrt{19}}\right) \][/tex]

Combining everything, the final answer is:
[tex]\[ \int \frac{x^2 + 2}{x^2 + 3x + 7} \, dx = x - \frac{3}{2} \ln|x^2 + 3x + 7| - \frac{\sqrt{19}}{19} \arctan \left(\frac{2\sqrt{19}x + 3\sqrt{19}}{19}\right) + C \][/tex]