# Evaluate $\int \frac{x+4}{x^2 + 2x + 5}$

I am having issues with this integral. I am not sure if it is irreducible or not. I can't use the quadratic formula, but I can rearrange the integral to be $$\int \frac{x+4} {(x^2 + 2x + 1) + 4}$$, but I don't know how to deal with the $$+4$$.

Here is my work treating the quadratic equation as irreducible with no repeating factors.

$$\int \frac{x+4}{x^2 + 2x + 5}$$ = $$\frac {Ax + B} {x^2 + 2x + 5}$$ = $$Ax+B(x^2 + 2x + 5)$$

= $$Ax^3 + 2Ax^2 + 5Ax + Bx^2 + 2Bx + 5B$$

= $$Ax^3 + (2A + 2B)x^2 + (5A + 2B)x + 5B$$

However I get stuck trying to solve my system of equations. This leads me to believe that I did the partial fractions improperly.

$$\begin{bmatrix} 1 & 0 & 0 \\ 2 & 2 & 0 \\ 5 & 2 & 1 \\ 0 & 5 & 4 \\ \end{bmatrix}$$

Given $$\int\dfrac{x+4}{x^2+2x+5}dx=\int\dfrac{x+4}{(x+1)^2+4}dx$$

Use u-substitution: $$u=x+1$$ and we get \begin{align} \int\dfrac{u+3}{u^2+4}du &= \int\dfrac{u}{u^2+4}du+\int\dfrac{3}{u^2+4}du \\ &= \dfrac12\ln|u^2+4|+\dfrac32\arctan\left(\dfrac u2\right) +c \\ &= \dfrac12\ln|(x+1)^2+4|+\dfrac32\arctan\left(\dfrac{x+1}{2}\right) +c \end{align}

Therefore, $$\int\dfrac{x+4}{x^2+2x+5}dx=\dfrac12\ln|(x+1)^2+4|+\dfrac32\arctan\left(\dfrac{x+1}{2}\right) +c$$

• How did you integrate $\int \frac{u}{u^2+4}$? I see it as this: $\int u \frac{1}{u^2+4} = \frac{1}{2}u^2 \cdot u^2ln(u^2)$ – Evan Kim Mar 11 at 18:08
• @EvanKim Use substitution $t=u^2+4$ and you get $\int\dfrac{1}{2t}dt=\dfrac12\ln|t|=\dfrac12\ln|u^2+4|$ – Key Flex Mar 11 at 19:13

The denominator has no real roots, which means you'll try to rewrite as follows ($$A,B\in\mathbb{R}$$): $$\frac{x+4}{x^2 + 2x + 5} = A\underbrace{\frac{\left(x^2 + 2x + 5\right)'}{x^2 + 2x + 5}}_{\to \ln}+\underbrace{\frac{B}{x^2 + 2x + 5}}_{\to \arctan}$$ where $$\left(x^2 + 2x + 5\right)'=2x+2$$, so this comes down to finding $$A$$ and $$B$$ such that: $$x+4=A\left(2x+2\right)+B$$ Once you have $$A$$ and $$B$$, you split the integral in two (easy) parts. Can you take it from there?

• Why did you put the derivative of the denominator on top? – Evan Kim Mar 11 at 15:31
• That's the general idea for this type of rational function: split into a part where the numerator is the derivative of the denominator (which will give you a logarithm as an anti-derivative) and a part with constant numerator (which will give you an arctangent as anti-derivative). – StackTD Mar 11 at 15:33
• It makes sense, but I am not sure where it fits into my current framework of integration knowledge. The chapter I am on said for irreducible quadratics, you can split the integral up into $= \frac{Ax + B}{ax^2 + bx + c}$. How does the equation remain unchanged when you add the denominator's derivative to the numerator of only one of the parts? – Evan Kim Mar 11 at 15:37
• You don't add, you rewrite. The approach I described is the general approach for $\frac{Ax + B}{ax^2 + bx + c}$, at least when the denominator is irreducible. You rewrite $Ax+B$ as $\alpha\left(ax^2 + bx + c\right)'+\beta$ (and continue as above). – StackTD Mar 11 at 15:39
• hmm, do you think we open a chat about this? – Evan Kim Mar 11 at 15:42

\begin{align} \frac{x+4}{x^2+2x+5} &= \frac{x+4}{(x+1)^2 +4} \\ &=\frac{\color{blue}{x+1}}{\color{blue}{(x+1)}^2 +4} +\frac{3}{\color{blue}{(x+1)}^2 +4} \\ &=\frac{\color{blue}{u}}{\color{blue}{u}^2 +4} +\frac{3}{\color{blue}{u}^2 +4} \end{align}

We will integrate first of all change quadratic $$(x+1)^2+4$$ and after fraction of $$x+1+3$$ and divide by quadratic and we can integrate it.