# Zipf's law

Parameters Probability mass functionPlot of the Zipf PMF for N=10Zipf PMF for N=10 on a log-log scale. The horizontal axis is the index k . (Note that the function is only defined at integer values of k. The connecting lines do not indicate continuity.) Cumulative distribution functionPlot of the Zipf CMF for N=10Zipf CMF for N=10. The horizontal axis is the index k . (Note that the function is only defined at integer values of k. The connecting lines do not indicate continuity.) ${\displaystyle s>0\,}$ (real)${\displaystyle N\in \{1,2,3\ldots \}}$ (integer) ${\displaystyle k\in \{1,2,\ldots ,N\}}$ ${\displaystyle {\frac {1/k^{s}}{H_{N,s}}}}$ ${\displaystyle {\frac {H_{k,s}}{H_{N,s}}}}$ ${\displaystyle {\frac {H_{N,s-1}}{H_{N,s}}}}$ ${\displaystyle 1\,}$ ${\displaystyle {\frac {s}{H_{N,s}}}\sum _{k=1}^{N}{\frac {\ln(k)}{k^{s}}}+\ln(H_{N,s})}$ ${\displaystyle {\frac {1}{H_{N,s}}}\sum _{n=1}^{N}{\frac {e^{nt}}{n^{s}}}}$ ${\displaystyle {\frac {1}{H_{N,s}}}\sum _{n=1}^{N}{\frac {e^{int}}{n^{s}}}}$

Originally, Zipf's law stated that, in a corpus of natural language utterances, the frequency of any word is roughly inversely proportional to its rank in the frequency table. So, the most frequent word will occur approximately twice as often as the second most frequent word, which occurs twice as often as the fourth most frequent word, etc. The term has come to be used to refer to any of a family of related power law probability distributions.

The "law" was publicized by Harvard linguist George Kingsley Zipf (IPA [zɪf]).

For example, in the Brown Corpus "the" is the most frequently occurring word, and all by itself accounts for nearly 7% of all word occurrences (69971 out of slightly over 1 million). True to Zipf's Law, the second-place word "of" accounts for slightly over 3.5% of words (36411 occurrences), followed by "and" (28852). Only 135 vocabulary items are needed to account for half the Brown Corpus.

Zipf's law is thus an empirical law, not a theoretical one. Zipfian distributions are commonly observed, in many kinds of phenomena. The causes of Zipfian distributions in real life are a matter of some controversy, however. The fact that Zipfian distributions arise in randomly-generated texts with no linguistic structure suggests that the law as applied to languages may in part be a statistical artifact.[1]

Zipf's law is most easily observed by scatterplotting the data, with the axes being log(rank order) and log(frequency). For example, "the" as described above would appear at x = log(1), y = log(69971). If the points are close to a single straight line, the distribution follows Zipf's law.

The simplest case of Zipf's law is a "1/f function". Given a set of Zipfian distributed frequencies, sorted from most common to least common, the second most common frequency will occur ½ as often as the first. The third most common frequency will occur 1/3 as often as the first. The nth most common frequency will occur 1/n as often as the first. However, this cannot hold precisely true, because items must occur an integer number of times: there cannot be 2.5 occurrences of a word. Nevertheless, over fairly wide ranges, and to a fairly good approximation, many natural phenomena obey Zipf's law.

## Theoretical issues

Zipf's law may be stated mathematically as:

${\displaystyle f(k;s,N)={\frac {1/k^{s}}{\sum _{n=1}^{N}1/n^{s}}}}$

where N  is the number of elements, k  is their rank, and s  is the exponent characterizing the distribution. In the example of the frequency of words in the English language, N  is the number of words in the English language and, if we use the classic version of Zipf's law, the exponent s is 1. f(ks,N) will then be the fraction of the time the kth most common word occurs. It is easily seen that the distribution is normalized:

${\displaystyle \sum _{k=1}^{N}f(k;s,N)=1.}$

The law may also be written:

${\displaystyle f(k;s,N)={\frac {1}{k^{s}H_{N,s}}}}$

where HN,s is the Nth generalized harmonic number.

Mathematically, it is impossible for the classic version of Zipf's law to hold exactly if there are infinitely many words in a language, since the sum of all relative frequencies in the denominator above is equal to the harmonic series and therefore:

${\displaystyle \sum _{n=1}^{\infty }{\frac {1}{n}}=\infty \!}$

Empirical research has found that in English, the frequencies of the approximately 1000 most-frequently-used words are approximately proportional to 1/ns where s is just slightly more than one.

As long as the exponent s exceeds 1, it is possible for such a law to hold with infinitely many words, since if s > 1 then

${\displaystyle \zeta (s)=\sum _{n=1}^{\infty }{\frac {1}{n^{s}}}<\infty .\!}$

where ζ is Riemann's zeta function.

## Related laws

File:Wikipedia-n-zipf.png
A plot of word frequency in Wikipedia (November 27, 2006). The plot is in log-log coordinates. x  is rank of a word in the frequency table; y  is the total number of the word’s occurences. Most popular words are “the”, “of” and “and”, as expected. Zipf's law corresponds to the upper linear portion of the curve, roughly following the green (1/x)  line.

The term Zipf's law has come more generally to refer to frequency distributions of "rank data" in which the relative frequency of the nth-ranked item is given by the Zeta distribution, 1/(nsζ(s)), where s > 1 is a parameter indexing this family of probability distributions. Indeed, the term Zipf's law sometimes simply means the zeta distribution, since probability distributions are sometimes called "laws". This distribution is sometimes called the Zipfian distribution or Yule distribution.

A more general law proposed by Benoît Mandelbrot has frequencies

${\displaystyle f(k;N,q,s)=[{\mbox{constant}}]/(k+q)^{s}.\,}$

This is the Zipf-Mandelbrot law. The "constant" in this case is the reciprocal of the Hurwitz zeta function evaluated at s.

In the tail of the Yule-Simon distribution the frequencies are approximately

${\displaystyle f(k;\rho )\approx [{\mbox{constant}}]/k^{\rho +1}}$

for any choice of ρ > 0.

The log-normal distribution is the distribution of a random variable whose logarithm is normally distributed, useful when small fluctuations multiply a quantity rather than add to it.

In the parabolic fractal distribution, the logarithm of the frequency is a quadratic polynomial of the logarithm of the rank. This can markedly improve the fit over a simple power-law relationship.[2] Like fractal dimension, it is possible to calculate Zipf dimension, which is a useful parameter in the analysis of texts.[3]

It has been pointed out that Zipfian distributions can also be regarded as being Pareto distributions with an exchange of variables.[2]

It has been argued that Benford's law is a special case of Zipf's law.[2]

• George K. Zipf, Human Behaviour and the Principle of Least-Effort, Addison-Wesley, Cambridge MA, 1949
• George K. Zipf, The Psychobiology of Language, Houghton-Mifflin, New York, NY, 1935 (see citations at http://citeseer.ist.psu.edu/context/64879/0 )
• Alexander Gelbukh, Grigori Sidorov. "Zipf and Heaps Laws’ Coefficients Depend on Language". Proc. CICLing-2001, Conference on Intelligent Text Processing and Computational Linguistics, February 18–24, 2001, Mexico City. Lecture Notes in Computer Science N 2004, ISSN 0302-9743, ISBN 3-540-41687-0, Springer-Verlag, pp. 332–335.
• Damián H. Zanette. Zipf's law and the creation of musical context, Musicae Scientiae, 10(1), pp.3-18, 2006. Online preprint at http://xxx.arxiv.org/abs/cs.CL/0406015
• Kali R. The city as a giant component: a random graph approach to Zipf's law. Applied Economics Letters, 15 September 2003, vol. 10, iss. 11, pp. 717-720(4)
• Gabaix, Xavier (1999). "Zipf's Law for Cities: An Explanation". Quarterly Journal of Economics. 114 (3): 739–67. ISSN 0033-5533. Unknown parameter |quotes= ignored (help); Unknown parameter |month= ignored (help)