# How do you differentiate f(x)=-5 xe^(x/cos x) using the chain rule?

Jun 21, 2016

$- 5 {e}^{\frac{x}{\cos} x} \left(1 + x \frac{\cos x + x \sin x}{\cos} ^ 2 x\right)$

#### Explanation:

you'll need the product rule first of course so we can simplify by letting $p = {e}^{\frac{x}{\cos} x}$

then first we work the product rule so $\left(- 5 x p\right) ' = - 5 p - 5 x p '$ Eqn A

and now for p', we know from the chain rule that $\left({e}^{f \left(x\right)}\right) ' = f ' \left(x\right) {e}^{f \left(x\right)}$ where, here, $f \left(x\right) = \frac{x}{\cos} x$

and so
so $f ' \left(x\right) = \left(\frac{x}{\cos} x\right) ' = \frac{\cos x + x \sin x}{\cos} ^ 2 x$ from the quotient rule

which means that $p ' = \left({e}^{\frac{x}{\cos} x}\right) ' = {e}^{\frac{x}{\cos} x} \frac{\cos x + x \sin x}{\cos} ^ 2 x$

going back to Eqn A, and plugging this all back in, we then have

$\left(- 5 x {e}^{\frac{x}{\cos} x}\right) ' = - 5 {e}^{\frac{x}{\cos} x} - 5 x {e}^{\frac{x}{\cos} x} \frac{\cos x + x \sin x}{\cos} ^ 2 x$

$= - 5 {e}^{\frac{x}{\cos} x} \left(1 + x \frac{\cos x + x \sin x}{\cos} ^ 2 x\right)$

that could be tidied up maybe in some other way...

personally, i think it is helpful to look at logarithmic differentiation here

so we can instead say that $\ln p = \frac{x}{\cos} x$

so $\frac{1}{p} p ' = \left(\frac{x}{\cos} x\right) ' = \frac{\cos x + x \sin x}{\cos} ^ 2 x$

so $p ' = p \left(\frac{x}{\cos} x\right) ' = {e}^{\frac{x}{\cos} x} \frac{\cos x + x \sin x}{\cos} ^ 2 x$ again using the quotient rule for the second bit of this.

another way of looking at it

Jun 21, 2016

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

#### Explanation:

$\frac{d}{\mathrm{dx}} \left(- 5 x {e}^{\frac{x}{\cos \left(x\right)}}\right)$

Taking the constant out, ${\left(a \cdot f\right)}^{'} = a \setminus \cdot {f}^{'}$

$= - 5 \frac{d}{\mathrm{dx}} \left(x {e}^{\frac{x}{\cos \left(x\right)}}\right)$

Applying the product rule, $\setminus {\left(f \setminus \cdot g \setminus\right)}^{'} = {f}^{'} \setminus \cdot g + f \setminus \cdot {g}^{'}$
$f = x , g = {e}^{\frac{x}{\cos \left(x\right)}}$

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

We know,
$\frac{d}{\mathrm{dx}} \left(x\right) = 1$
$\frac{d}{\mathrm{dx}} \left({e}^{\frac{x}{\cos \left(x\right)}}\right) = \frac{{e}^{\setminus \frac{x}{\cos \left(x\right)}} \left(x \sin \left(x\right) + \cos \left(x\right)\right)}{{\cos}^{2} \left(x\right)}$

[i.e applying chain rule; $\frac{\mathrm{df} \left(u\right)}{\mathrm{dx}} = \frac{\mathrm{df}}{\mathrm{du}} \cdot \frac{\mathrm{du}}{\mathrm{dx}}$

Let $\frac{x}{\cos \left(x\right)} = u$
$= \frac{d}{\mathrm{du}} \left({e}^{u}\right) \frac{d}{\mathrm{dx}} \left(\frac{x}{\cos \left(x\right)}\right)$
and, $\frac{d}{\mathrm{du}} \left({e}^{u}\right) = {e}^{u}$
also, $\frac{d}{\mathrm{dx}} \left(\frac{x}{\cos \left(x\right)}\right) = \frac{\cos \left(x\right) + x \sin \left(x\right)}{{\cos}^{2} \left(x\right)}$

$= {e}^{u} \frac{\cos \left(x\right) + x \sin \left(x\right)}{{\cos}^{2} \left(x\right)}$

substituting back, $u = \frac{x}{\cos \left(x\right)}$
$= {e}^{\frac{x}{\cos \left(x\right)}} \frac{\cos \left(x\right) + x \sin \left(x\right)}{{\cos}^{2} \left(x\right)}$

simplifying it,
$= \frac{{e}^{\frac{x}{\cos \left(x\right)}} \left(x \sin \left(x\right) + \cos \left(x\right)\right)}{{\cos}^{2} \left(x\right)}$ ]

so, $= - 5 \left(1 {e}^{\frac{x}{\cos \left(x\right)}} + \frac{{e}^{\frac{x}{\cos \left(x\right)}} \left(x \sin \left(x\right) + \cos \left(x\right)\right)}{{\cos}^{2} \left(x\right)} x\right)$

simplifying it,
$5 \left({e}^{\frac{x}{\cos \left(x\right)}} + \frac{{e}^{\frac{x}{\cos \left(x\right)}} x \left(x \sin \left(x\right) + \cos \left(x\right)\right)}{{\cos}^{2} \left(x\right)}\right)$