# How do you differentiate f(x)=xcosx-sinx?

Jul 20, 2017

$\frac{\mathrm{df}}{\mathrm{dx}} = - x \sin x$

#### Explanation:

As the derivative is linear:

$\frac{\mathrm{df}}{\mathrm{dx}} = \frac{d}{\mathrm{dx}} \left(x \cos x\right) - \frac{d}{\mathrm{dx}} \left(\sin x\right) = \frac{d}{\mathrm{dx}} \left(x \cos x\right) - \cos x$

applying now the product rule:

$\frac{\mathrm{df}}{\mathrm{dx}} = x \frac{d}{\mathrm{dx}} \left(\cos x\right) + \left(\frac{d}{\mathrm{dx}} x\right) \cos x - \cos x$

$\frac{\mathrm{df}}{\mathrm{dx}} = - x \sin x + \cos x - \cos x = - x \sin x$