2. Given the function $g(x)=\frac{2 \cos ^{4} x+\sin ^{2} x}{2 \sin ^{4} x+3 \cos ^{2} x}$. Find:

a) the roots of the equation $g(x)=\frac{1}{2}$;

b) the maximum and minimum values of the function $g(x)$.
Answer. a) $x=\frac{\pi}{4}+\frac{k \pi}{2}, k \in \mathrm{Z}, x=\frac{\pi}{2}+k \pi, k \in \mathrm{Z}$; b) $g_{\min }=\frac{7}{15}, g_{\max }=\frac{2}{3}$.

Solution. Transform the given function:

$$
g(x)=\frac{2 \cos ^{4} x+1-\cos ^{2} x}{2\left(1-\cos ^{2} x\right)^{2}+3 \cos ^{2} x}=\frac{2 \cos ^{4} x-\cos ^{2} x+1}{2 \cos ^{4} x-\cos ^{2} x+2}=1-\frac{1}{2 \cos ^{4} x-\cos ^{2} x+2}
$$

Let $\cos ^{2} x=t \in[0 ; 1]$.

a) After the substitution, the equation becomes $1-\frac{1}{2 t^{2}-t+2}=\frac{1}{2} \Leftrightarrow 2 t^{2}-t+2=2 \Leftrightarrow\left[\begin{array}{l}t=0, \\ t=0.5\end{array}\right.$.

Returning to the variable $x$, we get $\cos ^{2} x=0$ or $\cos ^{2} x=0.5$, from which $x=\frac{\pi}{4}+\frac{k \pi}{2}, k \in \mathrm{Z}$ or $x=\frac{\pi}{2}+k \pi, k \in \mathrm{Z}$.

b) The denominator of the fraction is positive for all $t$, and the numerator is a fixed positive number, so the maximum of the fraction is achieved at the minimum of the denominator, and the minimum of the fraction is achieved at the maximum of the denominator.

Thus, $g_{\min }=g\left(\frac{1}{4}\right)=\frac{7}{15}, g_{\max }=g(1)=\frac{2}{3}$. (The minimum of the denominator is obtained at the vertex of the parabola, i.e., at $t=\frac{1}{4}$, and the maximum is at the point farthest from the vertex, i.e., at $t=1$.)