In a two-way table, if ##R_i## is the total number in row ##i## and ##C_j## the total number in column ##j## then ##f_i = R_i/N## is the estimated probability of the event for row ##i## and ##g_j = C_j/N## is the estimated probability of the event for column ##j##. Here, ##N = \sum_i R_i = \sum_j C_j## is the total number of observations. Under the hypothesis of independence between rows and columns, the estimated probabilty of the cell ##(i,j)## is ##\bar{p}_{ij} = f_i \,g_j = R_i C_j/N^2.## Thus, the expected frequency of cell ##(i,j)## is ##E_{ij} = N \bar{p}_{ij} = R_i C_j/N.##