<s>[INST] What is the correct u-substitution for this integral? I'm wondering how I can solve the following indefinite integral:
$$\int\frac{x}{x^2-2x+2}dx$$
The $u$-substitution I did was $x^2-2x+2$, but I've gotten a little stuck. I've shown my steps below for clarification on the problem.
$$u=x^2-2x+2$$
$$du = (2x-2)dx$$
$$du = 2(x-1)dx$$
$$\frac{1}{2}du = (x-1)dx$$
I'm not sure how to continue because the numerator of the function is $x$, but I got $x-1$ after continuing with the $u$-substitution. Is my $u$-substitution correct, or are there additional steps I need to perform in order to reach the final answer?
 [/INST] $$
\int\frac{x}{x^2-2x+2}dx = \frac{1}{2}\int\frac{2x-2+2}{x^2-2x+2}dx\\
= \frac{1}{2}\int\frac{2x-2}{x^2-2x+2}dx + \int\frac{1}{(x-1)^2+1}dx\\
= \frac{1}{2} \log(x^2-2x+2) + \tan^{-1}(x-1) + c
$$
</s>