# How do you differentiate g(x) = (1 + sin(2-x))(1 +cos^2(x))  using the product rule?

Feb 12, 2017

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

#### Explanation:

We can use product formula according to which, if $f \left(x\right) = g \left(x\right) h \left(x\right)$

then $\frac{\mathrm{df}}{\mathrm{dx}} = \frac{\mathrm{dg}}{\mathrm{dx}} \times h \left(x\right) + \frac{\mathrm{dh}}{\mathrm{dx}} \times g \left(x\right)$

We also use Chain Rule according to whicg a function of a function, say $y , = f \left(g \left(x\right)\right)$, where we have to find $\frac{\mathrm{dy}}{\mathrm{dx}}$, we need to do (a) substitute $u = g \left(x\right)$, which gives us $y = f \left(u\right)$. Then we need to use a formula called Chain Rule, which states that $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{du}} \times \frac{\mathrm{du}}{\mathrm{dx}}$

Now, as such as $g \left(x\right) = \left(1 + \sin \left(2 - x\right)\right) \left(1 + {\cos}^{2} \left(x\right)\right) = u \left(x\right) v \left(x\right)$,

where $u \left(x\right) = 1 + \sin \left(2 - x\right)$ and $v \left(x\right) = 1 + {\cos}^{2} x$ and

$\frac{\mathrm{dg}}{\mathrm{dx}} = \frac{\mathrm{du}}{\mathrm{dx}} \times v \left(x\right) + \frac{\mathrm{dv}}{\mathrm{dx}} \times u \left(x\right)$

Now= $\frac{\mathrm{du}}{\mathrm{dx}} = \cos \left(2 - x\right) \times \left(- 1\right) = - \cos \left(2 - x\right)$, using chain rule as $d . \left(\mathrm{dx}\right) \left(2 - x\right) = - 1$ and

$\frac{\mathrm{dv}}{\mathrm{dx}} = 0 + 2 \cos x \times \left(- \sin x\right) = - 2 \sin x \cos x$

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

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

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