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

In my opinion you can save many hassles with a slightly different method. Set $\sqrt{4ac-b^2}=D$ and do
\begin{align}
\int\frac{1}{ax^2+bx+c}\,dx
&=\int\frac{4a}{4a^2x^2+4abx+4ac}\,dx \\[6px]
&=\int\frac{4a}{(2ax+b)^2+(4ac-b^2)}\,dx \\[6px]
&=\int\frac{4a}{D^2t^2+D^2}\frac{D}{2a}\,dt
  && 2ax+b=Dt,\quad dx=\frac{D}{2a}\,dt \\[6px]
&=\frac{2}{D}\int\frac{1}{t^2+1}\,dt \\[6px]
&=\frac{2}{D}\arctan t+C \\[6px]
&=\frac{2}{\sqrt{4ac-b^2}}\arctan\left(\frac{2ax+b}{\sqrt{4ac-b^2}}\right)
\end{align}
Note that if you set $u=Kv$, then $du=K\,dv$, not $du=\frac{1}{K}\,dv$. For instance, in the substitution above,
$$
2a\,dx=D\,dt
$$
so
$$
dx=\frac{D}{2a}\,dt
$$
