Concept:
To evaluate rational integrals, we often simplify the integrand using algebraic manipulation.
If the degree of the numerator is less than or equal to the denominator, we rewrite the fraction into simpler parts.
A useful identity:
\[
\frac{x}{x+2} = 1 - \frac{2}{x+2}
\]
Then integrate each term separately using basic integration formulas:
\[
\int 1\,dx = x, \qquad \int \frac{1}{x+a}\,dx = \log|x+a|
\]
Step 1: Rewrite the integrand.
\[
\frac{x}{x+2} = \frac{(x+2)-2}{x+2}
\]
\[
= \frac{x+2}{x+2} - \frac{2}{x+2}
\]
\[
= 1 - \frac{2}{x+2}
\]
Step 2: Integrate term by term.
\[
\int \frac{x}{x+2}dx
=
\int \left(1 - \frac{2}{x+2}\right) dx
\]
\[
= \int 1\,dx - 2\int \frac{1}{x+2}dx
\]
\[
= x - 2\log|x+2| + C
\]
Thus,
\[
\int \frac{x}{x+2}dx = x - 2\log|x+2| + C
\]