$$\int \frac{e^{2x}-2}{e^{2x}+7}\,\Bbb dx$$
I was trying:
$$\int \frac{e^{2x}}{e^{2x}+7}\,\Bbb dx -2\int \frac{1}{e^{2x}+7}\,\Bbb dx$$
$$= \frac{1}{2}\ln|e^{2x}+7| -2\int \frac{1}{(e^x)^2+(\sqrt{7})^2}\,\Bbb dx$$
$$= \frac{1}{2}\ln|e^{2x}+7|+ \frac{-2}{\sqrt{7}} \arctan\left(\frac{e^x}{\sqrt{7}}\right) +c.$$
However, the book answer says:
$$\frac{9}{14}\ln \left|e^{2x}+7\right|-\frac{2x}{7}+C.$$
Where is my mistake?
You don't want to split it up like you did. Instead, think of $ - 2 $ and $ 7 $ as the leading terms (which they are as $ x \to - \infty $), and do long division: $$ \array { & \; - \frac 2 7 \hfil \\ 7 + \mathrm e ^ { 2 x } \! \! \! \! \! & ) \overline { - 2 + \mathrm e ^ { 2 x } } \hfil \\ & \quad \underline { 2 + \frac 2 7 \mathrm e ^ { 2 x } } \hfil \\ & \qquad \quad \! \frac 9 7 \mathrm e ^ { 2 x } \hfil } $$ so $$ \frac { - 2 + \mathrm e ^ { 2 x } } { 7 + \mathrm e ^ { 2 x } } = - \frac 2 7 + \frac { \frac 9 7 \mathrm e ^ { 2 x } } { 7 + \mathrm e ^ { 2 x } } \text . $$ This is how you want to split it up. The first term here gives you the $ - \frac 2 7 x $, and the second term gives you the $ \frac 9 { 1 4 } \ln ( \mathrm e ^ { 2 x } + 7 ) $. (Incidentally, you don't need the absolute value around $ \mathrm e ^ { 2 x } + 7 $, since that's always positive.)