# Step 4 - Plugging Numbers Into The Formula

Now we are ready to work with the entire chi-square formula. We will slowly walk you through the formula. Strictly defined, chi-square is the sum (from each phenotypic class) of the squares of observed values minus expected values, divided by expected values. Although this sounds extremely intimidating to many people the first time they see that, it often seems less so after we plug our values into the formula below.

The formula for calculating the X^{2} value is:

X^{2} = Σ ((observed – expected)^{2 }/ expected)

From our example, we will expand our table (Table 2). Notice that for each class, we square the deviations and then divide that number by the expected number in that particular class. The final chi-square value is the sum of all the individual class values.

Class | Observed (O) |
Expected (E) |
Deviation (O-E) |
(O-E)^{2} |
(O-E)^{2}/E |

Resistant | 141 | 147.75 | -6.75 | 45.5625 | 0.3084 |

Susceptible | 56 | 49.25 | +6.75 | 45.5625 | 0.9251 |

X^{2} Sum = |
1.2335 |

Watch the tutorial video clip below for further explaining where these numbers came from if it is not clear to you.