Expected frequencies are calculated for each cell under the null scenario. William's correction is performed and all statistics must be compared to a Chi-square distribution with appropriate degrees of freedom.
Square matrices are a special case in several regards.
If the matrix is symmetrical, then the upper right and lower left triangles mirror each other. For example, interactions in groups of individuals can only occur with another animal of the group but never with itself. Transition matrices may look at how often each behavior changes into another behavior. In both cases the cells along the diagonal will be empty. If expected frequencies are calculated according to the usual techniques, row and column sums of expected and observed frequencies will not match.