The derivative of $x^2 \cdot \cos(x)$ I want to know how to derive this function. Can someone explain the steps? I know most derivative rules but I'm clearly not seeing how this works:
$$\frac{d}{dx}(\ x^2cos(x)) = x(2\cos(x) - x\sin(x))$$
If you could help me to understand which rules are used (even very basic ones).
 A: They used the product rule $\dfrac{d}{dx}\left(f(x)\cdot g(x)\right) = f'(x)\cdot g(x) + f(x)\cdot g'(x)$. One reason why you might not recognize the answer given is because it has been factored after doing the derivative. If you do the math, then you should get
$$\begin{align}
\dfrac{d}{dx}(x^2\cos x) &= \dfrac{d}{dx}(x^2)\cdot \cos x + x^2 \cdot \dfrac{d}{dx}(\cos x) \\
 &= 2x\cos x - x^2\sin x \\
 &= x(2\cos x - x\sin x)
\end{align}$$
They also used the power rule $\dfrac{d}{dx}(x^n) = nx^{n-1}$ and the fact that $\dfrac{d}{dx}(\cos x) = -\sin x$.
A: $$\frac{d}{dx}\left(x^2\cos(x)\right)=2x\cos(x)-x^2\sin(x)\tag{By product rule}$$
$$2x\cos(x)-x^2\sin(x)=x(2\cos(x)-x\sin(x))$$
I have a hunch that you got the first answer, but didn't factor it. 
And here is  a proof for the product rule
$$\lim_{h\to0}\frac{f(x+h)g(x+h)-f(x)g(x)}{h}$$
$$=\lim_{h\to0}\frac{f(x+h)g(x+h)+\color{red}{f(x+h)g(x)-f(x+h)g(x)}-f(x)g(x)}{h}$$
$$=\lim_{h\to0}\frac{f(x+h)(g(x+h)-g(x))}{h}+\frac{g(x)(f(x+h)-f(x))}{h}$$
$$=f(x)g'(x)+f'(x)g(x)$$
