# Zipf's Law for Random Texts

#### Jaider

we let there be M letters and one space that our random monkey can type, each with probability
$image=http://latex.codecogs.com/gif.latex?p%3D%5Cfrac%7B1%7D%7BM+1%7D&hash=517368d2aa594a0dc77d2b4e90e44c6b$
A word is formed when a string of letters of any size is preceded and followed by a space, denoted by _ here. The probability of getting the word _a_ is p3, and that of an L-letter word, pL+2 . So the frequency of occurrence of any word with length L is
$image=http://latex.codecogs.com/gif.latex?f_%7Bi%7D%3Dcp%5E%7BL+2%7D&hash=e9550ce71631d1bb73c003974d07e880$
where c is a normalization constant. There are ML such words with lenght L. The constant c is to be determined by the convention that the frequency of occurrence of all words is normalized to 1:
$image=http://latex.codecogs.com/gif.latex?1%3D%5Csum_%7BL%3D1%7D%5E%7Binfinity%7DM%5E%7BL%7D%5Cfrac%7Bc%7D%7B%28M+1%29%5E%7BL+2%7D%7D&hash=f8ddde8a7512bf9284cf8e969fc2859b$
The frequency of occurrence of all words of length L is
$image=http://latex.codecogs.com/gif.latex?f%28L%29%3DM%5E%7BL%7Df_%7Bi%7D%28L%29&hash=baff4cee5987bdf78bf36c8ce23bdbda$
a. Show that
$image=http://latex.codecogs.com/gif.latex?f%28L%29%3D%5Cfrac%7BM%5E%7BL-1%7D%7D%7B%28M+1%29%5E%7BL%7D%7D&hash=32da7e079e6def27a51adb577daf346e$
b. To convert word lenth L into rank, we note that the formula for fi implies that shorter words (those with smaller values of L) should occur more frequently and hence have a lower value for the rank k(L). The rank is easy to understand (the most frequently occurring word is of rank 1, the next is rank 2, etc.) but it is difficult to define mathematically. Nevertheless, argue that the rank can be exressed as
$image=http://latex.codecogs.com/gif.latex?k%28L%29%3D%5Calpha%20M%5E%7BL%7D-%5Cbeta&hash=02ae5b58e8e33f18ee12f81b84f6b00b$
, for some constants
$image=http://latex.codecogs.com/gif.latex?%5Calpha&hash=b423886f475dcc5d2053542a4f05025b$
and
$image=http://latex.codecogs.com/gif.latex?%5Cbeta&hash=d4e2d349018bc6e29b3c3146d6ce0250$
. This yields, upon taking the log with base M:
$image=http://latex.codecogs.com/gif.latex?L%3Dlog_%7BM%7D%28%5Calpha%5E%7B-1%7D%28k+%5Cbeta%20%29%29&hash=ef22412cfddc4d1c97f4368f1b410099$
. Substituting this expression for L into the formula in (a), show that f satisfies the following generalized Zipf's Law:
$image=http://latex.codecogs.com/gif.latex?f%3DC%28k+%5Cbeta%20%29%5E%7B-b%7D&hash=370fa195d89cdee6c5dc2077c3438cbb$
where
$image=http://latex.codecogs.com/gif.latex?b%3D%5Cfrac%7Bln%28M+1%29%7D%7Bln%28M%29%7D-1&hash=0255d19e48cf416b830e696993a6d5d5$
. Show that
$image=http://latex.codecogs.com/gif.latex?b%5Csim%200&hash=b9bd42d04e3e7f36c8208f9f60cba0af$
(hint:you need to use the technique of change of base for the logarithmic function so that you can show that f satisfies the generalized Zipf's law)