A problem when trying to compute the derivative of $\frac {e^{-x}x}{x+2}$ I have this function, and I need to find intervals in which this function is increasing, and decreasing:
The function is this:
$$f(x) =\frac {e^{-x}x}{x+2}$$
Here's my attempt:
First thing I did is simply rewriting the function in this form:
$$f(x) = \frac {x}{e^{-x}(x+2)}$$
second thing I did is finding the domain of f(x) and the derivative of f(x) ( i.e f'(x) ).
here's the final result I got by means of quotient rule, and by means of collecting like terms (i.e by collecting $e^x$:
$$f'(x) = (e^x \ \text{something positive}) \cdot (-x^2+x+5)$$
I didn't write the denominator, because is squared so it's always positive, and the same thing happens with e^x, therefore I didn't consider the first part. the second part can change the sign of the first derivative so I need it to find increasing/decreasing intervals, but I think the derivative is wrong, so here's a detailed explanation of what I did when computing the derivative:
$$e^x(x+2) - x \cdot[e^x  (x+2) + e^x]$$ the denominator is always positive so I didn't write it.
$e^x  (x+2)$ $\to$ there's a 1. I simply ignored it, because it's the derivative of x.
$x [e ^x (x+2) + e^x\to x$ is $x$, and the other part is the derivative of the denominator (I've used the product rule)
then, I've collected $e^x$, because it's a common term, and I got the final derivative,
$$f'(x) = (e^x\  \text{something positive}) \cdot(-x^2+x+5)$$
 A: $$y(x) = e^{f(x)} \times g(x)$$
Using product rule for derivative
$$y_1(x) = e^{f(x)}\times \left(f'(x)\times g(x) + g'(x)\right)$$
$$f(x) = -x \text{ and } g(x) = \frac x{x+2} = 1- \frac 2{x+2}$$
derivative is as:
$$e^{-x}\left[-\frac x{x+2} + \frac 2{(x+2)^2}\right]$$
A: The derivative is wrong. Let $g(x)=x,\,h(x)=e^x,\text{ and }f(x)=g(x)/h(x)$; if you aply the quotient rule you get
\begin{align}
f'(x)&=\frac{g'(x)h(x)-h'(x)g(x)}{h(x)^2}\\
&=\frac{1\cdot e^x(x+2)-[e^x(x+2)+e^x\cdot1]x}{(e^x(x+2))^2}\\
&=\frac{xe^x+2e^x-x^2e^x-2xe^x-xe^x}{(e^x(x+2))^2}\\
&=e^x\frac{2-x^2-2x}{(e^x(x+2))^2}\\
&=\frac{-x^2-2x+2}{e^x(x+2)^2}.
\end{align}
As you note, the sign depends only on the numerator. In turn, the numerator is positive if $x\in(-1-\sqrt{3},-1+\sqrt{3})$ and negative outside of this interval. Therefore, the function is decreasing in $(-\infty,-1-\sqrt{3})$, increasing in $(-1-\sqrt{3},-1+\sqrt{3})$ and decreasing again in $(-1+\sqrt{3},\infty)$. And it must be noted that it has a discontinuity at $x=-2$ (in the increasing part of the function).
