<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] The mistake was to consider that $\int{\frac{\,dx}{1-x}}$ is simply $\ln(1-x)$ when the correct path of continuing is using the substitution method resulting in $-\ln(1 - x) + c$:
$ t =  x - 1 $
$ \frac{\,dt}{\,dx} = -1$
$ \,dt = -\,dx$
$ \,dx = -\,dt$
$$
\int{\frac{-\,dt}{t}} = -1\int{\frac{\,dt}{t}} = -1\ln(1-x) + c
$$
</s>