# How do you differentiate f(x)=(lnx-x)(cotx-2e^x) using the product rule?

Oct 31, 2016

$f ' \left(x\right) = \left(\cot x - 2 {e}^{x}\right) \left(\frac{1}{x} - 1\right) - \left(\ln x - x\right) \left({\csc}^{2} x + 2 {e}^{x}\right)$

#### Explanation:

I will assume you are familiar with these standard differenmtiation result:
$\frac{d}{\mathrm{dx}} \left(\ln x\right) = \frac{1}{x}$; $\frac{d}{\mathrm{dx}} \left({e}^{x}\right) = {e}^{x}$; $\frac{d}{\mathrm{dx}} \left(\cot x\right) = - {\csc}^{2} x$

The product rule is $\frac{d}{\mathrm{dx}} \left(u v\right) = u \frac{\mathrm{dv}}{\mathrm{dx}} + v \frac{\mathrm{du}}{\mathrm{dx}}$

so if $f \left(x\right) = \left(\ln x - x\right) \left(\cot x - 2 {e}^{x}\right)$; then

$f ' \left(x\right) = \left(\ln x - x\right) \left(\frac{d}{\mathrm{dx}} \left(\cot x - 2 {e}^{x}\right)\right) + \left(\cot x - 2 {e}^{x}\right) \left(\frac{d}{\mathrm{dx}} \left(\ln x - x\right)\right)$

$\therefore f ' \left(x\right) = \left(\ln x - x\right) \left(- {\csc}^{2} x - 2 {e}^{x}\right) + \left(\cot x - 2 {e}^{x}\right) \left(\frac{1}{x} - 1\right)$

$\therefore f ' \left(x\right) = \left(\ln x - x\right) \left(- 1\right) \left({\csc}^{2} x + 2 {e}^{x}\right) + \left(\cot x - 2 {e}^{x}\right) \left(\frac{1}{x} - 1\right)$

$\therefore f ' \left(x\right) = \left(\cot x - 2 {e}^{x}\right) \left(\frac{1}{x} - 1\right) - \left(\ln x - x\right) \left({\csc}^{2} x + 2 {e}^{x}\right)$