<s>[INST] Help differentiating $\frac{(x-1)^2(x+2)^2}{(x+1)^2}$ I need help differentiating this expression below. I know you can use a mix of the product rule and quotient rule, but that is tedious and long. Is there a shorter method?
$$\dfrac{(x-1)^2(x+2)^2}{(x+1)^2}$$
 [/INST] \begin{align*}\displaystyle \frac{\mathrm d}{\mathrm dx} \frac{(x-1)^2(x+2)^2}{(x+1)^2}&=\displaystyle \frac{\mathrm d}{\mathrm dx} \left(\frac{(x-1)(x+2)}{x+1}\right)^2\\
&=\displaystyle \frac{2(x-1)(x+2)}{x+1} \left( \frac{\mathrm d}{\mathrm dx} \frac{(x-1)(x+2)}{x+1} \right)\\
&=\displaystyle \frac{2(x-1)(x+2)}{x+1} \frac{\mathrm d}{\mathrm dx} \left( \frac{x^2+x-2}{x+1} \right)\\
&=\displaystyle \frac{2(x-1)(x+2)}{x+1} \frac{\mathrm d}{\mathrm dx} \left( \frac{(x+1)x-2}{x+1} \right)\\
&=\displaystyle \frac{2(x-1)(x+2)}{x+1} \frac{\mathrm d}{\mathrm dx} \left(x - \frac{2}{x+1} \right)\\
&=\displaystyle \frac{2(x-1)(x+2)}{x+1} \left(1 + \frac{2}{(x+1)^2} \right)\\
&=\displaystyle \frac{2(x-1)(x+2)}{x+1} \cdot \frac{x^2+2x+3}{(x+1)^2}\\
&=\displaystyle \frac{2(x-1)(x+2)(x^2+2x+3)}{(x+1)^3}.
\end{align*}
</s>