Primitive of x squared over a x + b squared by p x + q

Theorem

 * $\ds \int \frac {x^2 \rd x} {\paren {a x + b}^2 \paren {p x + q} } = \frac {b^2} {\paren {b p - a q} a^2 \paren {a x + b} } + \frac 1 {\paren {b p - a q}^2} \paren {\frac {q^2} p \ln \size {p x + q} + \frac {b \paren {b p - 2 a q} } {a^2} \ln \size {a x + b} } + C$

Proof
We have:

Therefore: