Benford’s law: learning to fraud or to detect frauds?

Originating author is Christiane Rousseau.
It is very risky to change too many numbers in some fi nancial statements if one does not know some mathematics. Indeed, most often the numbers appearing in fi nancial statements follow some strange mathematical rule, called Benford’s law, or law of the fi rst signi ficant digit. If one forgets to follow the rule, then the numbers will fail some statistical tests and are likely to be scrutinized with care. Benford’s law claims that if you collect numbers at random and calculate the frequencies of their fi rst signifi cant digits, the numbers with fi rst signifi cant digit should appear around % of the time, while the numbers with fi rst signifi cant digit appear only % of the time. This rule is observed in many other sets of numbers, like powers of or Fibonacci numbers.

Why?

We now have satisfying explanations. We are going to share them with you.

Benford law’s concerns the distribution of the fi rst signi ficant digits of numbers. The fi rst signi ficant digit of a positive number is the leftmost nonzero digit of its decimal expression. For instance, the first signifi cant digit of is , that of is , and that of is . Another way to de fine it which will be useful for our mathematical discussion is to write a positive real number as a number times a power of :

Then the first signi ficant digit of is the integer part of , which can be denoted by . The number is called the mantissa of . We now claim that if you collect numbers at random and compute the frequency of the fi rst signifi cant digit , then is approximately given by . This gives us the frequencies:

Table 1: Frequencies of Benford’s law.

Figure 1: Frequencies B(i) of Benford’s law.

Let us now give a very brief historical note. The phenomenon was first discovered by the astronomer Simon Newcombe (1835-1909) who noticed that the fi rst pages of the logarithmic tables corresponding to small fi rst signifi cant digits looked much more worn than the later pages. His discovery was forgotten and the law was rediscovered by Frank Benford (1883-1948) around 1938. Frank Benford collected tenths of thousands of numbers from all origins following his law. The modern data base of Simon Plouff e which contains millions mathematical constants also follows Benford’s law.

Many sets of numbers that are not random also follow Benford’s law. This is the case with the populations of countries, with the areas of countries, with the length of rivers, etc. Maybe you will stop me and start being skeptic… In which units are these lengths or areas collected? Are lengths in miles or in kilometers? This does not matter… If the lengths of rivers in kilometers follow Benford’s law, then the lengths in miles follow Benford’s law! A change of unit corresponds to a change of scale. We will see that Benford’s law is invariant under change of scale. Moreover, it is the only probability law which is invariant under change of scale.

Figure 2: Some data approximately following Benford’s law: areas of countries in
square kilometers, areas of countries in square miles, and populations of countries.

I told you in the introduction that the Fibonacci numbers follow Benford’s law. But, in a sense, Benford’s law is subjective, since it depends on the basis in which we write our numbers. In some basis with , the nonzero digits are the elements of the set , and Benford’s law in basis says that the frequency of the first signifi cant digit is . Well! Fibonacci numbers follow Benford’s law in any basis Benford’s law is invariant under change of basis. And it is the only non trivial probability law which is invariant under change of basis.

Now it is time to come to explanations. They will require that you remember some of your probability course. But you could prefer to experiment by yourself first before starting reading more serious maths.

1. Invariance under change of scale

Let us consider a simple change of scale obtained by multiplying all numbers of a set of numbers by . If we consider the numbers with fi rst signifi cant digit , then they are changed to numbers with first signifi cant digit either or . It is easy to check that . Indeed,

Similarly, you could check that , etc. But how do you manage if you change from miles to kilometers, i.e. multiply numbers by ? As stated, Benford’s law is too restrictive and we need to generalize it. What does it mean that the first signifi cant digit is ? It means that the mantissa belongs to the interval . So, Benford’s law is a partial probability distribution on the mantissa. The generalized Benford law (which, by abuse of language, we will call Benford’s law) on the mantissa is given by a density function on the interval . When we pick up a number at random, we can compute its mantissa. This gives us a random variable taking values in . We say that it follows Benford’s law if its density function is given by

If represents the probability that , then this means that we must have

It is really a generalization of Benford’s law since

What does it mean to say that a random variable on is invariant under change of scale? It means that, if is a positive real number and if we take the random variable , then the mantissa of the random variable has the same density function as . It is not difficult to show that this is the case when follows Benford’s law, but there are several cases to distinguish depending on the size of . We will do one case and will let you do the other cases. We can write , with the mantissa of . Since the mantissa of is the same as that of , it suffices to consider the case .
What is the tool to show that? You may remember from your probability course that the (cumulative) distribution function is sometimes more useful than the density function for a continuous random variable. The distribution function of a random variable is
defi ned as

If follows Benford’s law, then its distribution function is given by

(1)

So we must show that if follows Benford’s law and is the mantissa of for , then the distribution function of is given by (1).

For that purpose, we need to calculate for . is the mantissa of which takes values inside . So , when and when The first case occurs when . For the mantissa of to lie inside , the only possibility is that . Then the mantissa of is equal to .
Hence,

as expected. The other cases are done in the same way.

The reciprocal is more exciting…

2. Benford’s law is the only probability law on the mantissa which is invariant under change of scale

It seems an impressive statement! Yet, you will see that its proof is not much more complicated than the previous argument. Let be a random variable representing the mantissa and taking values inside . We look for its distribution function , under the hypothesis that is invariant under change of scale. So we need to compute

Hence, we must have and .
The main difficulty of the proof lies in interpreting what it means that is invariant under change of scale. Since and are the same events, then we have that

(2)

As before, let us consider the case of some so that ( depends on ). Then, for , is equal to its mantissa. Since is invariant under change of scale, then the mantissa of has the same distribution function as . Hence,

Combining with (2) we see that satisfi es

(3)

provided that is not too large. We must find from the functional equation (3). Let’s see how to do this. If we let , this yields

which can be written

since . Let us take the limit when . We must recognize on each side a quotient whose limit is a derivative. On the left side it is , the limit of which is , and on the right side it is  which tends to . Hence, we get the
diff erential equation with separable variables

the solution of which is . Since we have , and since , then . Hence, and we are done!

3. Why numbers collected from all origins follow Benford’s law?

An answer was provided by Theodore Hill in 1995, and we will discuss briefly his idea. Of course, not all sets of numbers follow Benford’s law. For instance, if you consider the height of humans in meters then, up to a few exceptions, only the first signifi cant digits and will occur, and if you convert the size in feet (a foot is approximately cm) you will change the distribution law of the fi rst signifi cant digit. So this set of numbers is not invariant under change of scale. But, suppose we consider a large set of numbers coming from all origins and we change of scale. There are diff erent subsets of numbers with their particular scale. Because the set is large and the numbers come from all origins then, most likely all diff erent scales are present. Multiplying all numbers present in the set by a positive constant induces a permutation of the scales present in the new set. So, as a whole, we could expect the set of numbers to behave as if it had no special scale. Hence, it will follow Benford’s law.

This explanation is good for sets of numbers coming from all origins. But it does not explain why areas of countries, populations of countries, or lengths of rivers should follow Benford’s law. We will discuss very recent explanations (2008!) for this case given by Gauvrit, Delahaye and Fewster. Their explanation is also valid for large sets of numbers coming from all origins.

4. Sets of numbers spreading over several orders of magnitude are likely to follow Benford’s law!

We are working in base and we have seen that positive numbers can be written as , where and . We could consider as the order of magnitude and we say that there are several orders of magnitude if there are several values of for our set of numbers. (Note that such a property is invariant under change of scale!) To simplify the explanation, suppose that the numbers lie within . Then the numbers with signi cant digit are the ones in the set

and similar sets with the other digits. It is better to move to the logarithm in base of these numbers: . Then . Let us show that if a random variable on obeys Benford’s law, then the random variable is simply uniform on . For that, it suffices to show that the distribution function of is that of the uniform random variable on , namely

Indeed, when ,

If belongs to the set , then belongs to the set :

and similarly for the other digits. Suppose that taking a random number in our set is a random variable taking values inside . Then takes values inside . Recall that the probability that some random variable belongs to some set is equal to the area under the graph of the density function over the set. If the density function of over was uniform as in Figure 3 (a) we would be done. Most often however, it will not be the case as in Figure 3 (b). But this is why it is so important that the original set of numbers is spread over several orders of magnitude. The di fferent portions corresponding to a given fi rst signifi cant digit are spread horizontally over several segments, whose sum of lengths is of the order of of the total width. So, even if the height of is not the same from one segment to the other, one could hope that the mean height be of the same order of magnitude for the diff erent digits. When this occurs, then the data follow Benford’s law.

(a) density function f uniform
(b) density function f non uniform
Figure 3: The areas corresponding to the frequencies of the first signifi cant digits 1, 2, 3 and 4 for two
diff erent density functions of Y. The values of the corresponding areas are plotted in Figure 4.

(a) density function of f
(b) Areas under the curve for the signi cant digits of f and for the uniform function
Figure 4: The areas corresponding to the frequencies of the first signi cant digits 1, 2, 3 and 4 for the density function of Figure 3(b). On the right we see that these values are pretty close to those obtained by Benford’s law in the case of a uniform density function for Y.

5. How to test if a set of numbers follows Benford’s law?

If you have followed a statistics course, then you probably studied the  goodness-of-fi t test. This test allows you to check if some data follow some probability distribution. Suppose you want to make the test with a set of numbers. You just need to construct a table, in which represents the number of numbers in your set which have first
signi ficant digit . Of course, . The represent the numbers of numbers that should have fi rst signifi cant digit if your set was following Benford’s law, namely .

Table 2: The table for the goodness-of-fi t test.

You then calculate

and you look in a table of the  at the line corresponding to degrees of freedom. If you are to make a test with % of error, then you accept that the data fit Benford’s law if  and you reject otherwise. This is a fast recipe, but if you are to make such tests with your students, then just take some time to get more familiar with the details of the test and its meaning.

6. Invariance of Benford’s law under change of basis

This could be modeled in a similar way as the invariance under change of scale. It is more tricky though, since we cannot limit our work to the mantissa. Indeed, if , then the part also need to be converted to the new basis. And, in fact, the main difficulty is to express in mathematical terms what it means for a random variable to be independent under change of basis. We skip the details.

7. Conclusion

Benford’s law is fascinating: it defi es the intuition, and is it something that you can test yourself and also adapt for a classroom activity. It used to be a curiosity, but it is now a standard tool to detect frauds. Of course, more and more tax evaders learn of it. But pay attention: the first signifi cant digit is not the only thing to take care of. The generalized Benford’s law allows to derive a law for the second signi ficant digit, third signifi cant digit, etc. You can try to find it by yourself: just think in which unions of intervals the mantissa of a number should be so that its second signifi cant digit is .

This post is also available in: French, German, Italian, Spanish, Arabic, Khmer, Portuguese (Brazil)

This entry was posted in Mathematics Within the Last 100 Years. Bookmark the permalink.
1. Steve Harrington says:

There’s an Excel spreadsheet to investigate Benford’s Law here

2. Andy Edwards says:

Nice vignette, this one. Maybe a bit too algebraic and generalised a bit too soon but the bases are all covered pretty well. If you think about it, Benford’s law is not all that counterintuitive providing the numbers are randomly selected across many orders of magnitude and no limits are applied to curtail the frequency of some of the leading digits.
Taking the lengths of all the rivers in the world as an example, this should follow Benford’s Law irrespective of whether you measure them in miles or kilometres. But how long does a watercourse have to be to be properly considered a river? Make the minimum cutoff point 100 km and the very large number of the shortest rivers between 100 and 160 km will all have 1 as their leading digit. But when their lengths are converted into miles, none of them will. All will be between 62.4 and 99.4 miles, distorting the leading-digit count in favour of 6, 7, 8 and 9 at the expense of 1, 2, 3 and especially 4 and 5. Benford’s Law, which may have seemed to apply in kilometres, will no longer apply. This is because placing the arbitrary minimum has de-randomised the numbers very powerfully.
The lengths of the half-lives of the radioactive isotopes of all elements follows Benford’s Law quite nicely, mainly because they vary from thousandths of a second up to trillions of years across about twenty orders of magnitude.
Beware the examples which are sometimes given of people whose fraud was detected because the cheques they presented or the total weekly takings figures of a store they managed contravened Benford’s Law. There are compelling reasons why the weekly takings might all start with the same digit (19000) or vary across a range which doesn’t match the Benford’s Law suggestions (80000). This is because not enough orders of magnitude are spanned for the law to hold.