# Integrating $\frac{1}{\sqrt{ax^2+bx+c}}$ for $a<0$

I'm trying to integrate the function $$\frac{1}{\sqrt{ax^2+bx+c}}$$ for $$a<0$$ and $$b,c>0$$.

From a list of integrals of irrational functions from Wikipedia I know the result should contain arcsin or arcos, but I don't understand how to get there.

I've tried Euler's substitution and trigonometric substitution but I always stumble over the fact that $$a$$ is negative.

For all $$a,b,c\in\mathbb{C}$$; \begin{align} \int\frac{\mathrm{d}x}{\sqrt{ax^2+bx+c}} &=\int\frac{\mathrm{d}x}{\sqrt{a(x^2+\frac{b}ax)+c}}\\ &=\int\frac{\mathrm{d}x}{\sqrt{a((x+\frac{b}{2a})^2-\frac{b^2}{4a^2})+c}}\\ &=\int\frac{\mathrm{d}x}{\sqrt{a(x+\frac{b}{2a})^2-\frac{b^2}{4a}+c}}\\ &=\frac1{\sqrt{a}}\int\frac{\mathrm{d}u}{\sqrt{u^2-\frac{b^2}{4a}+c}},\,\,\,\,[u=\sqrt{a}(x+b/(2a))]\\ &=\frac1{\sqrt{a}}\int\frac{\mathrm{d}u}{\sqrt{u^2+\left(\sqrt{-\frac{b^2}{4a}+c}\right)^2}}\\ &=\frac1{\sqrt{a}}\mathrm{arsinh}\left(\frac{u}{\sqrt{-\frac{b^2}{4a}+c}}\right)+C\\ &=\frac1{\sqrt{a}}\mathrm{arsinh}\left(\frac{\sqrt{a}\left(x+\frac{b}{2a}\right)}{\sqrt{-\frac{b^2}{4a}+c}}\right)+C\\ &=\frac1{\sqrt{a}}\mathrm{arsinh}\left(\frac{\sqrt{4a}}{\sqrt{4a}}\cdot\frac{\sqrt{a}\left(x+\frac{b}{2a}\right)}{\sqrt{-\frac{b^2}{4a}+c}}\right)+C\\ &=\frac1{\sqrt{a}}\mathrm{arsinh}\left(\frac{2ax+b}{\sqrt{-b^2+4ac}}\right)+C\\ &=-\frac1{\sqrt{-a}}\mathrm{arcsin}\left(\frac{2ax+b}{\sqrt{b^2-4ac}}\right)+C\\ \end{align} You can use either of the final two lines to evaluate the integral depending on the values of $$a,b,c$$.
Let $$a=-r$$, where $$r\gt 0$$. Then, \begin{align} \frac{1}{\sqrt{ax^2+bx+c}}&=\frac{1}{\sqrt{-rx^2+bx+c}}\\ &=\frac{1}{\sqrt{-\left(rx^2-bx-c\right)}}\\&=\frac{1}{\sqrt{-r\left(x^2-\tfrac br x-\tfrac cr\right)}}\\&=\frac{1}{\sqrt{-r\left(x^2-\tfrac br x+\tfrac {b^2}{4r^2}-\tfrac {b^2}{4r^2} -\tfrac cr\right)}}\\&=\frac{1}{\sqrt{-r\left(x-\tfrac b{2r}\right)^2+r \left(\tfrac {b^2}{4r^2} +\tfrac cr\right)}} \end{align}.
Substitute $$u=x-\frac b{2r}$$. Then you have $$\frac{1}{\sqrt{-r\left(x-\tfrac b{2r}\right)^2+r \left(\tfrac {b^2}{4r^2} -\tfrac cr\right)}}=\frac{1}{\sqrt{-ru^2+r (\tfrac {b^2}{4r^2} +\tfrac cr)}}.$$ Can you complete now ?
$$I=\int\frac{1}{\sqrt{ax^2+bx+c}}dx$$ Firstly, we want to simplify the bit in the squareroot, so we can use completing the square to get it in the form that we want. We can show that: $$ax^2+bx+c=\left(\sqrt{a}x+\frac{b}{2\sqrt{a}}\right)+\left(c-\frac{b^2}{4a}\right)$$ By making the substitution $$u=\sqrt{a}x+\frac{b}{2\sqrt{a}}$$. Now we know that $$dx=\frac{du}{\sqrt{a}}$$ and we can rewrite our integral as: $$I=\frac{1}{\sqrt{a}}\int\frac{1}{\sqrt{u^2+\left(c-\frac{b^2}{4a}\right)}}du$$ Now we have it in the common form: $$\int\frac{1}{\sqrt{\omega^2+\alpha^2}}d\omega$$ which is well known