Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
Possible? Come on, man! I'm just asking a hypothetical question. If the numerator were $x + 1$, you'd set $u = $bottom and have $du/2u$ – The Chaz 2.0 Jun 8 '12 at 2:49
See the example here. – Dylan Moreland Jun 8 '12 at 2:50
I can't make you open your eyes (and consider the hypothetical, which is useful). Incidentally, if you study the example that Dylan linked, you'll find another "unhelpful" integral. – The Chaz 2.0 Jun 8 '12 at 2:52
@Jordan: You didn't look closely, or you didn't understand. They first split the integral into two, one of which is solved by a "u substitution", but the other one needs more work. That is exactly what you need to do here. – Arturo Magidin Jun 8 '12 at 3:02
@Jordan: Have you ever tried reading the textbook for your course? I'm sure it explains everyhing you need to know for integrating rational functions. (There's an algorithm which covers every possible case, so you don't need even an $\epsilon$ of imagination to solve this type of problem; just follow what the method tells you to do. In particular, you should never need to get stuck on a problem like this if you are only able to read...) – Hans Lundmark Jun 8 '12 at 4:30
up vote 16 down vote accepted

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.

share|cite|improve this answer
Your patience is commendable. – The Chaz 2.0 Jun 8 '12 at 3:22
Indeed it is, and this is exactly what the OP wants, and usually gets: complete solution to his quests...and this is already the 35 or so question in the last week only – DonAntonio Jun 8 '12 at 3:47
@DonAntonio: And then he fails the course anyway, so it's not like I'm giving him the grade. Trying to get him to think it through and learn something usually ends in frustration on both ends, and both self-deprecation and insults. This way, at least, he stops whining. – Arturo Magidin Jun 8 '12 at 3:48
@Arturo Indeed, yet his constant whining and annoying attitude has already put me against his posts. I can't stand somebody who's already at least a senior in h.s. getting upset because somebody dares to ask him to make an effort to understand something..and he actually gets mad: with mathematics, with people trying to help him, with life... I wouldn't even give him the chance to stop whining: let him complain and cry as much as he wants, I say. – DonAntonio Jun 8 '12 at 4:00

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$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.