Concept:
When the degree of the numerator is equal to or greater than the denominator, we simplify the integrand using algebraic division or decomposition.
A useful trick is to rewrite the numerator so that the denominator appears in the expression.
\[
\frac{x}{x+2}
\]
can be rewritten as
\[
\frac{x+2-2}{x+2}
\]
which simplifies the integration process.
Step 1: {Rewrite the numerator.}
\[
\frac{x}{x+2} = \frac{x+2-2}{x+2}
\]
\[
= \frac{x+2}{x+2} - \frac{2}{x+2}
\]
\[
= 1 - \frac{2}{x+2}
\]
Thus the integral becomes
\[
\int \frac{x}{x+2}dx = \int \left(1 - \frac{2}{x+2}\right)dx
\]
Step 2: {Integrate term by term.}
\[
\int 1\,dx = x
\]
\[
\int \frac{1}{x+2}dx = \ln|x+2|
\]
Therefore,
\[
\int \left(1 - \frac{2}{x+2}\right)dx
\]
\[
= x - 2\ln|x+2| + C
\]
Step 3: {Write the final result.}
\[
\int \frac{x}{x+2}\,dx = x - 2\ln|x+2| + C
\]