The formula for chi square is:

where χ² is the symbol for the chi square, E is an expected cell frequency, and O is an observed cell frequency. The Σ symbol is summation notation and means to sum up the quantity over both cells. Therefore, the formula says that for each cell you

- take the absolute value of the difference
between the expected cell frequency and the observed cell frequency

- subtract
0.5 (the correction for
continuity)

- square the result,

- divide by the
expected frequency,

- and finally, sum up the values across the cells.