\[X^2 = \sum_{i=1}^n \frac{(E_i - O_i)^2}{E_i}\]