I am trying to get my head round the chi square test, when used with the Caesar cipher. I started off using this formula,
$$ X = \sum_{i = 1}^k \frac{f_i · f'_i}{n · n'} $$
Where $k$ is the number of distinct letters in the alphabet, $f$ is the number of times the $i$-th letter appears in the first string and $f'$ is the number of times the $i$-th letter appears in the second string. And $n$ and $n'$ are the total number of characters in the first and second strings.
However when I run this, the highest value is not always the correct result. I was expecting values to be around 0.0650, however my correct answer is coming out around 0.0700. Is this the right way of calculating the Chi value?
The formula on Wikipedia is a completely different formula, and the values should be near to 0 for the correct answer? Which has confused me.