Answer
$$
f(x) =x^{2} e^{x}-3
$$
(*)
A relative maximum occurs at $x=-2,$ and the value of the function $f$ at this value is given by:
$$
\begin{aligned}
f(-2) &=(-2)^{2} e^{-2}-3 \\
&=\frac{4}{e^2}-3. \\
& \approx -2.4587
\end{aligned}
$$
(**)
A relative minimum occurs at $x=0,$ and the value of the function $f$ at this value is given by:
$$
\begin{aligned}
f(0) &=(0)^{2} e^{0}-3 \\
&=-3. \\
\end{aligned}
$$
Work Step by Step
$$
f(x) =x^{2} e^{x}-3
$$
To find the intervals where the function is increasing and decreasing.
First, we find $f^{\prime}(x) $,
$$
\begin{aligned}
f^{\prime}(x) &=x^{2} e^{x}+2 x e^{x} \\
&=x e^{x}(x+2)
\end{aligned}
$$
To find the critical numbers, we first find any values of $x$ that make $f^{\prime} =0 $. Now, solve the equation $f^{\prime} =0 $ to get
$$
\begin{aligned}
f^{\prime}(x) =x e^{x}(x+2)&=0\\
\Rightarrow\quad\quad\quad\quad\quad\\
x (x+2) &=0\\
\Rightarrow\quad\quad\quad\quad\quad\\
(x+2)=0 & \quad \quad or \quad \quad x=0 \\
x=-2 & \quad \quad or \quad \quad x=0 \\
\end{aligned}
$$
The only critical numbers are: $x =-2 $ and $x=0$ .
We can still apply the first derivative test, however, to find where $f$ is increasing and decreasing. Now, check the sign of $f^{\prime}(x)$. in the intervals
$$
(-\infty, -2 ), \quad (-2 ,0 ) , \quad \text {and} \quad (0, \infty).
$$
(1)
Test a number in the interval $(-\infty, -2 )$ say $-3$:
$$
\begin{aligned}
f^{\prime}(-3) &=(-3) e^{-3}((-3)+2)\\
&=\frac{3}{e^3} \\
&\approx 0.14936 \\
&\gt 0
\end{aligned}
$$
we see that $f^{\prime}(x)$ is positive in that interval, so $f(x)$ is increasing on $(-\infty, -2 )$.
(2)
Test a number in the interval $ (-2 ,0) $ say $ -1$:
$$
\begin{aligned}
f^{\prime}(-1) &=(-1) e^{-1}((-1)+2)\\
&=-\frac{1}{e}\\
&\approx -0.36787 \\
&\lt 0
\end{aligned}
$$
we see that $f^{\prime}(x)$ is negative in that interval, so $f(x)$ is decreasing on $(-2 ,0 )$.
(3)
Test a number in the interval $(0, \infty )$ say $1 $:
$$
\begin{aligned}
f^{\prime}(1) &=(1) e^{1}((1)+2)\\
&=3e\\
&\approx 8.1548 \\
&\gt 0
\end{aligned}
$$
we see that $f^{\prime}(x)$ is positive in that interval, so $f(x)$ is increasing on $(0, \infty )$.
From (1), (2) and (3) we find that:
(*)
The function $f$ is increasing on interval $ ( -\infty , -2) , $ and it is decreasing on interval $ (-2 ,0 ) . $ So, a relative maximum occurs at $x=-2,$ and the value of the function $f$ at this value is given by:
$$
\begin{aligned}
f(-2) &=(-2)^{2} e^{-2}-3 \\
&=\frac{4}{e^2}-3. \\
& \approx -2.4587
\end{aligned}
$$
(**)
The function $f$ is decreasing on interval $ (-2 ,0 ), $ and it is increasing on interval $ ( 0 , \infty). $ So, a relative minimum occurs at $x=0,$ and the value of the function $f$ at this value is given by:
$$
\begin{aligned}
f(0) &=(0)^{2} e^{0}-3 \\
&=-3. \\
\end{aligned}
$$