Question is:

$$\int \frac{dx}{ x^2+8x+20}$$

Why can I not just solve for $A/(x+2) +B/(x+10)$ and integrate it this way?

The answer on symbolab shows I need to complete the square of the denominator first but I don't know hen to do that or when to factor it out.

Any help would be great!

  • 9
    $\begingroup$ $(x+2)(x+10)=x^2+12x+20$, not $x^2+8x+20$. You can indeed solve it by your method, but you will need to use the appropriate factors $x^2+8x+20=(x+4-2i)(x+4+2i)$. $\endgroup$
    – user583012
    Aug 11, 2018 at 14:18
  • $\begingroup$ You can use this: en.wikipedia.org/wiki/… after you integrated to get back to a "real looking" form. $\endgroup$
    – Zacky
    Aug 11, 2018 at 14:34

6 Answers 6


If the roots are real, you can factor in binomials and convert to simple fractions.

But if they are complex, it may be better to just complete the square in order to stay in the reals.

E.g., it is easier to deal with

$$\int\frac{dx}{x^2+1}$$ than with


  • $\begingroup$ Is it?${}{}{}{}$ $\endgroup$
    – tomasz
    Aug 12, 2018 at 15:54
  • 1
    $\begingroup$ @tomasz: It is. $\endgroup$
    – user65203
    Aug 12, 2018 at 16:05

Beacuse $(x+2)(x+10)= x^2+12x+20$ and not $x^2+8x+20$

  • $\begingroup$ Of course!! I can't believe how stupid that question was thanks guys. $\endgroup$
    – Jessie
    Aug 11, 2018 at 14:19

Because it is not true that $x^2+8x+20=(x+2)(x+10)$. Completing the square is a natural choice whenever (as in this case) the quadratic has no real roots.


You're factoring wrong, the right factorization is $x^2+8x+20=(x+4-2i)(x+4+2i)$ I think completing a square is a natural choice if quadratic doesn't have real roots.


$$\int \frac{1}{(x+4)^2+2^2}\,dx = \frac{1}{2}\arctan\left(\frac{x+4}{2}\right)+C $$

  • $\begingroup$ -1 If the question is "Why do I have to complete the square to solve the integral", an answer showing you completing the square and solving the integral is pointless. The OP is specifically asking why the other method doesn't work, he's not interested in how to solve the integral with this method. $\endgroup$
    – Ant
    Aug 12, 2018 at 11:31
  • $\begingroup$ but OP was doing wrong factorization of the polynomial $\endgroup$ Aug 12, 2018 at 11:35
  • $\begingroup$ $x^2+8x+20=(x+4-2i)(x+4+2i)$ I think completing a square is a natural choice if quadratic doesn't have real roots $\endgroup$ Aug 12, 2018 at 11:39
  • $\begingroup$ Sure, I agree. But then the answer (that was given) is "You're factoring wrong, if you do it correctly it will work too". But I think that showing how the square completion work is just unhelpful. If you instead add this to your ansswer, show how factorization works, and then make a comparison with the "completing the square method", elaborating on why you think it's easier / more natural, then I would upvote it. But as it is you're just ignoring the OP question and just showing that you can do that integral, which is unhelpful $\endgroup$
    – Ant
    Aug 12, 2018 at 13:22
  • $\begingroup$ sure I have edited the answer $\endgroup$ Aug 12, 2018 at 13:59

A more general answer to the question "when should I complete the square?" is:

  • If you are fundamentally concerned with the roots of the quadratic, you should factorise (since factorising gives you the roots for free).
  • If you are more concerned with the curve as a whole, then completing the square can often help, because then you get the transformations of $y=x^2$ that produce the quadratic.

One really quick way to tell whether $ax^2+bx+c$ can be factored using real numbers (where $a,b,c$ are assumed to be real) is by the discriminant $b^2-4ac.$ If the discriminant is negative, you can't factor the polynomial using real numbers. If the discriminant is $0,$ then you have a perfect square and you don't need partial fractions. If the discriminant is positive, then use partial fractions.

Even if you need imaginary numbers to do the factorization, you can still do a partial fraction decomposition, thus: $$ \frac 1 {x^2+8x+20} = \frac{i/4}{x+4+2i} - \frac{i/4}{x+4-2i}. $$ The reason for avoiding this is not in the arithmetic or the algebra, but rather, complications enter when you do calculus with complex numbers, so that is saved for a later course.

Sometimes more insight follows from completing the square than from thinking about the discriminant: \begin{align} & \int \frac{dx}{x^2+8x+20} = \int \frac{dx}{(x+4)^2+4} = \frac 1 2 \int\frac{dx/2}{\left(\frac{x+4} 2 \right)^2 + 1} \\[10pt] = {} & \frac 1 2 \int \frac{du}{u^2+1} = \frac 1 2 \arctan u + C = \cdots\cdots \end{align}

The fact that you get $(\cdots\cdots)^2+4,$ with ${}+4$ rather than with a negative number there, is what tells you you can't factor this using real numbers. If there had been a negative number, this could be factored as a difference of two squares.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .