Example 1 Let $a \in \mathbf{R}$, and the function
$$
f(x)=a x^{2}+x-a \quad(|x| \leqslant 1) .
$$
(1) If $|a| \leqslant 1$, prove: $|f(x)| \leqslant \frac{5}{4}$;
(2) Find the value of $a$ that makes the function $f(x)$ have a maximum value of $\frac{17}{8}$.
(2003, Anhui Province High School Mathematics Competition)
$$
\begin{array}{l}
\text { (1) Proof: }|f(x)|=\left|a x^{2}+x-a\right| \\
=\left|a\left(x^{2}-1\right)+x\right| \leqslant\left|a\left(x^{2}-1\right)\right|+|x| \\
\leqslant\left|x^{2}-1\right|+|x|=1-|x|^{2}+|x| \\
=-\left(|x|-\frac{1}{2}\right)^{2}+\frac{5}{4} \leqslant \frac{5}{4} .
\end{array}
$$
(2) Solution: When $a=0$, $f(x)=x(|x| \leqslant 1)$ has a maximum value of $f(1)=1$, which contradicts the given condition.
When $a \neq 0$, $f(x)$ is a quadratic function.
(i) When $a>0$, the parabola opens upwards, so the maximum value can only be obtained at $x=-1$ or $x=1$. However, $f(-1)$ $=a-1-a=-1, f(1)=a+1-a=1$, which does not match the given condition.
(ii) When $a<0$, the maximum value cannot be obtained at $x=\pm 1$. Therefore, for $f(x)=a x^{2}+x-a(|x|$ $\leqslant 1$ ) to have a maximum value of $\frac{17}{8}$, it must be that
$$
\begin{array}{l}
\left\{\begin{array}{l}
-1<-\frac{1}{2 a}<1, \\
f\left(-\frac{1}{2 a}\right) \\
a<0
\end{array}\right. \\
\Rightarrow a=\frac{17}{8}, \Rightarrow\left\{\begin{array}{l}
a<-\frac{1}{2}, \\
(a+2)\left(a+\frac{1}{8}\right)=0
\end{array}\right. \\
\Rightarrow a=-2 .
\end{array}
$$