Hello Mahnoor Jafer,
We are given to evaluate:
$$I=\int\frac{x}{x^2-4x+8}\,dx$$
Observing that:
$$\frac{d}{dx}\left(x^2-4x+8 \right)=2x-4$$ we will then rewrite the integral as follows:
$$I=\frac{1}{2}\int\frac{2x-4+4}{x^2-4x+8}\,dx=\frac{1}{2}\int\frac{2x-4}{x^2-4x+8}\,dx+2\int\frac{1}{(x-2)^2+2^2}\,dx$$
For the first integral on the right:
Use the substitution:
$$u=x^2-4x+8\,\therefore\,du=(2x-4)\,du$$
For the second integral on the right:
Use the substitution:
$$x-2=2\tan(\theta)\,\therefore\,dx=2\sec^2(\theta)\,d\theta$$
And we obtain:
$$I=\frac{1}{2}\int\frac{1}{u}\,du+\int\frac{\sec^2(\theta)}{\tan^2(\theta)+1}\,d\theta$$
Applying the Pythagorean identity $$\tan^2(x)+1=\sec^2(x)$$ on the second integral, we obtain:
$$I=\frac{1}{2}\int\frac{1}{u}\,du+\int\,d\theta$$
Now, using the rules of integration, we obtain:
$$I=\frac{1}{2}\ln|u|+\theta+C$$
Back-substituting for $u$ and $\theta$, we obtain:
$$I=\frac{1}{2}\ln\left|x^2-4x+8 \right|+\tan^{-1}\left(\frac{x-2}{2} \right)+C$$
Hence, we have found:
$$\int\frac{x}{x^2-4x+8}\,dx=\frac{1}{2}\ln\left|x^2-4x+8 \right|+\tan^{-1}\left(\frac{x-2}{2} \right)+C$$