# Words in “index of coincidence” in relation to the Vigenère cipher

I am trying to interpret the formula for index of coincidence from here I am not understanding $f_i$. How can I calculate $f_i$ in this context? Is this the appearance of single word like (a) in the whole sentence or what ? I am trying to solve it manually without using the mentioned website tool, but I am getting the wrong answer.

Here $f_i$ is simply the number of times the character $i$ appears in the ciphertext of length $N$ and where $Z$ is the alphabet size.
If you had ciphertext ADCXU ZMDYZ DXZUM and which was derived from English plaintext then $N=15$ and $f_A=1,f_B=0,f_C=1, f_D=3,\ldots, f_Z=2.$
• So, for your example there are 9 characters [ignore spaces] and unless $f_i \geq 2$ the contribution to the sum in the numerator is zero. Also ignore capital vs lowercase letters. So using $f_d=2$ and $f_e=3$ gives $$\frac{2\times 1 + 3\times 2}{9\times 8}=\frac{8}{72}=\frac{1}{9}=0.1111\cdots$$ Apr 20, 2015 at 1:16
• Right thanks for explaining but why 2x1 and 3x2 ? Though i know 2 are d and 3 are 'e' but why multiply d with 1 and e with 2
• The letters are indexed by $i$ in the equation. So when $i=e,$ $f_e=3$ since $e$ appears 3 times ($f$ for frequency) and $f_e(f_e-1)=3\times 2.$ This is also why the letters with frequency 1, don't count in the sum since $f_a(f_a-1)=1\times 0=0$ for example. You can't have a coincidence with only one occurence. Apr 21, 2015 at 0:01