I have math problem $\int \frac{x}{1-x}\,dx$ and found two solutions for it:
1.$\int \frac{x}{1-x}\,dx=\int \frac{x-1+1}{1-x}\,dx=\int \frac{-1+x}{1-x}+\frac{1}{1-x}\,dx=\int -1\cdot\frac{1-x}{1-x}+\frac{1}{1-x}\,dx=\left\{\begin{array}{rcl} 1-x&=&t\\ -1\,dx&=&\,dt\\ dx&=&-1\,dt \end{array} \right\}=\int (-1+\frac{1}{t})\cdot-1\,dt=-1\int-1+\frac{1}{t}\,dt=-1(-x+\ln|t|)+C=\color{red}{x-\ln|1-x|+C}$
In this attempt, I moved $-1$ before the whole integral because all the elements of the integral are integrated by $dt$, so I used the formula to throw the factor before the integral.
2.$\int \frac{x}{1-x}\,dx=\int \frac{x-1+1}{1-x}\,dx=\int (-1+\frac{1}{1-x})\,dx=\int -1\,dx+\int \frac{1}{1-x}\,dx=\left\{\begin{array}{rcl} 1-x&=&t\\ -1\,dx&=&\,dt\\ dx&=&-1\,dt \end{array} \right\}=-x+\int \frac{1}{t}\cdot-1\,dt=-x-\int \frac{1}{t}\,dt=-x-\ln|t|+C=\color{blue}{-x-\ln|1-x|+C}$
In this example, I split the complex integral into component integrals using the formula, and the rest of the operations are the same.
I think both ways are correct, but they give different results. I took the derivative from both results, and it turned out that only the second solution is correct. Can someone explain to me why the second solution is correct and the first not?