<s>[INST] An equality about sums of Bernstein polynomials: $\sum_{k=0}^n \left(x - \frac kn\right)^2 p_{nk}(x) = \frac{x(1-x)}{n}$ We defined the Bernstein polynomials as following
$$
p_{nk} 
\ = \
\frac{n!}{k!(n-k)!} x^k(1-x)^{n-k}$$
I have to show this:
$$
\sum_{k=0}^n \left(x - \frac kn\right)^2 p_{nk}(x) \ = \ \frac{x(1-x)}{n}
$$

My own work
It is easy to show that
$$
(1-x+tx)^n \ = \ \sum_{k=0}^n p_{nk}(x)t^k
$$
From this I have deduced that
$$
\sum_{k=0}^n p_{nk}(x) = 1 
\qquad \text{and} \qquad
\sum_{k=0}^n kp_{nk}(x) = nx
\qquad \text{and} \qquad
\sum_{k=0}^n k(k-1)p_{nk}(x) = n(n-1)x^2
$$
Now by dividing and plugging in I got that:
$$
\frac{1}{n}(x-x^2) 
\ = \ 
\frac{1}{n^2(n-1)} \left((n-1)\sum_{k=0}^n kp_{nk}(x) + \sum_{k=0}^n k(k-1)p_{nk}(x)\right)
$$
Which equals
$$
\frac{1}{n^2(n-1)} \sum_{k=0}^n k p_{nk}(x)\left( (n-1) - (k-1)\right)
\ = \ \frac{1}{n^2(n-1)}  \sum_{k=0}^n k p_{nk}(x)(n-k)
$$
The left hand side is equal to this though:
$$
\sum_{k=0}^n \left(x^2  - \frac {2k}n+ \frac{k^2}{n^2}\right) p_{nk}(x)
$$
And these things don't look equal. Please help me!
 [/INST] It is simpler to start from $\sum_{k=0}^n\left(x-\frac kn\right)^2p_{n,k}(x)$, using the fact that $\sum_{k=0}^nk^2p_{n,k}(x)=n(n-1)x^2+nx$. This gives 
\begin{align}
\sum_{k=0}^n\left(x-\frac kn\right)^2p_{n,k}(x)&=x^2-\frac{2x}n\sum_{k=0}^nkp_{n,k}(x)+\frac 1{n^2}(n(n-1)x^2+nx)\\
&=x^2-\frac {2x}n\cdot nx+\frac 1{n^2}(n(n-1)x^2+nx)\\
&=x^2-2x^2+\frac{(n-1)x^2+x}n \\
&=-x^2+x^2+\frac{x-x^2}n\\
&=\frac{x(1-x)}n.
\end{align}
</s>