Proof of Lucas' Theorem
Let n=(nlnl−1…n0)p and k=(klkl−1…k0)p denote the base p representations of n,k.
** Definition. ** Let f(x) be a generating function. Then [xn]f(x) denotes the coefficient of xn in f(x).
We then have the following:
\begin{align*}
\binom{n}{k} &= [x^k](1 + x)^n & \text{By the Binomial Theorem}\
&= [x^k] (1 + x)^{n_0 + n_1 p + n_2 p^2 + \dots + n_l p^l}\
&= [x^k]\prod_{i = 0}^l [(1 + x)^{n_i p^i}]\
&= [x^k]\prod_{i = 0}^l [(1 + x)^{p^i}]^{n^i}\
&\equiv_p [x^k] \prod_{i = 0}^l (1 + x^{p^i})^{n^i} & \text{By expanding (x+1)pi modulo p}\
&= [x^k]\prod_{i = 0}^l \sum_{j_i = 0}^{n_i} \binom{n_i}{j_i}(x^{p^i})^{j_i} & \text{By the Binomial Theorem}\
&= [x^k]\prod_{i = 0}^l \sum_{j_i = 0}^{n_i} \binom{n_i}{j_i}(x^{j_ip^i})
\end{align*}
Now this looks pretty ugly, but it'll work out. Since we are only concerned with the coefficients of xk, the only term that matters from the ith product term is (kini)(xkipi), since the representation of k in base p is unique.
It then follows that [xk]∏i=0l∑ji=0ni(jini)(xjipi)=∏i=0l(kini) as desired.