<s>[INST] Finding the range of $\frac{5 \cos x-2 \sin ^{2} x+4 \sin x-3}{6|\cos x|+1}$ Here is the expression:
\begin{equation}
\frac{5 \cos x-2 \sin ^{2} x+4 \sin x-3}{6|\cos x|+1}
\end{equation}
I have tried to maximize the denominator, so I got the maximum value of denominator equal to 7, but I am lost what to do next
I did the graph of this expression, so the minimum value is equal to -9, but how to get the answer without a graph, which is difficult to do by hand?
 [/INST] If $x\in[-\pi/2,\pi/2]$ then $|\cos x|=\cos x$ so
\begin{equation}
\frac{5 \cos x-2 \sin ^{2} x+4 \sin x-3}{6|\cos x|+1}
={5\cos x+5/6\over6\cos x+1}+{-2\sin^2 x+ 4\sin x -3\frac56\over6\cos x+1}\\
=5/6+{-2\sin^2 x+ 4\sin x -3\frac56\over6\cos x+1}\\
\end{equation}
The $-2\sin^2 x$ term is always negative, so let $x=-\pi/2$ then $\sin x=-1$, $\cos x=0$, and so by inspection it is clearly the minimum and the value is $-9$.
You can apply the same argument to the other range $x\in[\pi/2, 3\pi/2]$ and the same minimum is found.
</s>