Concept:
To integrate a linear expression over a quadratic expression, \( \int \frac{px + q}{ax^2 + bx + c} \, dx \), we express the numerator as a linear combination involving the derivative of the denominator plus a constant:
\[
\text{Numerator} = A \cdot \frac{d}{dx}(\text{Denominator}) + B
\]
Step 1: Set up the numerator decomposition.
The denominator is \( x^2 + 4x + 5 \). Its derivative is:
\[
\frac{d}{dx}(x^2 + 4x + 5) = 2x + 4
\]
We express the numerator \( x + 3 \) as:
\[
x + 3 = A(2x + 4) + B
\]
Expanding the right-hand side:
\[
x + 3 = 2Ax + (4A + B)
\]
Step 2: Equate coefficients to calculate \( A \) and \( B \).
Comparing coefficients of like terms on both sides:
• For \( x \): \( 1 = 2A \Rightarrow A = \frac{1}{2} \)
• For constant terms: \( 3 = 4A + B \)
Substitute \( A = \frac{1}{2} \) into the constant equation:
\[
3 = 4\left(\frac{1}{2}\right) + B \quad \Rightarrow \quad 3 = 2 + B \quad \Rightarrow \quad B = 1
\]
Therefore, we rewrite the numerator as:
\[
x + 3 = \frac{1}{2}(2x + 4) + 1
\]
Step 3: Split the integral into two distinct manageable parts.
\[
I = \int \frac{\frac{1}{2}(2x + 4) + 1}{x^2 + 4x + 5} \, dx = \frac{1}{2} \int \frac{2x + 4}{x^2 + 4x + 5} \, dx + \int \frac{1}{x^2 + 4x + 5} \, dx
\]
Let these be \( I = \frac{1}{2}I_1 + I_2 \).
Step 4: Evaluate both integrals \( I_1 \) and \( I_2 \).
For \( I_1 \), the numerator is the exact derivative of the denominator:
\[
I_1 = \int \frac{2x + 4}{x^2 + 4x + 5} \, dx = \log|x^2 + 4x + 5|
\]
For \( I_2 \), complete the square in the quadratic denominator:
\[
x^2 + 4x + 5 = (x + 2)^2 - 4 + 5 = (x + 2)^2 + 1
\]
Using the standard integration formula \( \int \frac{du}{u^2 + 1} = \tan^{-1}(u) \):
\[
I_2 = \int \frac{dx}{(x + 2)^2 + 1} = \tan^{-1}(x + 2)
\]
Step 5: Combine the final integrated components.
\[
I = \frac{1}{2}\log|x^2 + 4x + 5| + \tan^{-1}(x + 2) + C
\]