Theorem: Primitive of Reciprocal of x by Root of a x squared plus b x plus c

Let $a, b, c \in \R_{\ne 0}$.
Then for $x \in \R$ such that $a x^2 + b x + c > 0$ and $x \ne 0$:
$\quad \ds \int \frac {\d x} {x \sqrt {a x^2 + b x + c} } = \begin {cases}
\dfrac {-1} {\sqrt c} \dfrac {\size x} x \ln \size {\dfrac {2 \sqrt c \sqrt {a x^2 + b x + c} + b x + 2 c} x} + C & : c > 0, b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {b x + 2 c} {\size x \sqrt {4 a c - b^2} } } + C & : c > 0, b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \dfrac {\size x} x \ln \size {\dfrac {2 c} x + b} + C & : c > 0, b^2 - 4 a c = 0 \\
\dfrac 1 {\sqrt {-c} } \map \arcsin {\dfrac {b x + 2 c} {\size x \sqrt {\size {b^2 - 4 a c} } } } & : c < 0, b^2 - 4 a c \ne 0  \\
\end {cases}$

Proof:
=== Lemma ===
{{:Primitive of Reciprocal of x by Root of a x squared plus b x plus c/Lemma}}{{qed|lemma}}
Let $x > 0$, and so $u > 0$.
Then we have:
:$\ds \int \frac {\d x} {x \sqrt {a x^2 + b x + c} } = -\int \frac {\d u} {\sqrt {a + b u + c u^2} }$
We consider the two cases where $c > 0$ and $c < 0$.
First we take $c > 0$.
Thus:
{{begin-eqn}}
{{eqn | l = -\int \frac {\d u} {\sqrt {a + b u + c u^2} }
      | r = <nowiki>\begin {cases}
\dfrac {-1} {\sqrt c} \ln \size {2 \sqrt c \sqrt {a + b u + c u^2} + 2 c u + b} + C & : b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {2 c u + b} {\sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \ln \size {2 c u + b} + C & : b^2 - 4 a c = 0
\end {cases}</nowiki>
      | c = Primitive of $\dfrac 1 {\sqrt {a x^2 + b x + c} }$
}}
{{eqn | ll= \leadsto
      | l = \int \frac {\d x} {x \sqrt {a x^2 + b x + c} }
      | r = <nowiki>\begin{cases}
\dfrac {-1} {\sqrt c} \ln \size {2 \sqrt c \sqrt {a + b \paren {\frac 1 x} + c \paren {\frac 1 x}^2} + 2 c \paren {\frac 1 x} + b} + C & : b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {2 c \paren {\frac 1 x} + b} {\sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \ln \size {2 c \paren {\frac 1 x} + b} + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = substituting for $u$
}}
{{eqn | r = <nowiki>\begin{cases}
\dfrac {-1} {\sqrt c} \ln \size {2 \sqrt c \sqrt {\dfrac {a x^2 + b x + c} {x^2} } + \dfrac {b x + 2 c} x} + C & : b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {b x + 2 c} {x \sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \ln \size {\dfrac {2 c} x + b} + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = simplifying
}}
{{eqn | r = <nowiki>\begin{cases}
\dfrac {-1} {\sqrt c} \ln \size {\dfrac {2 \sqrt c \sqrt {a x^2 + b x + c} + b x + 2 c} x} + C & : b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {b x + 2 c} {\size x \sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \ln \size {\dfrac {2 c} x + b} + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = 
}}
{{end-eqn}}
{{qed|lemma}}
Then we take $c < 0$.
Thus:
{{begin-eqn}}
{{eqn | l = -\int \frac {\d u} {\sqrt {a + b u + c u^2} }
      | r = -\dfrac {-1} {\sqrt {-c} } \map \arcsin {\dfrac {2 c u + b} {\sqrt {\size {b^2 - 4 a c} } } }
      | c = Primitive of $\dfrac 1 {\sqrt {a x^2 + b x + c} }$
}}
{{eqn | ll= \leadsto
      | l = \int \frac {\d x} {x \sqrt {a x^2 + b x + c} }
      | r = \dfrac 1 {\sqrt {-c} } \map \arcsin {\dfrac {2 c \paren {\frac 1 x} + b} {\sqrt {\size {b^2 - 4 a c} } } }
      | c = substituting for $u$
}}
{{eqn | r = \dfrac 1 {\sqrt {-c} } \map \arcsin {\dfrac {b x + 2 c} {x \sqrt {\size {b^2 - 4 a c} } } }
      | c = simplifying
}}
{{end-eqn}}
{{qed|lemma}}
Now we consider what happens when $x < 0$, and so $u < 0$.
We have:
{{begin-eqn}}
{{eqn | l = \int \frac {\d x} {x \sqrt {a x^2 + b x + c} }
      | r = -\int \frac {\d u} {-\sqrt {a + b u + c u^2} }
      | c = 
}}
{{eqn | r = \int \frac {\d u} {\sqrt {a + b u + c u^2} }
      | c = 
}}
{{end-eqn}}
which leads us to:
{{begin-eqn}}
{{eqn | l = \int \frac {\d u} {\sqrt {a + b u + c u^2} }
      | r = <nowiki>\begin {cases}
\dfrac 1 {\sqrt c} \ln \size {2 \sqrt c \sqrt {a + b u + c u^2} + 2 c u + b} + C & : b^2 - 4 a c > 0 \\
\dfrac 1 {\sqrt c} \map {\sinh^{-1} } {\dfrac {2 c u + b} {\sqrt{4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac 1 {\sqrt c} \ln \size {2 c u + b} + C & : b^2 - 4 a c = 0
\end {cases}</nowiki>
      | c = Primitive of $\dfrac 1 {\sqrt {a x^2 + b x + c} }$
}}
{{eqn | ll= \leadsto
      | l = \int \frac {\d x} {x \sqrt {a x^2 + b x + c} }
      | r = <nowiki>\begin{cases}
\dfrac 1 {\sqrt c} \ln \size {2 \sqrt c \sqrt {a + b \paren {\frac 1 x} + c \paren {\frac 1 x}^2} + 2 c \paren {\frac 1 x} + b} + C & : b^2 - 4 a c > 0 \\
\dfrac 1 {\sqrt c} \map {\sinh^{-1} } {\dfrac {2 c \paren {\frac 1 x} + b} {\sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac 1 {\sqrt c} \ln \size {2 c \paren {\frac 1 x} + b} + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = substituting for $u$
}}
{{eqn | r = <nowiki>\begin{cases}
\dfrac 1 {\sqrt c} \ln \size {2 \sqrt c \sqrt {\dfrac {a x^2 + b x + c} {x^2} } + \dfrac {b x + 2 c} x} + C & : b^2 - 4 a c > 0 \\
\dfrac 1 {\sqrt c} \map {\sinh^{-1} } {\dfrac {b x + 2 c} {x \sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac 1 {\sqrt c} \ln \size {\dfrac {2 c} x + b} + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = simplifying
}}
{{eqn | r = <nowiki>\begin{cases}
\dfrac {-1} {\sqrt c} \paren {-\ln \size {\dfrac {2 \sqrt c \sqrt {a x^2 + b x + c} + b x + 2 c} x} } + C & : b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {b x + 2 c} {\paren {-x} \sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \paren {-\ln \size {\dfrac {2 c} x + b} } + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = 
}}
{{eqn | r = <nowiki>\begin{cases}
\dfrac {-1} {\sqrt c} \dfrac {\size x} x \ln \size {\dfrac {2 \sqrt c \sqrt {a x^2 + b x + c} + b x + 2 c} x} + C & : b^2 - 4 a c > 0 \\
\dfrac {-1} {\sqrt c} \map {\sinh^{-1} } {\dfrac {b x + 2 c} {\size x \sqrt {4 a c - b^2} } } + C & : b^2 - 4 a c < 0 \\
\dfrac {-1} {\sqrt c} \dfrac {\size x} x \ln \size {\dfrac {2 c} x + b} + C & : b^2 - 4 a c = 0
\end{cases}</nowiki>
      | c = 
}}
{{end-eqn}}
{{qed|lemma}}
Finally we take $c < 0$.
Thus:
{{begin-eqn}}
{{eqn | l = \int \frac {\d u} {\sqrt {a + b u + c u^2} }
      | r = \dfrac {-1} {\sqrt {-c} } \map \arcsin {\dfrac {2 c u + b} {\sqrt {\size {b^2 - 4 a c} } } }
      | c = Primitive of $\dfrac 1 {\sqrt {a x^2 + b x + c} }$
}}
{{eqn | ll= \leadsto
      | l = \int \frac {\d x} {x \sqrt {a x^2 + b x + c} }
      | r = \dfrac {-1} {\sqrt {-c} } \map \arcsin {\dfrac {2 c \paren {\frac 1 x} + b} {\sqrt {\size {b^2 - 4 a c} } } }
      | c = substituting for $u$
}}
{{eqn | r = \dfrac 1 {\sqrt {-c} } \map \arcsin {\dfrac {b x + 2 c} {\paren {-x} \sqrt {\size {b^2 - 4 a c} } } }
      | c = simplifying
}}
{{eqn | r = \dfrac 1 {\sqrt {-c} } \map \arcsin {\dfrac {b x + 2 c} {\size x \sqrt {\size {b^2 - 4 a c} } } }
      | c = simplifying
}}
{{end-eqn}}
{{qed}}