TITLE: Find a mistake in integration
QUESTION [7 upvotes]: So, the integral is:
$$I=\int \frac{3x+5}{x^2+4x+8}dx$$
and here is how I did it, but in the end, I got a wrong result:
$$x^2+4x+8=(x+2)^2+4=4\bigg[\bigg(\frac{x+2}{2}\bigg)^2+1\bigg]$$
$$I=\frac{1}{4} \int \frac{3x+5}{\big(\frac{x+2}{2}\big)^2+1}dx$$
substitution: $\frac{x+2}{2}=u$, $dx=2du$, $x=2u-2$
$$I=\frac{1}{2}\int\frac{3(2u-2)+5}{u^2+1}du=\frac{1}{2}\int\frac{6u-1}{u^2+1}du=$$
$$\frac{3}{2}\int\frac{2u-\frac{1}{3}}{u^2+1}du=\frac{3}{2}\int\frac{2u}{u^2+1}du-\frac{1}{2}\int\frac{du}{u^2+1}=$$
$$\frac{3}{2}\ln|u^2+1|-\frac{1}{2}\arctan(u)+C$$
$$I=\frac{3}{2}\ln\bigg|\frac{x^2+4x+8}{4}\bigg|-\frac{1}{2}\arctan\bigg(\frac{x+2}{2}\bigg)+C$$
Thank you for your time.

REPLY [2 votes]: You're doing good. Maybe some passages can be done more easily (at least according to my tastes):
\begin{align}
\int\frac{3x+5}{x^2+4x+8}\,dx
&=\frac{1}{2}\int\frac{6x+10}{x^2+4x+8}\,dx\\[6px]
&=\frac{1}{2}\int\frac{6x+12-2}{x^2+4x+8}\,dx\\[6px]
&=\frac{3}{2}\int\frac{2x+4}{x^2+4x+8}\,dx-
  \int\frac{1}{x^2+4x+8}\,dx
\end{align}
The first integral can be written directly as
$$
\frac{3}{2}\log(x^2+4x+8)
$$
and for the second one can do like you did, that is, $2t=x+2$, so $dx=2dt$ and the integral becomes
$$
\int\frac{2}{4t^2+4}=\frac{1}{2}\arctan t=\frac{1}{2}\arctan\frac{x+2}{2}
$$
By delaying the completion of the square we have to deal with less fractions.

Note that
$$
\log\frac{x^2+4x+8}{4}=-\log4+\log(x^2+4x+8),
$$
so the result is the same as yours, because a constant can be absorbed in the constant of integration.