Primitive of x squared by Power of a x + b

Theorem

 * $\displaystyle \int x^2 \left({a x + b}\right)^n \ \mathrm d x = \frac {\left({a x + b}\right)^{n + 3} } {\left({n + 3}\right) a^3} - \frac {2 b \left({a x + b}\right)^{n + 2} } {\left({n + 2}\right) a^3} + \frac {b^2 \left({a x + b}\right)^{n + 1} } {\left({n + 1}\right) a^3} + C$

where $n \notin \left\{{-1, -2, -3}\right\}$.

Proof
Let $u = a x + b$.

Then:

Then:

Also see

 * Primitive of $x^2$ over $a x + b$ for the case when $n = -1$
 * Primitive of $x^2$ over $\left({a x + b}\right)^2$ for the case when $n = -2$
 * Primitive of $x^2$ over $\left({a x + b}\right)^3$ for the case when $n = -3$