Example 3 Find all polynomials $P(x)$ that satisfy $P(0)=0$ and $P(x)=\frac{1}{2}[P(x+1)+P(x-1)]$ for all $x \in \mathbf{R}$.
(1975 New York Competition Problem)
Solving: We infer that the polynomial $P(x)=a x$ satisfies the conditions in the problem, where $a$ is a constant. Next, we use mathematical induction to prove that the desired polynomial $P(x)$ satisfies the condition $P(n)=n P(1)$ for non-negative integers $n$.
When $n=0$ and $n=1$, the equation is obviously true.
Assume the equation holds for $n-1$ and $n$, where $n \in \mathbf{N}$, then
$P(n+1)=2 P(n)-P(n-1)=(n+1) P(1)$, which means the equation also holds for $n+1$.
Therefore, the polynomial $F(x)=P(x)-P(1) x$ has infinitely many roots $x=0,1,2, \cdots$ and thus $F(x)$ should be the zero polynomial. Hence, the desired polynomial has the form $P(x)=a x$.

For a real-coefficient polynomial $f(x)$, we can infer that if $\alpha$ is a complex root, then the conjugate of $\alpha$, $\bar{\alpha}$, is also a root.