Derivation of chi square distribution. .