# 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!

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

• I did not show every step in order to save time. I like your way much better. Thank you!! – mathamphetamines Dec 8 '14 at 7:19
• You are welcome. Note also that when people derive the Quadratic Formula, they often first divide $ax^2+bx+c$ through by $a$, creating a mess. I prefer to multiply through by $4a$. Then the quadratic equation becomes $(2ax+b)^2=b^2-4ac$, from which the Quadratic Formula follows quickly. – André Nicolas Dec 8 '14 at 7:26
• Nice trick. I will use this method from now on – mathamphetamines Dec 8 '14 at 7:32
• Found the issue. By letting $u=\sqrt{a}(x+\frac{b}{2a})$, then $du = \frac{dx}{\sqrt{a}}$. Thus, $\frac{\sqrt{a}}{\sqrt{a}}=1$ and I reach my desired result. Thanks again! – mathamphetamines Dec 8 '14 at 20:22

I would solve for the roots and use maybe partial fractions, just to be more neat? have you tried that

• I completed the square, and then wrote the denominator as the sum of squares. – mathamphetamines Dec 8 '14 at 6:37
• but yes. your argument seems right. I teach calcalus and first time I see such a general question. That'ts interesting – Daniel Dec 8 '14 at 6:39
• It is from a table of integrals, and out of curiosity I wanted to show it to be true for myself. – mathamphetamines Dec 8 '14 at 6:43
• @Daniel Since the discriminate is assumed negative, I don't think partial fractions would be much use here, unless you intend to factor the quadratic into complex linear factors. – David H Dec 8 '14 at 6:53
• alright. the way the discriminate was presented confused me I guess :). yes, I apologize. – Daniel Dec 8 '14 at 6:55

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.