Step 1: Complete the Square in the Denominator
The quadratic expression in the denominator is:
\[
x^2 + 2x + 4.
\]
Completing the square:
\[
x^2 + 2x + 4 = (x+1)^2 + 3.
\]
Step 2: Use Substitution
Let:
\[
t = x+1 \quad \text{so that} \quad dt = dx.
\]
Then the integral becomes:
\[
I = \int \frac{3(t-1) + 5}{\sqrt{t^2 + 3}} \, dt.
\]
Simplify the numerator:
\[
3(t-1) + 5 = 3t - 3 + 5 = 3t + 2.
\]
So the integral transforms into:
\[
I = \int \frac{3t + 2}{\sqrt{t^2 + 3}} \, dt.
\]
Step 3: Split the Integral
Split the expression:
\[
I = \int \frac{3t}{\sqrt{t^2+3}} \,dt + \int \frac{2}{\sqrt{t^2+3}} \,dt.
\]
First Integral:
Let \( u = t^2 + 3 \), so that \( du = 2t \, dt \), giving:
\[
\int \frac{3t}{\sqrt{t^2+3}} \, dt = \frac{3}{2} \int \frac{du}{\sqrt{u}}.
\]
Since \( \int u^{-1/2} \, du = 2u^{1/2} \), we get:
\[
\frac{3}{2} \cdot 2\sqrt{t^2+3} = 3\sqrt{t^2+3}.
\]
Second Integral:
Using the standard formula:
\[
\int \frac{dx}{\sqrt{x^2 + a^2}} = \sinh^{-1} \left( \frac{x}{a} \right).
\]
Applying this:
\[
\int \frac{2}{\sqrt{t^2+3}} \,dt = 2\sinh^{-1} \left(\frac{t}{\sqrt{3}}\right).
\]
Step 4: Substitute Back \( t = x+1 \)
Replacing \( t \) back in terms of \( x \):
\[
I = 3\sqrt{x^2+2x+4} + 2\sinh^{-1} \left(\frac{x+1}{\sqrt{3}}\right) + C.
\]
Final Answer:
\[
\int \frac{3x+5}{\sqrt{x^2+2x+4}} \,dx = 3\sqrt{x^2+2x+4} + 2\sinh^{-1} \left(\frac{x+1}{\sqrt{3}}\right) + C.
\]