# For what values of x is f(x)= x-x^2e^-x  concave or convex?

Jul 5, 2016

Find the second derivative and check its sign. It's convex if it's positive and concave if it's negative.

Concave for:
$x \in \left(2 - \sqrt{2} , 2 + \sqrt{2}\right)$

Convex for:
$x \in \left(- \infty , 2 - \sqrt{2}\right) \cup \left(2 + \sqrt{2} , + \infty\right)$

#### Explanation:

$f \left(x\right) = x - {x}^{2} {e}^{-} x$

First derivative:

$f ' \left(x\right) = 1 - \left(2 x {e}^{-} x + {x}^{2} \cdot \left(- {e}^{-} x\right)\right)$

$f ' \left(x\right) = 1 - 2 x {e}^{-} x + {x}^{2} {e}^{-} x$

Take ${e}^{-} x$ as a common factor to simplify next derivative:

$f ' \left(x\right) = 1 + {e}^{-} x \cdot \left({x}^{2} - 2 x\right)$

Second derivative:

$f ' ' \left(x\right) = 0 + \left(- {e}^{-} x \cdot \left({x}^{2} - 2 x\right) + {e}^{-} x \cdot \left(2 x - 2\right)\right)$

$f ' ' \left(x\right) = {e}^{-} x \cdot \left(2 x - 2 - {x}^{2} + 2 x\right)$

$f ' ' \left(x\right) = {e}^{-} x \cdot \left(- {x}^{2} + 4 x - 2\right)$

Now we must study the sign. We can switch the sign for easily solving the quadratic:

$f ' ' \left(x\right) = - {e}^{-} x \cdot \left({x}^{2} - 4 x + 2\right)$

Δ=b^2-4*a*c=4^2-4*1*2=8

To make the quadratic a product:

x_(1,2)=(-b+-sqrt(Δ))/(2*a)=(4+-sqrt(8))/(2*1)=2+-sqrt(2)

Therefore:

$f ' ' \left(x\right) = - {e}^{-} x \cdot \left(x - \left(2 - \sqrt{2}\right)\right) \cdot \left(x - \left(2 + \sqrt{2}\right)\right)$

• A value of $x$ between these two solutions gives a negative quadratic sign, while any other value of $x$ makes it positive.
• Any value of $x$ makes ${e}^{-} x$ positive.
• The negative sign at the start of the function reverses all signs.

Therefore, $f ' ' \left(x\right)$ is:

Positive, therefore concave for:
$x \in \left(2 - \sqrt{2} , 2 + \sqrt{2}\right)$

Negative, therefore convex for:
$x \in \left(- \infty , 2 - \sqrt{2}\right) \cup \left(2 + \sqrt{2} , + \infty\right)$