was a compartmentalized box for printing in the 19th century, sizes corresponding to the commonality of letters The frequency of letters in text has been studied for use in
cryptanalysis, and
frequency analysis in particular, dating back to the Arab mathematician
al-Kindi (c. AD 801–873 ), who formally developed the method (the ciphers breakable by this technique go back at least to the
Caesar cipher used by
Julius Caesar, so this method could have been explored in classical times). Letter frequency analysis gained additional importance in Europe with the development of movable type in AD 1450, wherein one must estimate the amount of type required for each letterform, as evidenced by the variations in letter compartment size in typographer's type cases. No exact letter frequency distribution underlies a given language, since all writers write slightly differently. However, most languages have a characteristic distribution which is strongly apparent in longer texts. Even language changes as extreme as from
Old English to modern English (regarded as mutually unintelligible) show strong trends in related letter frequencies: over a small sample of Biblical passages, from most frequent to least frequent, '
of Old English compares to ' of modern English, with the most extreme differences concerning letterforms not shared.
Linotype machines for the English language assumed the letter order, from most to least common, to be '
based on the experience and custom of manual compositors. The equivalent for the French language was '. Arranging the alphabet in Morse into groups of letters that require equal amounts of time to transmit, and then sorting these groups in increasing order, yields ''''''. Letter frequency was used by other telegraph systems, such as the
Murray Code. Similar ideas are used in modern
data-compression techniques such as
Huffman coding. Letter frequencies, like
word frequencies, tend to vary, both by writer and by subject. For instance, occurs with greater frequency in fiction, as most fiction is written in past tense and thus most verbs will end in the inflectional suffix
-ed / -d. One cannot write an essay about x-rays without using frequently, and the essay will have an idiosyncratic letter frequency if the essay is about, say, Queen Zelda of
Zanzibar requesting
X-rays from
Qatar to examine
hypoxia in
zebras. Different authors have habits which can be reflected in their use of letters.
Hemingway's writing style, for example, is visibly different from
Faulkner's. Letter,
bigram,
trigram, word frequencies, word length, and sentence length can be calculated for specific authors and used to prove or disprove authorship of texts, even for authors whose styles are not so divergent. Accurate average letter frequencies can only be gleaned by analyzing a large amount of representative text. With the availability of modern computing and collections of large
text corpora, such calculations are easily made. Examples can be drawn from a variety of sources (press reporting, religious texts, scientific texts and general fiction) and there are differences especially for general fiction with the position of and , with becoming more common. Different dialects of a language will also affect a letter's frequency. For example, an author in the United States would produce something in which is more common than an author in the United Kingdom writing on the same topic: words like "analyze", "apologize", and "recognize" contain the letter in American English, whereas the same words are spelled "analyse", "apologise", and "recognise" in British English. This would highly affect the frequency of the letter , as it is rarely used by British writers in the English language. The "top twelve" letters constitute about 80% of the total usage. The "top eight" letters constitute about 65% of the total usage. Letter frequency as a function of rank can be fitted well by several rank functions, with the two-parameter
Cocho/Beta rank function being the best. Another rank function with no adjustable free parameter also fits the letter frequency distribution reasonably well (the same function has been used to fit the amino acid frequency in protein sequences.) A spy using the
VIC cipher or some other cipher based on a
straddling checkerboard typically uses a mnemonic such as "a sin to err" (dropping the second "r") or "at one sir" to remember the top eight characters. ==Relative frequencies of letters in the English language==