For example, let $\mathrm{R} \mathbf{R}$ be the set of real numbers, and $f: \mathbf{R} \rightarrow \mathbf{R}$ be a function satisfying $f(\cot x)=\cos 2 x+\sin 2 x$ for all $0<x<\pi$. Define $g(x)=f(x) \cdot f(1-x)$ for $-1 \leqslant x \leqslant 1$. Find the maximum and minimum values of $g(x)$ on $[-1,1]$.
(2003 Vietnam Mathematical Olympiad Problem)
Solve $f(\cot x)=\frac{1-\tan ^{2} x+2 \tan x}{1+\tan ^{2} x}$, let $t=\cot x$, then $f(t)=\frac{t^{2}+2 t-1}{t^{2}+1}$. Then
$$
\begin{array}{l}
g(x)=\frac{x^{2}+2 x-1}{x^{2}+1} \cdot \frac{(1-x)^{2}+2(1-x)-1}{(1-x)^{2}+1}=\frac{\left(x^{2}-x\right)^{2}-8\left(x^{2}-x\right)-2}{\left(x^{2}-x\right)^{2}+2\left(x^{2}-x\right)+2} \\
\text { Let } x^{2}-x=u, x \in[-1,1] \cdot g(u)=\frac{u^{2}-8 u-2}{u^{2}+2 u+2}=1-\frac{10 u+4}{u^{2}+2 u+2}, u \in\left[-\frac{1}{4}, 2\right]
\end{array}
$$

Let $y=\frac{10 u+4}{u^{2}+2 u+2}$, by the discriminant method it is easy to get: $y \leqslant-3+\sqrt{34}$, and equality holds when $u=$ $\frac{\sqrt{34}-2}{5}\left(\epsilon\left[-\frac{1}{4}, 2\right]\right)$, $y=-3+\sqrt{34}$
Therefore, $g_{\text {min }}(x)=4-\sqrt{34}$. And at the interval endpoints $g\left(-\frac{1}{4}\right)=\frac{1}{25}, g(2)=-\frac{7}{5}$

In summary, $g_{\max }(x)=\frac{1}{25}, g_{\min }(x)=4-\sqrt{34}$