Primitive of x squared over a x + b squared by p x + q/Partial Fraction Expansion

Lemma for Primitive of $\dfrac {x^2} {\left({a x + b}\right)^2 \left({p x + q}\right)}$

 * $\dfrac {x^2} {\left({a x + b}\right)^2 \left({p x + q}\right)} \equiv \dfrac {b \left({b p - 2 a q}\right)} {a \left({a x + b}\right)} + \dfrac {-b^2} {a \left({b p - a q}\right) \left({a x + b}\right)^2} + \dfrac {q^2} {\left({b p - a q}\right)^2 \left({p x + q}\right)}$

Proof
Setting $a x + b = 0$ in $(1)$:

Setting $p x + q = 0$ in $(1)$:

Equating $2$nd powers of $x$ in $(1)$:

Summarising:

Hence the result.