<s>[INST] Indefinite integral $\int\ln(1−x)dx$ by parts I have an exercise that explicitly asks for the indefinite integral of the following equation using integral by parts.
$$
\int\ln(1-x)\,dx
$$
I tried to define: $ u = \ln(1-x) $ so,
$$
\frac{\,du}{\,dx} = \frac{-1}{1-x}\\
\,du = \frac{-\,dx}{1-x}
$$
and, $ \,dv = \,dx $ resulting in $ v = x $ and finally applying: $ \int{u\,dv} = uv - \int{v\,du} $
$$
\begin{align}
\int\ln(1-x)\,dx&= x \ln(1-x) -\int x \, \frac{-\,dx}{1-x}\\
&=x\ln(1-x) - \int \frac{-x}{1-x} \,dx\\
&=x\ln(1-x) - \int \frac{1-x-1}{1-x} \,dx\\
&=x\ln(1-x) - \int \left(\frac{1-x}{1-x} - \frac{1}{1-x} \right)\,dx\\
&=x\ln(1-x) - \int \left(1 - \frac{1}{1-x} \right)\,dx\\
&=x\ln(1-x) - \left(\int{1\,dx} - \int{\frac{1}{1-x}}\,dx\right)\\
&=x\ln(1-x) - x -\left(- \int{\frac{1}{1-x}}\,dx\right)\\
&=x\ln(1-x) - x + \int{\frac{1}{1-x}}\,dx\\
&=x\ln(1-x) - x + \ln(1-x) + c\\
&=(x + 1)\ln(1-x) - x + c
\end{align}
$$
that does not match the answer in the book:
$(x - 1)\ln(1-x) - x + c$
I have found this other solution that I believe is not valid considering that the exercise asks to utilize integral by parts.
 [/INST] Your steps all ALL correct except the last second step as @J.G. said.
On the other hand, using integration by parts wisely, we get
$$
\begin{aligned}
\int \ln (1-x) d x & =-\int \ln (1-x) d(1-x) \\
& =(1-x) \ln (1-x)+\int(1-x) \frac{1}{1-x} d x \\
& =(1-x) \ln (1-x)+x+C
\end{aligned}
$$
</s>