Official solution:
Let $P(x) = (x - x_0)(x - x_1) \cdots(x - xn)(x - x_{n+1})$. Then
\[P'(x)=\sum_{j=0}^{n+1} \frac{P(x)}{x-x_j} \quad \text{ and } \quad P''(x)=\sum_{j=0}^{n+1} \sum_{k \neq j} \frac{P(x)}{(x-x_j)(x-x_k)}\]
Therefore
\[P''(x_i)=2P'(x_i) \sum_{j \neq i} \frac{1}{x_i-x_j}\]
for $i = 0, 1, \cdots, n + 1$, and the given condition implies $P''(x_i) = 0$ for $i = 1, 2, \cdots , n$. Consequently,
\[x(x - 1)P''(x) = (n + 2)(n + 1)P(x) \qquad \qquad \text{(1)}\]
It is easy to observe that there is a unique monic polynomial of degree $n+2$ satisfying differential equation $\text{(1)}$. On the other hand, the polynomial $Q(x) = (-1)^nP(1 - x)$ also satisfies this equation, is monic, and $%Error. "degQ" is a bad command.
= n + 2$. Therefore $(-1)^nP(1 - x) = P(x)$, and the result follows.