<s>[INST] Taking the derivative of $x^4\sin(x)\cos(x)$, which step is wrong? I'm trying to take the derivative of $x^4\sin(x)\cos(x)$ and I keep getting the wrong answer.
My steps:
$$\frac {d}{dx}[x^4\sin(x)\cos(x)]$$
Apply product rule:
$$\frac {d}{dx}[x^4](\sin(x)\cos(x)+x^4\frac {d}{dx}[\sin(x)\cos(x)]$$
Simplify first part:
$$4x^3\sin(x)\cos(x)+x^4\frac {d}{dx}[\sin(x)\cos(x)]$$
Apply product rule to second part:
$$\cos(x)\cos(x)+(-\sin(x))$$
Add them all together: $$4x^3\sin(x)\cos(x)+x^4\cos^2(x)-\sin(x)$$
So something is wrong as the correct answer is $$-x^4\sin^2(x)+x^4\cos^2(x)+4x^3\cos(x)\sin(x)$$
Got the biggest headache from this one, would really appreciate help! Thanks!
 [/INST] $$\dfrac{d}{dx}(x^4\cdot \sin(x)\cdot cos(x))$$
Let $u = x^4$ and $v = \sin(x) \cdot  \cos(x)$. From the well known formula we know 
$$
\begin{align}
\dfrac{d}{dx}(u \cdot v) & = u \dfrac{dv}{dx} + v \dfrac{du}{dx} \\
 & = x^4 \dfrac{d}{dx}(\sin(x) \cdot  \cos(x)) + \sin(x) \cdot  \cos(x) \cdot \dfrac{d}{dx}(x^4) \\ 
 & = x^4 \dfrac{d}{dx}(\sin(x) \cdot  \cos(x)) + 4 \cdot x^3 \sin(x) \cdot  \cos(x)
\end{align}
$$
Expression simplified but we still need to solve $\dfrac{d}{dx}(\sin(x) \cdot  \cos(x))$
let $u = \sin(x)$ and $v = cos(x)$
$$
\begin{align}
\dfrac{d}{dx}(u \cdot v) & = u \dfrac{dv}{dx} + v \dfrac{du}{dx} \\
 & = \sin(x) \dfrac{d}{dx}(\cos(x)) + \cos(x) \cdot  \cos(x) \cdot \dfrac{d}{dx}(\sin(x)) \\ 
 & = \sin(x) \cdot(- \sin(x)) + cos(x) \cdot \cos(x) \\
 & = (\cos(x))^2 - (\sin(x))^2
\end{align}
$$
All we need is to substitute this back.
$$
\begin{align}
\dfrac{d}{dx}(x^4\cdot \sin(x)\cdot cos(x)) & = x^4 \dfrac{d}{dx}(\sin(x) \cdot  \cos(x)) + 4 \cdot x^3 \sin(x) \cdot \\
& = x^4 ((\cos(x))^2 - (\sin(x))^2) + 4 \cdot x^3 \sin(x)
\end{align}
$$
</s>