I am trying to interpret the formula for index of coincidence from here

Index of coincidence

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.$

| improve this answer | |
  • $\begingroup$ 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$$ $\endgroup$ – kodlu Apr 20 '15 at 1:16
  • $\begingroup$ 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 $\endgroup$ – ARG Apr 20 '15 at 11:56
  • $\begingroup$ 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. $\endgroup$ – kodlu Apr 21 '15 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.