In every language letters have a characteristic frequency. A substitution cipher changes the symbols but not their distribution — compare the histograms and break the cipher.

I’ll give you a language — point out its most frequent letter. It is the one that gives the substitution away in cryptanalysis.
What is going on here?
In every language, letters appear with a fixed, characteristic frequency. In Polish the most frequent are A, I, O, E, in English E, T, A. This “signature” of a language is very robust — a few hundred characters are enough for it to show.
Relative letter frequency:
where is the number of occurrences of the letter and — the total number of letters in the text. The set of values is exactly the frequency distribution that we draw as a histogram.
Why does this break a substitution cipher?
A substitution cipher replaces each letter with another fixed symbol (here: a shift of positions). This is only a relabelling — the letter assigned to a symbol still occurs just as often:
That is why the ciphertext histogram has exactly the same shape as the plaintext histogram — only shifted and relabelled. The most frequent ciphertext symbol almost certainly corresponds to the most frequent letter of the language. Matching the tallest bars reveals the substitution.
The invariant:
Substitution preserves the frequency distribution — it only changes the names of the symbols. The shape of the histogram is invariant under substitution, and it is the shape, not the text length, that gives the cipher away.
A bit of history:
Frequency analysis was described as early as the 9th century by the Arab scholar al-Kindi in a treatise on reading encrypted messages — the first known account of cryptanalysis. The same idea later broke the famous Vigenère cipher and still forms the foundation of classical cryptanalysis.
Why you need this for the exam:
Frequency analysis is a flagship example that information can “leak” even through a seemingly secure cipher. The trick: look for what a transformation leaves unchanged — the invariant. Here it is the frequency distribution.
Remember: substitution shuffles labels but not frequencies — the most frequent cipher symbol is the most frequent letter of the language.
A substitution cipher replaces each letter with another according to a fixed mapping, but does not change how often it occurs. The frequency histogram stays the same — only the symbol labels change.
The most frequent symbol in the ciphertext corresponds to the most frequent letter of the language (in English, usually the letter E). By matching the distributions, we recover the letter mapping.
Even a huge key space (for letters as many as ) offers no protection if the statistics of the text "shine through" the cipher.
Notation: the number of possible alphabet substitutions.
By analyzing symbol frequencies — the most frequent one in the ciphertext corresponds to the most frequent letter of the language.
Because substitution changes only the symbol labels, not the shape of the frequency distribution.
Teaching? Embed this experiment on your site.
Free widget — paste it on your school site, blog or notes. It links to the full version.