Kravchuk polynomials

Kravchuk polynomials or Krawtchouk polynomials (also written using several other transliterations of the Ukrainian surname Кравчу́к) are discrete orthogonal polynomials associated with the binomial distribution, introduced by. The first few polynomials are (for q = 2):
 * $$\mathcal{K}_0(x; n) = 1,$$
 * $$\mathcal{K}_1(x; n) = -2x + n,$$
 * $$\mathcal{K}_2(x; n) = 2x^2 - 2nx + \binom{n}{2},$$
 * $$\mathcal{K}_3(x; n) = -\frac{4}{3}x^3 + 2nx^2 - (n^2 - n + \frac{2}{3})x + \binom{n}{3}.$$

The Kravchuk polynomials are a special case of the Meixner polynomials of the first kind.

Definition
For any prime power q and positive integer n, define the Kravchuk polynomial


 * $$\mathcal{K}_k(x; n,q) = \mathcal{K}_k(x) = \sum_{j=0}^{k}(-1)^j (q-1)^{k-j} \binom {x}{j} \binom{n-x}{k-j}, \quad k=0,1, \ldots, n.$$

Properties
The Kravchuk polynomial has the following alternative expressions:


 * $$\mathcal{K}_k(x; n,q) = \sum_{j=0}^{k}(-q)^j (q-1)^{k-j} \binom {n-j}{k-j} \binom{x}{j}. $$
 * $$\mathcal{K}_k(x; n,q) = \sum_{j=0}^{k}(-1)^j q^{k-j} \binom {n-k+j}{j} \binom{n-x}{k-j}. $$

Symmetry relations
For integers $$i,k \ge 0$$, we have that
 * $$\begin{align}

(q-1)^{i} {n \choose i} \mathcal{K}_k(i;n,q) = (q-1)^{k}{n \choose k} \mathcal{K}_i(k;n,q). \end{align}$$

Orthogonality relations
For non-negative integers r, s,


 * $$\sum_{i=0}^n\binom{n}{i}(q-1)^i\mathcal{K}_r(i; n,q)\mathcal{K}_s(i; n,q) = q^n(q-1)^r\binom{n}{r}\delta_{r,s}. $$

Generating function
The generating series of Kravchuk polynomials is given as below. Here $$z$$ is a formal variable.
 * $$\begin{align}

(1+(q-1)z)^{n-x}(1-z)^x &= \sum_{k=0}^\infty \mathcal{K}_k(x;n,q) {z^k}. \end{align}$$

Three term recurrence
The Kravchuk polynomials satisfy the three-term recurrence relation
 * $$\begin{align}

x \mathcal{K}_k(x;n,q) = - q(n-k) \mathcal{K}_{k+1}(x;n,q) + (q(n-k) + k(1-q)) \mathcal{K}_{k}(x;n,q) - k(1-q)\mathcal{K}_{k-1}(x;n,q). \end{align}$$