$\int\frac{2x+1}{x^2+2x+5}dx$ by partial fractions $$\int\frac{2x+1}{x^2+2x+5}dx$$
I know I'm supposed to make the bottom a perfect square by making it $(x+1)^2 +4$ but I don't know what to do after that. I've tried to make $x+1= \tan x$ because that's what we did in a class example but I keep getting stuck.
 A: If you make $u= x+1$, you will get that $du = dx$ and
$$ \int\,\dfrac{2x+1}{(x+1)^2+4}\,dx = \int\,\dfrac{2u-1}{u^2+4}\,du $$
but I think it's better use a trigonometric substitution.
A: Using a trigonometric substitution, let $x+1 = 2\tan u$, so that $dx = 2\sec^2 u\,du$ and $2x+1 = 4\tan u-1$. Then we get
\begin{align*}
\int\frac{2x+1}{(x+1)^2+4}\,dx &= \int\frac{4\tan u-1}{4\tan^2 u+4}\cdot 2\sec^2u\,du \\
     &= \frac{1}{4}\int\frac{4\tan u-1}{\sec^2u}\cdot 2\sec^2u\,du \\
     &= \frac{1}{2}\int (4\tan u-1)\,du \\
     &= \frac{1}{2}\left(4\ln\sec u - u\right) + C \\
     &= 2\ln\frac{\sqrt{x^2+2x+5}}{2} - \frac{1}{2}\tan^{-1}\frac{x+1}{2} + C \\
     &= \ln(x^2+2x+5) - \frac{1}{2}\tan^{-1}\frac{x+1}{2} + C.
\end{align*}
A: $$\frac{d}{dx} \ln(x^2 + 2x + 5) = \frac{2x + 2}{x^2 + 2x + 5}dx$$
$$\int\,\left(\dfrac{2x+2}{x^2 + 2x + 5}- \dfrac{1}{x^2 + 2x + 5}\right)\,dx = \ln(x^2 + 2x + 5) + C - \int\,\dfrac{1}{x^2+2x+5}dx$$
 = 
Let $u=x+1$, so $du = dx$, $x = u - 1$, and $$x^2 + 2x + 5=  u^2 - 2u + 1 + 2u - 2 + 5 = u^2 + 4$$
$$\begin{align}
\int\,\dfrac{1}{x^2+2x+5}dx & = \int\,\dfrac{1}{u^2 + 4}du\\
& = \frac{\arctan\left(\frac{u}2\right)}{2} + C\\
& = \frac{\arctan\left(\frac{x+1}{2}\right)}{2} + C\\
\end{align}$$
$$\int\,\dfrac{2x+1}{x^2+2x+5}\,dx  = \ln(x^2 + 2x + 5) - \frac{\arctan\left(\frac{x+1}{2}\right)}{2} + C$$
A: $$
\int\frac{2x+1}{x^2+2x+5}dx
$$
I would first write $w=x^2+2x+5$, $dw=(2x+2)\,dx$, and then break the integral into
$$
\int\frac{2x+2}{x^2+2x+5}dx + \int\frac{-1}{x^2+2x+5}dx.
$$
For the first integral I would use that substitution.  Then
$$
\overbrace{\int\frac{-dx}{x^2+2x+5} = \int\frac{-dx}{(x+1)^2 + 2^2}}^{\text{completing the square}} = \frac{-1}2\int \frac{dx/2}{\left(\frac{x+1}{2}\right)^2+1} = \frac{-1}2 \int\frac{du}{u^2+1}.
$$
Then we get an arctangent.
