Chi-Square Test Formula
Chi-square test is a hypothesis test that compares observed frequencies to expected frequencies using the chi-square statistic to assess independence or goodness of fit.
The Formula
Ask yourself: Are the data counts of cases falling into categories, being compared to expected counts (rather than means or continuous values)?
Quick example
Notation
What this formula means
A hypothesis test that compares observed frequencies to expected frequencies using the chi-square statistic to assess independence or goodness of fit.
The chi-square statistic is a surprise score for a tally sheet. Each category adds its own surprise, the squared miss scaled by what was expected, and the total says how far the whole sheet strays from the prediction. Like any score, it means something only next to what chance alone usually produces, which the degrees of freedom pin down.
Formal view
Worked examples
Example 1
mediumShow solution
Answer
First step
See the full worked solution + why-it-works coaching
SetupKey insightWhy it worksCommon pitfallConnection
Example 2
hardExample 3
mediumCommon mistakes
- Dividing by Observed instead of Expected - the formula is , scaling each gap by the expected count.
- Using percentages or means as the data - chi-square requires raw category counts, not proportions or averages.
- Using the wrong degrees of freedom - goodness-of-fit uses ; a two-way independence test uses .
Why this formula matters
Many questions have category answers, not numbers: is a die fair, do candy colors match the company's stated mix, does favorite lunch depend on grade? Means and -tests can't handle these. The chi-square test gives one statistic for a whole table of counts, plus a p-value, so "these counts look a bit uneven" becomes a decision about whether the unevenness is more than chance.
Frequently asked questions
What is the Chi-Square Test formula?
A hypothesis test that compares observed frequencies to expected frequencies using the chi-square statistic to assess independence or goodness of fit.
How do you use the Chi-Square Test formula?
Use a chi-square test when the data are counts of cases in categories and the question is whether they fit a stated distribution (goodness of fit, ) or whether two categorical variables are independent (two-way table, ). Each expected count should be at least about 5. If the data are numeric measurements and you are comparing means, use a -test. For exactly two proportions, a two-proportion -test gives the same answer as a 2×2 chi-square test.
What do the symbols mean in the Chi-Square Test formula?
is the test statistic. Degrees of freedom: goodness-of-fit ; independence/homogeneity .
Why is the Chi-Square Test formula important in Math?
Many questions have category answers, not numbers: is a die fair, do candy colors match the company's stated mix, does favorite lunch depend on grade? Means and -tests can't handle these. The chi-square test gives one statistic for a whole table of counts, plus a p-value, so "these counts look a bit uneven" becomes a decision about whether the unevenness is more than chance.
What do students get wrong about Chi-Square Test?
The procedure for chi-square test is the easy part; the trap is dividing by Observed instead of Expected. Asking "Are the data counts of cases falling into categories, being compared to expected counts (rather than means or continuous values)?" first is what keeps a correct-looking calculation from being attached to the wrong concept.
What should I learn before the Chi-Square Test formula?
Before studying the Chi-Square Test formula, you should understand: hypothesis testing, p value, probability.