I have been stuck on this problem for a while and I have not been able to get a valid solution Can someone help me?

The equation is given as
[tex]\begin{gathered} \cos ^2x+3\cos x+2=0 \\ (\cos x)^2+3\cos x+2=0 \end{gathered}[/tex]Let m = cos x.
Therefore, we have
[tex]m^2+3m+2=0[/tex]Solving the quadratic equation by factorization, we replace +3m with +m and +2m.
Hence
[tex]m^2+m+2m+2=0[/tex]Factorizing, we have
[tex]\begin{gathered} m(m+1)+2(m+1)=0 \\ (m+2)(m+1)=0 \\ \therefore \\ m+2=0,m+1=0 \\ m=-2,-1 \end{gathered}[/tex]Therefore, we have m = -2 or -1
Remember that
[tex]m=\cos x[/tex]Therefore,
[tex]\begin{gathered} \cos x=-1\text{ } \\ or \\ \cos x=-2 \end{gathered}[/tex]Considering the first situation,
[tex]\cos x=-1[/tex]This can be rewritten as
[tex]\cos x=\frac{-1}{1}[/tex]