ArticleslgStudy

mathematics

Heaps's law

Heaps's law is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Heaps's law rather than just read about it. In short: In linguistics, Heaps's law (sometimes spelled as Heaps' law), also called Herdan's law, is an empirical law which describes the number of distinct words in a document (or set of documents) as a function of the document length (so called type-token relation). It can be formulated as V R ( n ) = K n β {\displaystyle V_{R}(n)=Kn^{\beta }} where VR is the number of distinct words in an instance text of size n.

Heaps's law — main illustration
Heaps's law — illustration

Key takeaways

  • Heaps's law belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Heaps's law to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Heaps's law from memory before moving on to harder problems.

Reference excerpt

In linguistics, Heaps's law (sometimes spelled as Heaps' law), also called Herdan's law, is an empirical law which describes the number of distinct words in a document (or set of documents) as a function of the document length (so called type-token relation). It can be formulated as

V R ( n ) = K n β {\displaystyle V_{R}(n)=Kn^{\beta }}

where VR is the number of distinct words in an instance text of size n. K and β are free parameters determined empirically. With English text corpora, typically K is between 10 and 100, and β is between 0.4 and 0.6. The law is frequently attributed to Harold Stanley Heaps, but was originally discovered by Gustav Herdan (1960). Under mild assumptions, the Herdan–Heaps law is asymptotically equivalent to Zipf's law concerning the frequencies of individual words within a text. This is a consequence of the fact that the type-token relation (in general) of a homogenous text can be derived from the distribution of its types. Empirically, Heaps's law is preserved even when the document is randomly shuffled, meaning that it does not depend on the ordering of words, but only the frequency of words. This is used as evidence for deriving Heaps's law from Zipf's law. Heaps's law means that as more instance text is gathered, there will be diminishing returns in terms of discovery of the full vocabulary from which the distinct terms are drawn. Deviations from Heaps's law, as typically observed in English text corpora, have been identified in corpora generated with large language models. Heaps's law also applies to situations in which the "vocabulary" is just some set of distinct types which are attributes of some collection of objects. For example, the objects could be people, and the types could be country of origin of the person. If persons are selected randomly (that is, we are not selecting based on country of origin), then Heaps's law says we will quickly have representatives from most countries (in proportion to their population) but it will become increasingly difficult to cover the entire set of countries by continuing this method of sampling. Heaps's law has been observed also in single-cell transcriptomes considering genes as the distinct objects in the "vocabulary".

See also

References

Citations

Sources

External links Media related to Heaps' law at Wikimedia Commons

Illustrations

Heaps's law: Verification of Heaps's law on War and Peace, as well as a randomly shuffled version of it. Both cases fit well to the Heaps's law with very similar exponents β, but different K.
Verification of Heaps's law on War and Peace, as well as a randomly shuffled version of it. Both cases fit well to the Heaps's law with very similar exponents β, but different K.
Heaps's law: A schematic Heaps-law plot. The x-axis represents the text size, and the y-axis represents the number of distinct vocabulary elements present in the text. Compare the values of the two axes.
A schematic Heaps-law plot. The x-axis represents the text size, and the y-axis represents the number of distinct vocabulary elements present in the text. Compare the values of the two axes.

Worked examples

Example 1 — a first encounter with Heaps's law

Start with the simplest possible case. Write down what Heaps's law claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Heaps's law before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Heaps's law ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Heaps's law

In research
Heaps's law appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Heaps's law in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Heaps's law is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational linguistics, Empirical laws, Eponymous rules, so understanding it makes those chapters shorter.
In everyday life
Look for Heaps's law outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Heaps's law” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Heaps's law in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Heaps's law means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Heaps's law out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Heaps's law in simple terms?

In linguistics, Heaps's law (sometimes spelled as Heaps' law), also called Herdan's law, is an empirical law which describes the number of distinct words in a document (or set of documents) as a function of the document length (so called type-token relation). It can be formulated as V R ( n ) = K n…

Why does Heaps's law matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Heaps's law?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Heaps's law.

Tags

  • Computational linguistics
  • Empirical laws
  • Eponymous rules
  • Statistical laws

Keep exploring