# What is the second derivative of x/(2+ e^x)?

May 27, 2015

We can use the quotient rule, here, which states that, for $y = f \frac{x}{g} \left(x\right)$,

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{f ' \left(x\right) g \left(x\right) - f \left(x\right) g ' \left(x\right)}{g \left(x\right)} ^ 2$

Thus, as $f \left(x\right) = x$ and $g \left(x\right) = 2 + {e}^{x}$,

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{1 \cdot \left(2 + {e}^{x}\right) - x \left({e}^{x}\right)}{2 + {e}^{x}} ^ 2 = \textcolor{g r e e n}{\frac{2 + {e}^{x} - x {e}^{x}}{2 + {e}^{x}} ^ 2}$

Now, we can rewrite this first derivative as a product: $\left(2 + {e}^{x} - x {e}^{x}\right) {\left(2 + {e}^{x}\right)}^{-} 2$

Applying the product rule, which states that when $y = f \left(x\right) g \left(x\right)$,

$\frac{\mathrm{dy}}{\mathrm{dx}} = f ' \left(x\right) g \left(x\right) + f \left(x\right) g ' \left(x\right)$

It'll be easier for us to find $f ' \left(x\right)$ and $g ' \left(x\right)$ before proceeding to the whole derivation, so we do not get lost.

$f ' \left(x\right) = 0 + {e}^{x} + \textcolor{red}{1 \cdot {e}^{x} + x \cdot {e}^{x}}$, thus $\textcolor{g r e e n}{f ' \left(x\right) = 2 {e}^{x} + x {e}^{x}}$
Note that the red part was the demanded chain rule for $x {e}^{x}$.

Now, $g ' \left(x\right)$ demands chain rule, which states that $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{du}} \frac{\mathrm{du}}{\mathrm{dx}}$.

Renaming $u = 2 + {e}^{x}$, we have $g \left(u\right) = {u}^{-} 2$

So,

$\frac{\mathrm{dy}}{\mathrm{du}} = - 2 {u}^{-} 3$ and $\frac{\mathrm{du}}{\mathrm{dx}} = {e}^{x}$

Aggregating them in a multiplication as stated by chain rule:

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(- 2 {u}^{-} 3\right) \left({e}^{x}\right) = \left(- 2 {\left(2 + {e}^{x}\right)}^{-} 3\right) \left({e}^{x}\right)$

$g ' \left(x\right) = \textcolor{g r e e n}{\frac{- 2 \left({e}^{x}\right)}{2 + {e}^{x}} ^ 3}$

Now that we have $f \left(x\right)$, $f ' \left(x\right)$, $g \left(x\right)$ and $g ' \left(x\right)$, we can go to product rule:

$\frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \left({e}^{x} + {e}^{x} + x {e}^{x}\right) {\left({e}^{x} + 2\right)}^{-} 2 + \left(2 + {e}^{x} + x {e}^{x}\right) \left(- 2 {e}^{x} {\left({e}^{x} + 2\right)}^{-} 3\right)$

$\frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \frac{2 {e}^{x} + x {e}^{x}}{{e}^{x} + 2} ^ 2 + \frac{\left(2 + {e}^{x} + x {e}^{x}\right) \left(- 2 {e}^{x}\right)}{{e}^{x} + 2} ^ 3$

To operate this sum, we have that the lowest common denominator (l.c.d.) is ${\left({e}^{x} + 2\right)}^{3}$. Thus,

$\frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \frac{\left({e}^{x} + 2\right) \left(2 {e}^{x} + x {e}^{x}\right) + \left(- 2 {e}^{x}\right) \left(2 + {e}^{x} + x {e}^{x}\right)}{{e}^{x} + 2} ^ 3$

Distributing the factors, we get the following, which allows us to operate some cancelling, as I will remark in collors:

$\frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \frac{\textcolor{red}{2 {e}^{2 x}} \textcolor{g r e e n}{+ x {e}^{2 x}} + \textcolor{b l u e}{4 {e}^{x}} + 2 x {e}^{x} \textcolor{b l u e}{- 4 {e}^{x}} \textcolor{red}{- 2 {e}^{2 x}} \textcolor{g r e e n}{- 2} x {e}^{2 x}}{{e}^{x} + 2} ^ 3$

Final simplification:

$\frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \frac{2 x {e}^{x} - x {e}^{2 x}}{{e}^{x} + 2} ^ 3 = \textcolor{g r e e n}{\frac{{e}^{x} \left(2 - {e}^{x}\right) x}{{e}^{x} + 2} ^ 3}$