Solving $\int \frac{6x^{3}+7x^2-12x+1}{\sqrt{x^2+4x+6}}dx$ I have previously asked here the following integral:$$\int \frac{6x^{3}+7x^2-12x+1}{\sqrt{x^2+4x+6}}dx.$$
In the meantime I have received an answer from Achille Hui here, but
there are still some points that I don't understand from his answer.

At some point there is:


*

*Set $B(y)$ to $ay^2 + by + c$, RHS($*1$) becomes $(6-3a)y^3 + \cdots$. We should fix $a$ to $2$.


*Repeat this procedure once more, we find $c$ should be fixed to $24$.

I don't understand how does he fix these numbers? Does he let them equal $0$ to obtain the final result?
 A: I have used a slightly different approach using a substitution. This makes the integral into a routine computational effort.
$$I = \int \frac{6x^{3}+7x^2-12x+1}{\sqrt{x^2+4x+6}}dx$$
$$ = \int \frac{6x^{3}+7x^2-12x+1}{\sqrt{(x+2)^2+2}}dx$$
Let $x + 2 = \sqrt2\tan\theta \implies dx = \sqrt2\sec^2\theta\ d\theta\text{ and } x=\sqrt2\tan\theta-2$
$$\implies I = \int\frac{12\sqrt2\tan^3\theta -58\tan^2\theta+32\sqrt2\tan\theta+5}{\sqrt2\sec\theta}\sqrt2\sec^2\theta\ d\theta$$
$$= \int (12\sqrt2\tan^3\theta\sec\theta -58\tan^2\theta\sec\theta+32\sqrt2\tan\theta\sec\theta+5\sec\theta)\ d\theta$$

$$ = \color{red}{12\sqrt2\int (\sec^2\theta-1)\tan\theta\sec\theta\ d\theta} - \color{green}{58\int(\sec^2\theta-1)\sec\theta\ d\theta} + 32\sqrt2\int\tan\theta\sec\theta\ d\theta + 5\int\sec\theta\ d\theta$$
$$ = \color{red}{12\sqrt2\int (\sec^2\theta)\tan\theta\sec\theta\ d\theta -12\sqrt2\int\tan\theta\sec\theta\ d\theta} - \color{green}{58\int(\sec^2\theta)\sec\theta\ d\theta +\underline{58\int\sec\theta\ d\theta}} + 32\sqrt2\int\tan\theta\sec\theta\ d\theta + \underline{5\int\sec\theta\ d\theta}$$
$$ = 12\sqrt2\left(\frac{\sec^3\theta}{3} -\sec\theta\right) - 58\int\sec^3\theta\ d\theta + 32\sqrt2\sec\theta + 63\int\sec\theta\ d\theta$$
$$ = 4\sqrt2\sec^3\theta + 20\sqrt2\sec\theta - 58\int\sec^3\theta\ d\theta+ 63\int\sec\theta\ d\theta$$
$$ = 4\sqrt2\sec^3\theta + 20\sqrt2\sec\theta \color{green}{- 29}\left(\sec\theta\tan\theta + \color{green}{\ln(\sec\theta+\tan\theta)}\right) + \color{green}{63\ln(\sec\theta+\tan\theta)}$$
Using $\ln(z+\sqrt{z^2+1}) = \sinh^{-1}z$, we get
$$I = 4\sqrt2\sec\theta\left(\sec^2\theta + 5 -\frac{29}{4\sqrt2}\tan\theta\right) + \color{green}{34\sinh^{-1}(\tan\theta)}$$

Using $\tan\theta = \dfrac{x+2}{\sqrt2}\text{ and } \sec\theta = \dfrac{\sqrt{x^2+4x+6}}{\sqrt2}$, we get
$$I = 4\sqrt{x^2+4x+6}\left(\frac{x^2+4x+6}{2} + 5 - \frac{29}{4\sqrt2}\frac{x+2}{\sqrt2}\right) + 34\sinh^{-1}\left(\frac{x+2}{\sqrt2}\right)$$
$$ = \sqrt{x^2+4x+6}\left(2x^2+8x+12+20-\frac{29}{2}x-29\right) + 34\sinh^{-1}\left(\frac{x+2}{\sqrt2}\right)$$
$$ = \boxed{\sqrt{x^2+4x+6}\left(2x^2-\frac{13}{2}x+3\right) + 34\sinh^{-1}\left(\frac{x+2}{\sqrt2}\right)}$$
