Title: a detailed proof of the chi-square test of goodness of fit