<s>[INST] What is the $n^{th}$ term derivative of $f(x) = (x^2-x-1)(\ln(1-x))$? I have the first three terms but am struggling with finding the $n^{th}$ term derivative of the function. Here is my work:
$$\\$$
$$f(x) = (x^2-x-1)(\ln(1-x)) $$
$$f'(x) = (2x-1)(\ln(1-x))-\left(\dfrac{x^2-x-1}{1-x}\right)$$
$$f''(x) = \dfrac{3x^2-5x+2(x-1)^2 \ln(1-x)+3}{(1-x)^2}$$
$$f'''(x) = \dfrac{2x^2-5x+1}{(x-1)^3}$$
$$f^{(n)}(x) = \ ?$$
 [/INST] It might be useful here to make a small substitution and to expand the parentheses:


*

*$y = 1-x \Rightarrow y' = -1$

*$\Rightarrow f(x) = g(y(x)) = -(1+x(1-x))\ln (1-x) = -(1+(1-y)y)\ln y$
Now differentiate $\boxed{g(y) = -\ln y - y\ln y + y^2 \ln y}$ with respect to $x$ and have in mind that $\color{blue}{y'(x) = -1}$ (which leads to the changing signs below):
\begin{eqnarray*}
f'(x) & = & \frac{1}{y} + (\ln y + 1) - (2y\ln y + y) \\
f''(x) & = & \frac{1}{y^2} - \frac{1}{y} + (2\ln y + 2) +1 \\
f^{(3)}(x) & = & \frac{2}{y^3} - \frac{1}{y^2} - \frac{2}{y}\\
 & \ldots & \\
f^{(n)} & = & \ldots \\
\end{eqnarray*}
For example replacing $y = 1-x$ gives $f^{(3)}(x) = \frac{2}{(1-x)^3} - \frac{1}{(1-x)^2} - \frac{2}{1-x}$.
</s>