Let \(u = e^x\), then \(du = e^x \, dx\) or \(dx = \frac{du}{u}\).
The limits of integration change from \(x = 0\) to \(x = \ln 4\), which correspond to \(u = 1\) to \(u = 4\).
Substitute into the integral:
\(\int_1^4 \frac{u^2}{u^2 + 3u + 2} \, \frac{du}{u} = \int_1^4 \frac{u}{u^2 + 3u + 2} \, du.\)
Factor the denominator: \(u^2 + 3u + 2 = (u+1)(u+2)\).
Use partial fraction decomposition:
\(\frac{u}{(u+1)(u+2)} = \frac{A}{u+1} + \frac{B}{u+2}.\)
Multiply through by the denominator:
\(u = A(u+2) + B(u+1).\)
Expanding gives:
\(u = Au + 2A + Bu + B.\)
Combine like terms:
\(u = (A+B)u + (2A+B).\)
Equate coefficients:
\(A + B = 1\) and \(2A + B = 0\).
Solving these equations gives \(A = 2\) and \(B = -1\).
Thus, \(\frac{u}{(u+1)(u+2)} = \frac{2}{u+2} - \frac{1}{u+1}\).
Integrate each term:
\(\int_1^4 \left( \frac{2}{u+2} - \frac{1}{u+1} \right) \, du = 2 \ln|u+2| - \ln|u+1| \bigg|_1^4.\)
Evaluate the definite integral:
\(\left( 2 \ln 6 - \ln 5 \right) - \left( 2 \ln 3 - \ln 2 \right).\)
Simplify using logarithm properties:
\(2 \ln 6 - \ln 5 - 2 \ln 3 + \ln 2 = \ln \left( \frac{36}{5} \right) - \ln \left( \frac{9}{2} \right).\)
Combine the logarithms:
\(\ln \left( \frac{36}{5} \times \frac{2}{9} \right) = \ln \left( \frac{8}{5} \right).\)