How to know when to complete the square 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! 
 A: 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
$$\int\frac{dx}{(x-i)(x+i)}.$$
A: Beacuse $(x+2)(x+10)= x^2+12x+20$ and not $x^2+8x+20$
A: 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.
A: 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.
$$x^2+8x+20=x^2+8x+16+4=(x+4)^2+2^2$$
$$\int \frac{1}{(x+4)^2+2^2}\,dx = \frac{1}{2}\arctan\left(\frac{x+4}{2}\right)+C $$
A: 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.

A: 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.
