Evaluate $\displaystyle \int \left(x - 5\right) \sqrt{x^2 + x} \; dx$
Let $I = \displaystyle \int \left(x - 5\right) \sqrt{x^2 + x} \; dx$ $\;\;\; \cdots \; (1)$
Let $x - 5 = M \; \dfrac{d}{dx} \left(x^2 + x\right) + N$ $\;\;\; \cdots \; (2)$
i.e. $x - 5 = M \left(2 x + 1\right) + N$
i.e. $x - 5 = 2 M x + \left(M + N\right)$
Comparing the coefficients of the $x$ term gives
$1 = 2 M$ $\implies$ $M = \dfrac{1}{2}$ $\;\;\; \cdots \; (3a)$
Comparing the constant term gives
$- 5 = M + N$
$\implies$ $N = - M - 5 = \dfrac{-1}{2} - 5 = \dfrac{-11}{2}$ $\;\;\; \cdots \; (3b)$ $\;\;\;
$ [by equation $(3a)$]
In view of equations $(3a)$ and $(3b)$, equation $(2)$ can be written as
$x - 5 = \dfrac{1}{2} \left(2 x + 1\right) - \dfrac{11}{2}$ $\;\;\; \cdots \; (4)$
$\therefore$ $\;$ In view of equation $(4)$, equation $(1)$ becomes
$\begin{aligned}
I & = \int \left[\dfrac{1}{2} \left(2x + 1\right) - \dfrac{11}{2}\right] \sqrt{x^2 + x} \; dx \\\\
& = \dfrac{1}{2} \int \left(2 x + 1\right) \sqrt{x^2 + x} \; dx - \dfrac{11}{2} \int \sqrt{x^2 + x} \; dx \;\;\; \cdots \; (5)
\end{aligned}$
Let $I_1 = \dfrac{1}{2} \displaystyle \int \left(2 x + 1\right) \sqrt{x^2 + x} \; dx$ $\;\;\; \cdots \; (6)$
Let $x^2 + x = t$ $\;\;\; \cdots \; (6a)$
Differentiating equation $(6a)$ gives
$\left(2 x + 1\right) \; dx = dt$ $\;\;\; \cdots \; (6b)$
$\therefore$ $\;$ In view of equations $(6a)$ and $(6b)$, equation $(6)$ becomes
$\begin{aligned}
I_1 & = \dfrac{1}{2} \int \sqrt{t} \; dt \\\\
& = \dfrac{1}{2} \times t^{3/2} \times \dfrac{2}{3} + c_1 \\\\
& = \dfrac{1}{3} t^{3/2} + c_1 \\\\
& = \dfrac{1}{3} \left(x^2 + x\right)^{3/2} + c_1 \;\;\; \cdots \; (7) \;\;\; \left[\text{from equation }(6a)\right]
\end{aligned}$
$\begin{aligned}
\text{Let } I_2 & = - \dfrac{11}{2} \int \left(2x + 1\right) \sqrt{x^2 + x} \; dx \\\\
& = - \dfrac{11}{2} \int \sqrt{\left(x^2 + x + \dfrac{1}{4}\right) - \dfrac{1}{4}} \; dx \\\\
& = - \dfrac{11}{2} \int \sqrt{\left(x + \dfrac{1}{2}\right)^2 - \left(\dfrac{1}{2}\right)^2} \; dx \\\\
& \left[\text{Note: } \int \sqrt{x^2 - a^2} \; dx = \dfrac{x}{2} \sqrt{x^2 - a^2} - \dfrac{a^2}{2} \log \left|x + \sqrt{x^2 - a^2}\right| + c\right] \\\\
\therefore \; I_2 & = \dfrac{-11}{2} \left(\dfrac{x + \dfrac{1}{2}}{2}\right) \sqrt{\left(x + \dfrac{1}{2}\right)^2 - \left(\dfrac{1}{2}\right)^2} \\
& \hspace{5em} + \dfrac{11}{2} \times \dfrac{\left(1/2\right)^2}{2} \log \left|\left(x + \dfrac{1}{2}\right) + \sqrt{\left(x - \dfrac{1}{2}\right)^2 - \left(\dfrac{1}{2}\right)^2}\right| + c_2 \\\\
& = \dfrac{-11}{2} \left[\left(\dfrac{2x + 1}{4}\right) \sqrt{x^2 + x} - \dfrac{1}{8} \log \left|\dfrac{2x + 1}{2} + \sqrt{x^2 + x}\right|\right] + c_2 \\\\
& = \dfrac{-11}{8} \left(2 x + 1\right) \sqrt{x^2 + x} + \dfrac{11}{16} \log \left|\dfrac{2x + 1}{2} + \sqrt{x^2 + x}\right| + c_2 \;\;\; \cdots \; (8)
\end{aligned}$
$\therefore$ $\;$ In view of equations $(7)$ and $(8)$, equation $(5)$ becomes
$I = \dfrac{1}{3} \left(x^2 + x\right)^{3/2} - \dfrac{11}{8} \left(2x + 1\right) \sqrt{x^2 + x} + \dfrac{11}{16} \log \left|\dfrac{2x + 1}{2} + \sqrt{x^2 + x}\right| + c$
where $c = c_1 + c_2$