Example 5 Let $-\frac{\pi}{2} \leqslant x \leqslant \frac{\pi}{2}$, and the equation
$$
\cos 2 x-4 a \cos x-a+2=0
$$

has two distinct solutions. Try to find the range of values for $a$.
(2007, National High School Mathematics Competition Gansu Province Preliminary)
Explanation: From the problem, we have
$$
2 \cos ^{2} x-1-4 a \cos x-a+2=0,
$$

which simplifies to $2 \cos ^{2} x-4 a \cos x-a+1=0$.
Let $t=\cos x$. Given $-\frac{\pi}{2} \leqslant x \leqslant \frac{\pi}{2}$, we know $0 \leqslant t \leqslant 1$.
Thus, the original equation having two distinct solutions is equivalent to the equation $2 t^{2}-4 a t-a+1=0$ having one solution in the range $0<t \leqslant 1$.
$$
\text { Let } f(t)=2 t^{2}-4 a t-a+1 \text {. }
$$
(1) When the discriminant is greater than zero, it is sufficient that
$$
\begin{array}{l}
\left\{\begin{array}{l}
f(0) f(1) \leqslant 0, \\
f(0) \neq 0
\end{array}\right. \\
\Rightarrow\left\{\begin{array}{l}
(-a+1)(-5 a+3) \leqslant 0, \\
-a+1 \neq 0
\end{array}\right. \\
\Rightarrow \frac{3}{5} \leqslant a<1 .
\end{array}
$$