From the binomial formula, we have
2p=Cp0+⋯+Cpp.
Since Cp0=Cpp=1, we also have
2p−2=Cp1+⋯+Cpp−1.
For 1≤k≤p−1, we will find the value of Cpk modulo p2. We know that
Cpk=k!(p−k)!p!=p⋅k!(p−k)!(p−1)!.
Write xk=k!(p−k)!(p−1)!. Note that xk is an integer, because pxk=k!(p−k)!p!=Cpk is clearly an integer, but pxk=Cpk is divisible by p, as there is no factor of p in the denominator. Since
k!=k⋅(k−1)⋅⋯⋅1≡(−1)k(p−k)⋅(p−k+1)⋅⋯⋅(p−1)(modp),
one has
−kxk≡(p−k)xk≡(−1)k(p−1)!(p−k)(p−k)(p−1)!≡(−1)k(modp).
Therefore, (−1)k+1kxk≡1(modp), which yields (−1)k+1xk≡ak(modp) and xk≡(−1)k+1ak(modp). Adding together these congruences, for k=1,…,p−1, we get x1+x2+⋯+xp−2+xp−1≡a1−a2−⋯−ap−2+ap−1(modp). Therefore,
2p−2=Cp1+⋯+Cpp−1≡p(x1+x2+⋯+xp−2+xp−1)≡p(a1−a2+⋯+ap−2−ap−1)(modp2),
as desired.