Abstract
A Krawtchouk polynomial is introduced as the classical Mac-Williams identity, which can be expressed in weight-enumerator-free form of a linear code and its dual code over a Hamming scheme. In this paper we find a new explicit expression for the $p$-number and the $q$-number, which are more generalized notions of the Krawtchouk polynomial in the P-polynomial schemes by using an extended version of a discrete Green's function. As corollaries, we obtain a new expression of the Krawtchouk polynomial over the Hamming scheme and the Eberlein polynomial over the Johnson scheme. Furthermore, we find another version of the MacWilliams identity over a Hamming scheme.