Example 3 In the quadratic function $x^{2}+$ $p x+q$ with the leading coefficient of 1, find the function expression that makes $M=\max \left|x^{2}+p x+q\right|(-1$ $\leqslant x \leqslant 1$ ) take the minimum value.
Analyzing this problem, we can first obtain the inequalities of $p$ and $q$ through the value of the function, and then use the method of magnification and reduction to get the lower bound.
$$
\text{Let } g(x)=\left|x^{2}+p x+q\right|(-1 \leqslant x \leqslant
$$
1), then $g(x)_{\max }$ can only be $|f(1)|$ or $|f(-1)|$ or $\left|\frac{4 q-p^{2}}{4}\right|$.
$$
\begin{aligned}
\because & 4 M \geqslant|f(1)|+|f(-1)|+2|f(0)| \\
& =|1+p+q|+|1-p+q|+2|-q| \\
& \geqslant 2,
\end{aligned}
$$

When and only when $p=0, q=-\frac{1}{2}$, the equality holds,
$$
\therefore M_{\text {min }}=\frac{1}{2} \text {. }
$$

Thus, $f(x)=x^{2}-\frac{1}{2}$.