5. Find the maximum and minimum values of the function $g(x)=\sin ^{8} x+8 \cos ^{8} x$.

Answer. $g_{\min }=\frac{8}{27}, g_{\max }=8$.
Solution: We find the derivative: $g^{\prime}(x)=8 \sin ^{7} x \cos x-64 \cos ^{7} x \sin x=8 \sin x \cos x\left(\sin ^{6} x-8 \cos ^{6} x\right)$. The critical points of this function are the roots of the equations $\sin x=0, \cos x=0$ and $\sin ^{6} x=8 \cos ^{6} x$, from which $x=k \pi, x=\frac{\pi}{2}+k \pi, x= \pm \operatorname{arctg} \sqrt{2}+k \pi, k \in Z$.

If $x=k \pi$, then $g(x)=8$.

If $x=\frac{\pi}{2}+k \pi$, then $g(x)=1$.

If $x= \pm \operatorname{arctg} \sqrt{2}+k \pi$, then $|\sin x|=\sqrt{\frac{2}{3}},|\cos x|=\frac{1}{\sqrt{3}}$, therefore, $g(x)=\frac{16}{81}+8 \cdot \frac{1}{81}=\frac{8}{27}$.

Thus, $g_{\min }=\frac{8}{27}, g_{\max }=8$.