Integral of Rational Functions $$\int \frac{dx}{ax^2 + bx + c} \quad \text{for} \quad 4ac-b^2 >0$$
then
$$\begin{align}
ax^2 + bx + c
&= a\biggl(x+\frac{b}{2a}\biggr)^2 + \frac{4ac-b^2}{4a} \\
&= \Biggl(\sqrt{a}\biggl(x+\frac{b}{2a}\biggr)\Biggr)^2 + \Biggl(\sqrt{\frac{4ac-b^2}{4a}}\Biggr)^2
\end{align}$$
implies
$$ \int \frac{dx}{ax^2 + bx + c} = \int \frac{dx}{\Bigl(\sqrt{a}\bigl(x+\frac{b}{2a}\bigr)\Bigr)^2 + \Bigr(\sqrt{\frac{4ac-b^2}{4a}}\Bigr)^2} = \frac{2\sqrt{a}}{\sqrt{4ac-b^2}}\arctan\frac{2ax+b}{\sqrt{4ac-b^2}}
$$
The correct answer does not have the $\sqrt{a}$ in the numerator.  I've checked over my work, but have clearly made some dumb mistake.  Can anyone please let me know where such an error was made?  Thank you for your help!
 A: Hard to debug, since some detail is missing. To make things less messy, I would rewrite the integral as
$$ \int\frac{4a\,dx}{(2ax+b)^2+4ac-b^2}.$$
Let $4ac-b^2=K^2$.  Then let $2ax+b=Ku$. We have $2a \,dx=K\,du$. So our integral is 
$$\int \frac{2K\,du}{K^2u^2+K^2},$$
which is 
$$\frac{2}{K}\arctan u+C.$$
Remark: I am not fond of fractions, so for completing the square I prefer to write $$ax^2+bx+c=\frac{1}{4a}\left(4a^2x^2+4abx+4c\right)=\frac{1}{4a}\left((2ax+b)^2-(b^2-4ac)  \right).$$
A: I would solve for the roots and use maybe partial fractions, just to be more neat? have you tried that
A: A way to make diagnosing these types of errors way easier is to pretend your variables are dimensional (i.e. that they have units). Suppose $x$ has units of length (or you could pick mass or time or a made-up unit), which I will write in shorthand as $[x] = L$. Then if $[a] = L^{-2}$ and $[b] = L^{-1}$ and $[c] = 1$ (i.e. $c$ is unitless), the units are consistent and your final answer should have units of length, because $[dx] = L$ and the denominator is unitless. (It's important to make sure the units are consistent when you start, because if you have something like $1 + u^2$ you simply can't assign units to $u$.)
Now just go through your steps and look for the point at which the units stop being consistent. Everything is good up to the next-to-last step you've shown, i.e. this expression
$$\int \frac{dx}{\Bigl(\sqrt{a}\bigl(x+\frac{b}{2a}\bigr)\Bigr)^2 + \Bigr(\sqrt{\frac{4ac-b^2}{4a}}\Bigr)^2}$$
still has the correct units ($[dx] = L$ and denominator unitless), so the error came in somewhere in the steps you didn't show. Obviously, that's all I can say without you showing those steps, but perhaps you can apply this technique to your own private work and see exactly where that extra $\sqrt{a}$ came from.
