# How do you differentiate g(x) =x^2cosx using the product rule?

Mar 16, 2016

$\frac{\mathrm{dg} \left(x\right)}{\mathrm{dx}} = - {x}^{2} \sin x + 2 x \cos x$

#### Explanation:

$g \left(x\right) = {x}^{2} \cos x$ is product of two functions, say ${f}_{1} \left(x\right) = {x}^{2}$ and ${f}_{2} \left(x\right) = \cos x$.

Product rule states that if $g \left(x\right) = {f}_{1} \left(x\right) {f}_{2} \left(x\right)$ then $g ' \left(x\right) = {f}_{1} ' \left(x\right) {f}_{2} \left(x\right) + {f}_{1} \left(x\right) {f}_{2} ' \left(x\right)$.

Here $p ' \left(x\right)$ denotes differential of $p \left(x\right)$ i.e.

${f}_{1} ' \left(x\right)$ is differential of ${f}_{1} \left(x\right)$ and ${f}_{2} ' \left(x\right)$ is differential of ${f}_{2} \left(x\right)$.

Hence, $\frac{\mathrm{dg} \left(x\right)}{\mathrm{dx}} = {x}^{2} \cdot \frac{d \left(\cos x\right)}{\mathrm{dx}} + \frac{d \left({x}^{2}\right)}{\mathrm{dx}} \cdot \cos x$

= ${x}^{2} \cdot \left(- \sin x\right) + 2 x \cdot \cos x = - {x}^{2} \sin x + 2 x \cos x$