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

:$\ds \int \frac {x \rd x} {\sqrt {\paren {a x + b} \paren {p x + q} } } = \frac {\sqrt {\paren {a x + b} \paren {p x + q} } } {a p} - \frac {b p + a q} {2 a p} \int \frac {\d x} {\sqrt {\paren {a x + b} \paren {p x + q} } }$

Proof:
Let:
{{begin-eqn}}
{{eqn | l = u
      | r = \sqrt {a x + b}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = x
      | r = \frac {u^2 - b} a
      | c = 
}}
{{eqn | ll= \leadsto
      | l = \sqrt {p x + q}
      | r = \sqrt {p \paren {\frac {u^2 - b} a} + q}
      | c = 
}}
{{eqn | r = \sqrt {\frac {p \paren {u^2 - b} + a q} a}
      | c = 
}}
{{eqn | r = \sqrt {\frac {p u^2 - b p + a q} a}
      | c = 
}}
{{eqn | n = 1
      | r = \sqrt {\frac p a} \sqrt {u^2 - \paren {\frac {b p - a q} p} }
      | c = 
}}
{{end-eqn}}
Let $c^2 = \dfrac {b p - a q} p$.
Then:
{{begin-eqn}}
{{eqn | o = 
      | r = \int \frac {x \rd x} {\sqrt {\paren {a x + b} \paren {p x + q} } }
}}
{{eqn | r = \int \frac {2 u} a \paren {\frac {u^2 - b} a} \frac {\d u} {u \sqrt {\frac p a} \sqrt {u^2 - c^2} }
      | c = Primitive of Function of $\sqrt {a x + b}$
}}
{{eqn | r = \frac 2 {a \sqrt {a p} } \int \frac {u^2 \rd u} {\sqrt {u^2 - c^2} } - \frac {2 b} {a \sqrt {a p} } \int \frac {\d u} {\sqrt {u^2 - c^2} }
      | c = Linear Combination of Primitives
}}
{{eqn | r = \frac 2 {a \sqrt {a p} } \paren {\frac {u \sqrt {u^2 - c^2} } 2 + \frac {c^2} 2 \map \ln {u + \sqrt {u^2 - c^2} } }
      | c = Primitive of $\dfrac {x^2} {\sqrt {x^2 - a^2} }$
}}
{{eqn | ro= -
      | r = \frac {2 b} {a \sqrt {a p} } \map \ln {u + \sqrt {u^2 - c^2} }
      | c = ... and Primitive of $\dfrac 1 {\sqrt {x^2 - a^2} }$: Logarithm Form
}}
{{eqn | r = \frac 2 {a \sqrt {a p} } \paren {\frac {u \sqrt {u^2 - c^2} } 2 + \paren {\frac {c^2} 2 - b} \map \ln {u + \sqrt {u^2 - c^2} } }
      | c = common factor
}}
{{eqn | r = \frac 2 {a \sqrt {a p} } \paren {\frac {\sqrt {a x + b} \sqrt {\frac a p} \sqrt {p x + q} } 2 + \paren {\frac {c^2} 2 - b} \map \ln {\sqrt {a x + b} + \sqrt {\frac a p} \sqrt {p x + q} } }
      | c = substituting for $u$, noting that $\sqrt {p x + q} = \sqrt {\dfrac p a} \sqrt {u^2 - c^2}$
}}
{{eqn | r = \frac {\sqrt {\paren {a x + b} \paren {p x + q} } } {a p} + \paren {\frac {b p - a q} {a p \sqrt {a p} } - \frac {2 b} {a \sqrt {a p} } } \map \ln {\frac {\sqrt {p \paren {a x + b} } + \sqrt {a \paren {p x + q} } } {\sqrt p} }
      | c = substituting for $c^2$ and simplifying
}}
{{eqn | r = \frac {\sqrt {\paren {a x + b} \paren {p x + q} } } {a p} + \paren {\frac {b p - a q - 2 b p} {a p \sqrt {a p} } } \map \ln {\frac {\sqrt {p \paren {a x + b} } + \sqrt {a \paren {p x + q} } } {\sqrt p} }
      | c = common denominator
}}
{{eqn | r = \frac {\sqrt {\paren {a x + b} \paren {p x + q} } } {a p} - \paren {\frac {b p + a q} {a p \sqrt {a p} } } \frac {\sqrt {a p} } 2 \int \frac {\d x} {\sqrt {\paren {a x + b} \paren {p x + q} } }
      | c = Primitive of Reciprocal of $\sqrt {\paren {a x + b} \paren {p x + q} }$
}}
{{eqn | r = \frac {\sqrt {\paren {a x + b} \paren {p x + q} } } {a p} - \paren {\frac {b p + a q} {2 a p} } \int \frac {\d x} {\sqrt {\paren {a x + b} \paren {p x + q} } }
      | c = simplifying
}}
{{end-eqn}}
{{qed}}
{{improve|This is messy -- open to anyone else to write a better version}}