Theorem: Primitive of Reciprocal of Root of a x + b by Root of p x + q

Let $a, b, p, q \in \R$ such that $a p \ne b q$.
Then:
:<nowiki>$\ds \int \frac {\d x} {\sqrt {\paren {a x + b} \paren {p x + q} } } = \begin {cases}
\dfrac 2 {\sqrt {-a p} } \map \arctan {\sqrt {\dfrac {-p \paren {a x + b} } {a \paren {p x + q} } } } + C & : a p < 0 \\ \\
\dfrac {-1} {\sqrt {-a p} } \map \arcsin {\dfrac {2 a p x + b p + a q} {a q - b p} } + C & : a > 0, p < 0 \\ \\
\ds \dfrac 2 {\sqrt {a p} } \ln \size {\sqrt {p \paren {a x + b} } + \sqrt {a \paren {p x + q} } } + C & : a p > 0
\end {cases}$</nowiki>
for all $x \in \R$ such that $\paren {a x + b} \paren {p x + q} > 0$.

Proof:
First let us express the integrand in the following form:
{{begin-eqn}}
{{eqn | n = 1
      | l = \int \frac {\d x} {\sqrt {\paren {a x + b} \paren {p x + q} } }
      | r = \int \frac {\d x} {\sqrt {a p \paren {x - \paren {-\frac b a} } \paren {x - \paren {-\frac q p} } } }
      | c = 
}}
{{end-eqn}}
Recall the definition of Euler's third substitution:
{{:Definition:Euler's Third Substitution}}
In this context we have:
{{begin-eqn}}
{{eqn | l = a
      | o = \gets
      | r = a p
}}
{{eqn | l = \alpha
      | o = \gets
      | r = -\frac b a
}}
{{eqn | l = \beta
      | o = \gets
      | r = -\frac q p
}}
{{end-eqn}}
Hence we make the substitution:
{{begin-eqn}}
{{eqn | l = x
      | r = \dfrac {a p \paren {-\frac q p} - \paren {-\frac b a} t^2} {a p - t^2}
      | c = {{Lemma|Lemmata for Euler's Third Substitution|1|proof = yes}}
}}
{{eqn | r = \dfrac {-a q + \paren {\frac b a} t^2} {a p - t^2}
      | c = simplifying
}}
{{eqn | r = \dfrac {a^2 q - b t^2} {a \paren {t^2 - a p} }
      | c = multiplying top and bottom by $-a$
}}
{{end-eqn}}
Then we use:
{{begin-eqn}}
{{eqn | ll= \leadsto
      | l = x - \alpha
      | r = \dfrac {a \paren {\alpha - \beta} } {t^2 - a}
      | c = {{Lemma|Lemmata for Euler's Third Substitution|2|proof = yes}}
}}
{{eqn | r = \dfrac {a p \paren {\paren {-\frac b a} - \paren {-\frac q p} } } {t^2 - a p}
      | c = substituting $a \gets a p$, $\alpha \gets -\dfrac b a$, $\beta \gets -\dfrac q p$
}}
{{eqn | n = 1
      | ll= \leadsto
      | l = x - \alpha
      | r = \dfrac {a q - p b} {t^2 - a p}
      | c = simplifying
}}
{{end-eqn}}
Then:
{{begin-eqn}}
{{eqn | l = \dfrac {\d x} {\d t}
      | r = \dfrac {2 t a \paren {\beta - \alpha} } {\paren {a - t^2}^2}
      | c = {{Lemma|Lemmata for Euler's Third Substitution|3|proof = yes}}
}}
{{eqn | r = \dfrac {2 t a p \paren {\paren {-\frac q p} - \paren {-\frac b a} } } {\paren {a p - t^2}^2}
      | c = substituting $a \gets a p$, $\alpha \gets -\dfrac b a$, $\beta \gets -\dfrac q p$
}}
{{eqn | ll= \leadsto
      | l = \dfrac {\d x} {\d t}
      | r = \dfrac {2 t \paren {b p - a q} } {\paren {t^2 - a p}^2}
      | c = simplifying
}}
{{end-eqn}}
Then:
{{begin-eqn}}
{{eqn | l = t
      | r = \sqrt {\dfrac {a \paren {x - \beta} } {x - \alpha} }
      | c = {{Lemma|Lemmata for Euler's Third Substitution|4|proof = yes}}
}}
{{eqn | r = \sqrt {\dfrac {a p \paren {x - \paren {-\frac q p} } } {x - \paren {-\frac b a} } }
      | c = substituting $a \gets a p$, $\alpha \gets -\dfrac b a$, $\beta \gets -\dfrac q p$
}}
{{eqn | r = \sqrt {\dfrac {a p \paren {x + \frac q p} } {x + \frac b a} }
      | c = rearranging
}}
{{eqn | r = \sqrt {\dfrac {a^2 \paren {p x + q} } {a x + b} }
      | c = rearranging
}}
{{eqn | n = 2
      | ll= \leadsto
      | l = t
      | r = a \sqrt {\dfrac {p x + q} {a x + b} }
      | c = simplifying
}}
{{end-eqn}}
Assembling the pieces:
{{begin-eqn}}
{{eqn | ll= \leadsto
      | l = \int \frac {\d x} {\sqrt {\paren {a x + b} \paren {p x + q} } }
      | r = \int \frac {\d t} {\paren {\dfrac {a q - p b} {t^2 - a p} } t} \dfrac {2 t \paren {b p - a q} } {\paren {t^2 - a p}^2}
      | c = Integration by Substitution, using $\sqrt {\paren {a x + b} \paren {p x + q} } = \paren {x - \alpha} t$
}}
{{eqn | r = \int \frac {t^2 - a p} {\paren {a q - p b} t} \cdot \dfrac {-2 t \paren {a q - b p} } {\paren {t^2 - a p}^2} \rd t
      | c = simplifying
}}
{{eqn | r = -2 \int \dfrac {\d t} {\paren {t^2 - a p} }
      | c = simplifying
}}
{{eqn | r = -2 \int \dfrac {\d t} {\paren {t^2 + \paren {-a p} } }
      | c = as $a p < 0$ {{hypothesis}}
}}
{{eqn | r = \dfrac {-2} {\sqrt {-a p} } \map \arctan {\dfrac t {\sqrt {-a p} } } + C
      | c = Primitive of $\dfrac 1 {x^2 + a^2}$: Arctangent Form
}}
{{eqn | r = \dfrac {-2} {\sqrt {-a p} } \map \arctan {\dfrac {a \sqrt {\frac {p x + q} {a x + b} } } {\sqrt {-a p} } } + C
      | c = substituting for $t$ from $(2)$
}}
{{eqn | r = \dfrac {-2} {\sqrt {-a p} } \map \arctan {\sqrt {\dfrac {-a \paren {p x + q} } {p \paren {a x + b} } } } + C
      | c = 
}}
{{eqn | r = \dfrac {-2} {\sqrt {-a p} } \map \arccot {\sqrt {\dfrac {-p \paren {a x + b} } {a \paren {p x + q} } } } + C
      | c = Arccotangent of Reciprocal equals Arctangent
}}
{{eqn | r = \dfrac {-2} {\sqrt {-a p} } \paren {\dfrac \pi 2 - \map \arctan {\sqrt {\dfrac {-p \paren {a x + b} } {a \paren {p x + q} } } } }  + C
      | c = Sum of Arctangent and Arccotangent
}}
{{eqn | r = \dfrac 2 {\sqrt {-a p} } \paren {\map \arctan {\sqrt {\dfrac {-p \paren {a x + b} } {a \paren {p x + q} } } } - \dfrac \pi 2} + C
      | c = Arctangent is Odd Function
}}
{{eqn | r = \dfrac 2 {\sqrt {-a p} } \map \arctan {\sqrt {\dfrac {-p \paren {a x + b} } {a \paren {p x + q} } } } + C
      | c = subsuming $\dfrac 2 {\sqrt {-a p} } \times \dfrac {-\pi} 2$ into the arbitrary constant
}}
{{end-eqn}}
{{qed}}