<s>[INST] real values of $k$ in quadratic equation in trigonometric form real values of $k$ for which the equation $\cos^2 x-(k^2+k+5)|\cos x|+(k^3+3k^2+2k+6)=0$ has real solutions
equation is $|\cos x|^2-(k^2+k+5)|\cos x|+(k^3+3k^2+2k+6)=0$
$\displaystyle |\cos x| = \frac{k^2+k+5\pm \sqrt{(k^2+k+5)^2-4(k^3+3k^2+2k+5)}}{2}$
equation has real solution for $0 \leq|\cos x|\leq 1$
$(k^2+k+5)^2-4(k^3+3k^2+2k+5)\geq0$
i wan,t go after that, could some help me with this
 [/INST] Let $t=|\cos x|$ and $f(t)=t^2-(k^2+k+5)t+k^3+3k^2+2k+6$.
Then, 
$$f(t)=\left(t-\frac{k^2+k+5}{2}\right)^2-\left(\frac{k^2+k+5}{2}\right)^2+k^3+3k^2+2k+6\tag1$$
Now
$$\begin{align}&-\left(\frac{k^2+k+5}{2}\right)^2+k^3+3k^2+2k+6\\\\&=\frac 14(-(k^2+k+5)^2+4(k^3+3k^2+2k+6))\\\\&=-\frac 14(k^4-2k^3-k^2+2k+1)\\\\&=-\frac 14((k^2)^2+(-k)^2+(-1)^2+2\cdot k^2\cdot (-k)+2\cdot k^2\cdot (-1)+2\cdot (-k)\cdot (-1))\\\\&=-\left(\frac{k^2-k-1}{2}\right)^2\end{align}$$
So, from $(1)$, we get
$$f(t)=\left(t-\frac{k^2+k+5}{2}\right)^2-\left(\frac{k^2-k-1}{2}\right)^2$$
Since
$$\frac{k^2+k+5}{2}=\frac 12\left(k+\frac 12\right)^2+\frac{19}{8}\gt 1\quad\text{and}\quad -\left(\frac{k^2-k-1}{2}\right)^2\le 0$$
for any $k\in\mathbb R$, considering the graph of a parabola $y=f(t)$ gives that we want to find $k$ such that
$$\frac{k^2-k-1}{2}\not=0\quad\text{and}\quad f(0)=(k+3)(k^2+2)\ge 0\quad\text{and}\quad f(1)=(k+2)(k^2+1)\le 0$$
Hence, the answer is $\ \color{red}{-3\le k\le -2}$.
</s>