<s>[INST] Error while integrating reciprocal of irreducible quadratic $\int{\frac{1}{ax^2 + bx + c}}{dx} = ?$ I am trying to derive a formula for indefinite integral of reciprocal of irreducible real quadratic. 
$$\int{\frac{1}{ax^2 + bx + c}}{dx} = ?$$, $b^2 - 4ac \lt 0$. According to WolframAlpa it should come out as: $$\frac{2\arctan{\frac{2ax+b}{\sqrt{4ac - b^2}}}}{\sqrt{4ac - b^2}} + C$$ Instead I get $$\frac{\arctan{\frac{x + \frac{b}{2a}}{\sqrt{\frac{c}{a} - (\frac{b}{2a})^2}}}}{a(\frac{c}{a} - (\frac{b}{2a})^2)^\frac{3}{2}} + C$$ which, no matter how I try to simplify it, doesn't give the right answer. Here are my steps, what am I doing wrong?

1) Reduce to a monic quadratic and complete the square: $$\int{\frac{1}{ax^2 + bx + c}}{dx} = \frac{1}{a}\int{\frac{1}{x^2 + \frac{b}{a}x + \frac{c}{a}}}{dx} = \frac{1}{a}\int{\frac{1}{(x + \frac{b}{2a})^2 + \frac{c}{a} - (\frac{b}{2a})^2}}{dx}$$
3) Substitute $x = u - \frac{b}{2a}$, $u = x + \frac{b}{2a}$, $k = \frac{c}{a} - (\frac{b}{2a})^2$: $$\frac{1}{a}\int{\frac{1}{(x + \frac{b}{2a})^2 + \frac{c}{a} - (\frac{b}{2a})^2}}{dx} = \frac{1}{a}\int{\frac{1}{u^2 + k}}{du}$$
4) Substitute $u = v\sqrt{k}$, $v = \frac{u}{\sqrt{k}}$, $du = \frac{1}{\sqrt{k}}\hphantom ddv$:
$$\frac{1}{a}\int{\frac{1}{u^2 + k}}{du} = \frac{1}{a}\int{\frac{\frac{1}{\sqrt{k}}}{kv^2 + k}}{dv} = \frac{1}{a}\int{\frac{1}{k\sqrt{k}(v^2 + 1)}}{dv} = \frac{1}{ak^\frac{3}{2}}\int{\frac{1}{v^2 + 1}}{dv}$$
5) Use common integral $$\frac{1}{ak^\frac{3}{2}}\int{\frac{1}{v^2 + 1}}{dv} = \frac{\arctan{v}}{ak^\frac{3}{2}} + C$$
6) Substitute back $$\frac{\arctan{v}}{ak^\frac{3}{2}} + C = \frac{\arctan{\frac{u}{\sqrt{k}}}}{ak^\frac{3}{2}} + C = \frac{\arctan{\frac{x + \frac{b}{2a}}{\sqrt{\frac{c}{a} - (\frac{b}{2a})^2}}}}{a(\frac{c}{a} - (\frac{b}{2a})^2)^\frac{3}{2}} + C$$
 [/INST] Everything is fine till you write $du=\frac{1}{\sqrt{k}}dv$. It is instead, $du=\sqrt{k}dv$. Aside from that, your solution method is great.
Also, for the argument to the arctan function, note that $\frac{x+\frac{b}{2a}}{\sqrt{\frac{c}{a}-\left(\frac{b}{2a}\right)^2}}=\frac{2a\left(x+\frac{b}{2a}\right)}{2a\sqrt{\frac{c}{a}-\left(\frac{b}{2a}\right)^2}}$, and simplifying this will allow the "inside" of the tangent function to have the appropriate form.
</s>