Check the picture below.
so let's notice, the function has roots at -3 and -1, touches the x-axis, and we can also say it passes through the point above at (-2 , 2).
Now, we can say, what's the equation of a function that has roots at -3 and -1 and it passes through (-2 , 2)?
![\begin{cases} x = -3 &\implies x +3=0\\ x = -1 &\implies x +1=0\\ \end{cases} \\\\[-0.35em] ~\dotfill\\\\ \stackrel{original~polynomial}{a ( x +3 )( x +1 ) = \stackrel{0}{y}} \hspace{5em}\textit{we also know that } \begin{cases} x=-2\\ y=2 \end{cases} \\\\\\ a ( -2 +3 )( -2 +1 ) = 2\implies a(1)(-1)=2\implies -a=2 \\\\\\ a=\cfrac{2}{-1}\implies a=-2\hspace{5em}\boxed{-2(x+3)(x+1)=y}](https://img.qammunity.org/2024/formulas/mathematics/college/nwkzrr3jh78qjr4ltcu3b512mpa60h6l4n.png)