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

Nov 1, 2016

Say $y = g \left(x\right)$

This means that:

$y = \sqrt{{e}^{x} - x} \cdot \cos x$

$y = u \cdot v$

Whereby both u and v are functions of x .

If this is the case, then:

$\frac{\mathrm{dy}}{\mathrm{dx}} = u \cdot \frac{\mathrm{dv}}{\mathrm{dx}} + v \cdot \frac{\mathrm{du}}{\mathrm{dx}} = g ' \left(x\right)$

Now... Using implicit differentiation...

$u = \sqrt{{e}^{x} - x}$

${u}^{2} = {e}^{x} - x$

$2 u \cdot \frac{\mathrm{du}}{\mathrm{dx}} = {e}^{x} - 1$

$\frac{\mathrm{du}}{\mathrm{dx}} = \frac{{e}^{x} - 1}{2 u}$

$\frac{\mathrm{du}}{\mathrm{dx}} = \frac{{e}^{x} - 1}{2 \sqrt{{e}^{x} - x}}$

Using normal differentiation...

$v = \cos x$

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

This means that:

$\frac{\mathrm{dy}}{\mathrm{dx}} = - \sin x \sqrt{{e}^{x} - x} + \cos x \cdot \frac{{e}^{x} - 1}{2 \sqrt{{e}^{x} - x}}$

Therefore:

$g ' \left(x\right) = - \sin x \sqrt{{e}^{x} - x} + \cos x \cdot \frac{{e}^{x} - 1}{2 \sqrt{{e}^{x} - x}}$