I have not encountered a problem like this before.
$\int \frac{x+4}{x^2 + 2x + 5}dx$
I do not know how to factor the bottom so I am not sure what to do.
I have not encountered a problem like this before.
$\int \frac{x+4}{x^2 + 2x + 5}dx$
I do not know how to factor the bottom so I am not sure what to do.
Note that $(x^2+2x+5)' = 2x+2$. So we can break up the integral into two integrals, one that can be solved by substitution, and one that needs a bit more work: $\int \frac{x+4}{x^2+2x+5}\,dx = \int\frac{x+1+3}{x^2+2x+5}\,dx = \int\frac{x+1}{x^2+2x+5}\,dx + \int\frac{3}{x^2+2x+5}\,dx.$ The first integral can be done with the substitution $u=x^2+2x+5$; then $du = (2x+2)\,dx = 2(x+1)\,dx$, so $\begin{align*} \int\frac{x+1}{x^2+2x+5}\,dx &= \int\frac{\frac{1}{2}\,du}{u}\\ &= \frac{1}{2}\int\frac{du}{u}\\ &= \frac{1}{2}\ln |u| + C\\ &= \frac{1}{2}\ln|x^2+2x+5| + C\\ &= \frac{1}{2}\ln(x^2+2x+5) + C, \end{align*}$ with the last equality because $x^2+2x+5$ is always positive.
The second integral can be done by first completing the square, then doing a change of variable to get an integral of $\frac{1}{u^2+1}$, which can be solved directly.
We have $x^2+2x+5 = (x^2+2x+1)+4 = (x+1)^2+4$. Letting $w=x+1$, we get $w^2 + 4 = 4\left(\frac{w^2}{4} + 1\right) = 4\left(\left(\frac{w}{2}\right)^2 +1\right).$ Finally letting $u=\frac{w}{2}$, we get: $\begin{align*} \int\frac{3}{x^2+2x+5}\,dx &= 3\int\frac{1}{x^2+2x+5}\,dx\\ &= 3\int\frac{1}{(x+1)^2+4}\,dx\\ &= 3\int\frac{1}{w^2+4}\,dw &\text{(letting }w=x+1\text{)}\\ &= 3\int\frac{1}{4((\frac{w}{2})^2+1)}\,dw\\ &= \frac{3}{4}\int\frac{1}{(\frac{w}{2})^2+1}\,dw\\ &= \frac{3}{4}\int \frac{2}{u^2+1}\,du &\text{(letting }u=\frac{w}{2}\text{)}\\ &= \frac{3}{2}\int\frac{1}{u^2+1}\,du\\ &= \frac{3}{2}\arctan(u) + C\\ &= \frac{3}{2}\arctan\left(\frac{w}{2}\right) + C\\ &= \frac{3}{2}\arctan\left(\frac{1}{2}(x+1)\right) + C\\ &= \frac{3}{2}\arctan\left(\frac{1}{2}x + \frac{1}{2}\right) + C. \end{align*}$ Finally, putting it all together: $\begin{align*} \int\frac{x+4}{x^2+2x+5}\,dx &= \int\frac{x+1}{x^2+2x+5}\,dx + 3\int\frac{1}{x^2+2x+5}\,dx\\ &= \frac{1}{2}\ln(x^2+2x+5) + \frac{3}{2}\arctan\left(\frac{1}{2}x + \frac{1}{2}\right) + C. \end{align*}$ Since that was a bit complicated, we can double check by differentiating our answer: $\begin{align*} &\frac{d}{dx}\left(\frac{1}{2}\ln(x^2+2x+5) + \frac{3}{2}\arctan\left(\frac{1}{2}x + \frac{1}{2}\right)\right)\\ &= \frac{1}{2}\left(\frac{(x^2+2x+5)'}{x^2+2x+5}\right) + \frac{3}{2}\left(\frac{1}{(\frac{1}{2}x+\frac{1}{2})^2 + 1}\right)\left(\frac{1}{2}x + \frac{1}{2}\right)'\\ &= \frac{2x+2}{2(x^2+2x+5)} + \frac{3}{2}\left(\frac{1}{\frac{1}{4}x^2 + \frac{1}{2}x + \frac{1}{4} + 1}\right)\left(\frac{1}{2}\right)\\ &= \frac{x+1}{x^2+2x+5} + \frac{3}{4}\left(\frac{1}{\frac{1}{4}(x^2 + 2x + 5)}\right)\\ &= \frac{x+1}{x^2+2x+5} + \frac{3}{x^2+2x+5}\\ &= \frac{x+4}{x^2+2x+5}. \end{align*}$
Note. This is a standard method for solving an integral that has an irreducible quadratic in the denominator and a linear term in the numerator. Such fractions occur often when doing integrals of rational functions, since they may be summands that show up in the partial fraction decomposition. It is imperative to be familiar with the two parts: (i) the basic algebra to break up the integral into two, one of which can be done by simple substitution; and (ii) the technique of completing the square and doing appropriate change of variables to solve an integral of the reciprocal of an irreducible quadratic.
Recall that $\int \frac {du} {u}=\ln|u|$
So $\int \frac {2x+2} {x^2+2x+5} dx=\ln|x^2+2x+5|$ if we substitute $x^2+2x+5=u$
Thus, we will will manipulate the integral you gave to get:
$\frac{1}{2}\int \frac {2x+2} {x^2+2x+5} + \frac{6} {x^2+2x+5}dx=\frac{1}{2} \ln |x^2+2x+5| + 3\int\frac{1}{(x+1)^2+2^2}dx$
The second integral satisfies the arctangent rule, so it equals $\frac{1}{2}\ln |x^2+2x+5| +\frac{3}{2}\arctan(\frac{x+1}{2})+C$