Theorem: Primitive of x squared by Root of a x squared plus b x plus c

Let $a \in \R_{\ne 0}$.
Then:
:$\ds \int x^2 \sqrt {a x^2 + b x + c} \rd x = \frac {6 a x - 5 b} {24 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {5 b^2 - 4 a c} {16 a^2} \int \sqrt {a x^2 + b x + c} \rd x$

Proof:
{{begin-eqn}}
{{eqn | o = 
      | r = \int x^2 \sqrt {a x^2 + b x + c} \rd x
}}
{{eqn | r = \int \frac {2 a x^2} {2 a} \sqrt {a x^2 + b x + c} \rd x
      | c = multiplying top and bottom by $2 a$
}}
{{eqn | r = \int \frac {x \paren {2 a x + b - b} } {2 a} \sqrt {a x^2 + b x + c} \rd x
}}
{{eqn | n = 1
      | r = \frac 1 {2 a} \int x \paren {2 a x + b} \sqrt {a x^2 + b x + c} \rd x - \frac b {2 a} \int x \sqrt {a x^2 + b x + c} \rd x
      | c = Linear Combination of Primitives
}}
{{end-eqn}}
Let:
{{begin-eqn}}
{{eqn | l = z
      | r = a x^2 + b x + c
}}
{{eqn | ll= \leadsto
      | l = \frac {\d z} {\rd x}
      | r = 2 a x + b
      | c = Derivative of Power
}}
{{eqn | ll= \leadsto
      | l = \int \paren {2 a x + b} \sqrt {a x^2 + b x + c} \rd x
      | r = \int \sqrt z \rd z
      | c = Integration by Substitution
}}
{{eqn | r = \frac {2 \paren {\sqrt z}^3} 3
      | c = Primitive of Power
}}
{{eqn | n = 2
      | r = \frac {2 \paren {\sqrt {a x^2 + b x + c} }^3} 3
      | c = substituting for $z$
}}
{{end-eqn}}
With a view to expressing the primitive $\ds \int x \paren {2 a x + b} \sqrt {a x^2 + b x + c} \rd x$ in the form:
:$\ds \int u \frac {\d v} {\d x} \rd x = u v - \int v \frac {\d u} {\d x} \rd x$
let:
{{begin-eqn}}
{{eqn | l = u
      | r = x
      | c = 
}}
{{eqn | ll= \leadsto
      | l = \frac {\d u} {\d x}
      | r = 1
      | c = Derivative of Identity Function
}}
{{end-eqn}}
and let:
{{begin-eqn}}
{{eqn | l = \frac {\d v} {\d x}
      | r = \int \paren {2 a x + b} \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | ll= \leadsto
      | l = v
      | r = \frac {2 \paren {\sqrt {a x^2 + b x + c} }^3} 3
      | c = from $(2)$ above
}}
{{end-eqn}}
Then:
{{begin-eqn}}
{{eqn | r = \int x \paren {2 a x + b} \sqrt {a x^2 + b x + c} \rd x
      | o = 
      | c = 
}}
{{eqn | r = x \paren {\frac {2 \paren {\sqrt {a x^2 + b x + c} }^3} 3} - \int \paren {\frac {2 \paren {\sqrt {a x^2 + b x + c} }^3} 3} \times 1 \rd x + C
      | c = Integration by Parts
}}
{{eqn | n = 3
      | r = \frac {2 x \paren {\sqrt {a x^2 + b x + c} }^3} 3 - \frac 2 3 \int \paren {\sqrt {a x^2 + b x + c} }^3 \rd x + C
      | c = simplifying
}}
{{end-eqn}}
Now consider:
{{begin-eqn}}
{{eqn | r = \int \paren {\sqrt {a x^2 + b x + c} }^3 \rd x
      | o = 
      | c = 
}}
{{eqn | r = \int \paren {a x^2 + b x + c} \sqrt {a x^2 + b x + c} \rd x
      | c = factorising
}}
{{eqn | n = 4
      | r = a \int x^2 \sqrt {a x^2 + b x + c} \rd x + b \int x \sqrt {a x^2 + b x + c} \rd x + c \int \sqrt {a x^2 + b x + c} \rd x
      | c = Linear Combination of Primitives
}}
{{end-eqn}}
Thus:
{{begin-eqn}}
{{eqn | o = 
      | r = \int x^2 \sqrt {a x^2 + b x + c} \rd x
}}
{{eqn | r = \frac 1 {2 a} \int x \paren {2 a x + b} \sqrt {a x^2 + b x + c} \rd x - \frac b {2 a} \int x \sqrt {a x^2 + b x + c} \rd x
      | c = from $(1)$
}}
{{eqn | r = \frac 1 {2 a} \paren {\frac {2 x \paren {\sqrt {a x^2 + b x + c} }^3} 3 - \frac 2 3 \int \paren {\sqrt {a x^2 + b x + c} }^3 \rd x}
      | c = from $(3)$
}}
{{eqn | o = 
      | ro= -
      | r = \frac b {2 a} \paren {\frac {\paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac b {2 a} \int \sqrt {a x^2 + b x + c} \rd x}
      | c = Lemma for Primitive of $x \sqrt {a x^2 + b x + c}$
}}
{{eqn | r = \frac {x \paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac 1 {3 a} \int \paren {\sqrt {a x^2 + b x + c} }^3 \rd x
      | c = simplifying
}}
{{eqn | o = 
      | ro= -
      | r = \frac b {6 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {b^2} {4 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | r = \frac {x \paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac b {6 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {b^2} {4 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | o = 
      | ro= -
      | r = \frac 1 {3 a} \paren {a \int x^2 \sqrt {a x^2 + b x + c} \rd x + b \int x \sqrt {a x^2 + b x + c} \rd x + c \int \sqrt {a x^2 + b x + c} \rd x}
      | c = from $(4)$
}}
{{eqn | r = \frac {x \paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac b {6 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {b^2} {4 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = simplifying
}}
{{eqn | o = 
      | ro= -
      | r = \frac 1 3 \int x^2 \sqrt {a x^2 + b x + c} \rd x - \frac b {3 a} \int x \sqrt {a x^2 + b x + c} \rd x - \frac c {3 a} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | r = \frac {x \paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac b {6 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {b^2} {4 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | o = 
      | ro= -
      | r = \frac 1 3 \int x^2 \sqrt {a x^2 + b x + c} \rd x - \frac c {3 a} \int \sqrt {a x^2 + b x + c} \ rd x
      | c = 
}}
{{eqn | o = 
      | ro= -
      | r = \frac b {3 a} \paren {\frac {\paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac b {2 a} \int \sqrt {a x^2 + b x + c} \rd x}
      | c = Lemma for Primitive of $x \sqrt {a x^2 + b x + c}$
}}
{{eqn | r = \frac {x \paren {\sqrt {a x^2 + b x + c} }^3} {3 a} - \frac b {6 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {b^2} {4 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = simplifying
}}
{{eqn | o = 
      | ro= -
      | r = \frac 1 3 \int x^2 \sqrt {a x^2 + b x + c} \rd x - \frac c {3 a} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | o = 
      | ro= -
      | r = \frac {b \paren {\sqrt {a x^2 + b x + c} }^3} {9 a^2} + \frac {b^2} {6 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | r = \paren {\frac x {3 a} - \frac b {6 a^2} - \frac b {9 a^2} } \paren {\sqrt {a x^2 + b x + c} }^3
      | c = gathering terms
}}
{{eqn | o = 
      | ro= +
      | r = \paren {\frac {b^2} {4 a^2} - \frac c {3 a} + \frac {b^2} {6 a^2} } \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | o = 
      | ro= -
      | r = \frac 1 3 \int x^2 \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{end-eqn}}
Hence:
{{begin-eqn}}
{{eqn | r = \int x^2 \sqrt {a x^2 + b x + c} \rd x + \frac 1 3 \int x^2 \sqrt {a x^2 + b x + c} \rd x
      | o = 
      | c = 
}}
{{eqn | r = \paren {\frac {6 a x} {18 a^2} - \frac {3 b} {18 a^2} - \frac {2 b} {18 a^2} } \paren {\sqrt {a x^2 + b x + c} }^3
      | c = 
}}
{{eqn | o = 
      | ro= +
      | r = \paren {\frac {3 b^2} {12 a^2} - \frac {4 a c} {12 a^2} + \frac {2 b^2} {12 a^2} } \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | ll= \leadsto
      | l = \frac 4 3 \int x^2 \sqrt {a x^2 + b x + c} \rd x
      | r = \frac {6 a x - 5 b} {18 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {5 b^2 - 4 a c} {12 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = 
}}
{{eqn | ll= \leadsto
      | l = \int x^2 \sqrt {a x^2 + b x + c} \rd x
      | r = \frac {6 a x - 5 b} {24 a^2} \paren {\sqrt {a x^2 + b x + c} }^3 + \frac {5 b^2 - 4 a c} {16 a^2} \int \sqrt {a x^2 + b x + c} \rd x
      | c = multiplying by $\dfrac 3 4$
}}
{{end-eqn}}
{{qed}}