Indefinite Integration

Evaluate $\displaystyle \int \left(3 x - 2\right) \sqrt{x^2 + x + 1} \;\; dx$


Let $I = \displaystyle \int \left(3 x - 2\right) \sqrt{x^2 + x + 1} \;\; dx$ $\;\;\; \cdots (1)$

$\begin{aligned} \text{Let } 3 x - 2 & = M \dfrac{d}{dx} \left(x^2 + x + 1\right) + N \\\\ & = M \left(2 x + 1\right) + N \;\;\; \cdots (2) \\\\ & = 2 \; M \; x + M + N \end{aligned}$

Comparing the coefficient of the x terms and the constant terms gives

$2 M = 3$ $\implies$ $M = \dfrac{3}{2}$

and $- 2 = M + N$ $\implies$ $N = - M - 2 = - \dfrac{3}{2} - 2 = \dfrac{- 7}{2}$

Substituting the values of M and N in equation (2) gives

$3 x - 2 = \dfrac{3}{2} \left(2 x + 1\right) - \dfrac{7}{2}$ $\;\;\; \cdots (2a)$

In view of equation (2a), equation (1) can be written as

$\begin{aligned} I & = \int \left[\dfrac{3}{2} \left(2 x + 1\right) - \dfrac{7}{2}\right] \sqrt{x^2 + x + 1} \; dx \\\\ & = \dfrac{3}{2} \int \left(2 x + 1\right) \sqrt{x^2 + x + 1} \; dx - \dfrac{7}{2} \int \sqrt{x^2 + x + 1} \; dx \\\\ & = \dfrac{3}{2} I_1 - \dfrac{7}{2} I_2 \;\;\; \cdots (3) \end{aligned}$

Consider $I_1 = \displaystyle \int \left(2 x + 1\right) \sqrt{x^2 + x + 1} \; dx$ $\;\;\; \cdots (4)$

Let $x^2 + x + 1 = u$ $\;\;\; \cdots (5a)$

Differentiating equation $(5a)$ gives

$\left(2 x + 1\right) \; dx = du$ $\;\;\; \cdots (5b)$

Substituting equations $(5a)$ and $(5b)$ in equation $(4)$ gives

$\begin{aligned} I_1 & = \int \sqrt{u} \; du \\\\ & = \dfrac{2}{3} u^{3/2} + c_1 \\\\ & = \dfrac{2}{3} \left(x^2 + x + 1\right)^{3/2} + c_1 \;\;\; \cdots (4a) \;\;\; \left[\text{From equation (5a)}\right] \end{aligned}$

$\begin{aligned} \text{Consider } I_2 & = \int \sqrt{x^2 + x + 1} \; dx \\\\ & = \int \sqrt{\left(x^2 + x + \dfrac{1}{4}\right) + 1 - \dfrac{1}{4}} \; dx \\\\ & = \int \sqrt{\left(x + \dfrac{1}{2}\right)^2 + \left(\dfrac{\sqrt{3}}{2}\right)^2} \; dx \\\\ & \left[\text{Note: } \int \sqrt{x^2 + a^2} = \dfrac{x}{2} \sqrt{x^2 + a^2} + \dfrac{a^2}{2} \log \left|x + \sqrt{x^2 + a^2}\right| + c \right] \\\\ & = \left(\dfrac{x + \dfrac{1}{2}}{2}\right) \sqrt{\left(x + \dfrac{1}{2}\right)^2 + \left(\dfrac{\sqrt{3}}{2}\right)^2} \\ & \hspace{6em} + \dfrac{\left(\sqrt{3} / 2\right)^2}{2} \log \left|x + \dfrac{1}{2} + \sqrt{\left(x + \dfrac{1}{2}\right)^2 + \left(\dfrac{\sqrt{3}}{2}\right)^2}\right| + c_2 \\\\ & = \left(\dfrac{2 x + 1}{4}\right) \sqrt{x^2 + x + 1} + \dfrac{3}{8} \log \left|x + \dfrac{1}{2} + \sqrt{x^2 + x + 1}\right| + c_2 \;\;\; \cdots (6) \end{aligned}$

In view of equations $(4a)$ and $(6)$, equation $(3)$ becomes

$I = \left(x^2 + x + 1\right)^{3/2} - \dfrac{7 \left(2 x + 1\right)}{8} \sqrt{x^2 + x + 1} - \dfrac{21}{16} \log \left|x + \dfrac{1}{2} + \sqrt{x^2 + x + 1}\right| + c$

where $c = \dfrac{3}{2} c_1 - \dfrac{7}{2} c_2$