What is Pearson's chi-squared test?
Goodness of fit tests determine whether a data set's distribution differs significantly from a theoretical distribution. The data must be unpaired.
Tests of independence determine if unpaired observations of two variables are independent of one another.
Using the chi-square formula, you determine your chi-square statistic, your degrees of freedom, and your level of significance, and compare your results to a chi-square distribution table. For the data presented above, we could use the chi-square test to determine if males and females differ in the amount of time (more or less than fifteen hours per week) spent on homework.
Both tests analyze unpaired, categorical data and are used when data is nonparametric. Note: by unpaired, we mean that your categories are independent of one another. These tests also can't be used with very small cell counts, such as expected values lower than five.
The results of your chi-square test will only tell you whether or not your observed values fit your expected values (whether those values are to fit an expected distribution or if your two variables are independent of one another). These tests will not tell you how your observed values differ.
There's a very good tutorial here that walks you through an example in detail.