To find local maxima and minima of #f(x)=e^x(x^2+2x+1)#, let us first differentiate it
#f'(x)=e^xd/(dx)(x^2+2x+1)+(de^x)/(dx)(x^2+2x+1)# or
#f'(x)=e^x(2x+2)+e^x(x^2+2x+1)# or
#f'(x)=e^x(x^2+4x+3)=e^x(x+3)(x+1)#
which will be zero for #x=-1# and #x=-3#
Hence, maxima and minima will be at #x=-1# and #x=-3#
For more details click here.
To find whether is maxima or minima, let us find out second derivative.
#f''(x)-d/(dx)e^x(x^2+4x+3)#, which is
#f''(x)=e^xd/(dx)(x^2+4x+3)+(de^x)/(dx)(x^2+4x+3)# or
#f''(x)=e^x(2x+4)+e^x(x^2+4x+3)# or
#f''(x)=e^x(x^2+6x+7)#
At #x=-3#, #f''(x)=e^-3((-3)^2+6(-3)+7)=-2e^-3# and is negative.
At #x=-1#, #f''(x)=e^-1((-1)^2+6(-1)+7)=2e^-3# and is positive.
Hence we have a local maxima at #x=-3# and a local minima at #x=-1#.
graph{e^x(x^2+2x+1) [-10, 10, -5, 5]}