Leading Digits and Benford’s Law

An intuitive way to understand Benford’s Law and how it applies to the powers of two

Leading Digits and Benford’s Law

The previous article discussed the trailing digits of the powers of two. Now, this article examines the leading digits of the powers of two and the interesting law they follow.

But first, here’s a question:

Taking any power of 2, what are the chances that the leading digit (the leftmost digit) is 1? How about 2? 3? What about 9?

It is tempting to say that the probability of each of these are equal, or about 11%. After all, in a linear scale, there are an equal amount of numbers with a leading digit of 1, 2, 3, until 9.

Yet the flaw here becomes obvious when plotting the powers of two on a linear scale.

The numbers are clearly not distributed evenly. This is unsurprising; an exponential sequence would not fit well in a linear scale. But it is possible to force the powers of two to distribute evenly.

The Logarithmic Scale

In a logarithmic scale, increments are made not by adding a certain value, but by multiplying by a value. Equally spaced “steps” are therefore made by multiplying by a constant factor.

Hence, since the powers of two are generated by multiplying by a constant factor of 2, these would spread out evenly in a logarithmic scale:

This logarithmic scale can be imagined as planks on a bridge

The plank between 1 and 2 represent numbers with a leading digit of 1. And in general, numbers in the plank between d and d+ 1 have a leading digit of d. Mathematically this can be expressed as

This essentially means that a number x has a leading digit of d if the base-10 logarithm of it’s fractional or decimal part (the 0.45 of 7.45) is between the base-10 logarithm of d and d+1 (or the plank between d and d+1).

The probability of choosing a number with a leading digit of, say 1, would be the probability of walking along the bridge and stopping on the plank between 1 and 2. This can be quantified by getting the length of such plank divided by the length of the entire bridge, which is just 1 in this logarithmic scale (log base 10 of 10 is 1). It has been established that the length or range of a plank is simply

or simply

Benford’s Law

Incidentally, this is exactly Benford’s Law. It states that certain data sets generally have more numbers with a leading digits of 1, and scarcely any with a leading digit of 9. The percentage decreases as the leading digit increases as shown below:

with the more numbers tending to have a leading digit of 1, less numbers having a leading digit of 2 or 3, and scarcely any with a leading digit of 9.

An intuitive way of understanding it is simply by thinking logarithmically rather than linearly. Rather than thinking that 1 and 2 are of the same distance as 8 and 9, it can also be said that 2 is 200% of 1, whereas 9 is only 112.5% of 8. Ergo the latter would be farther apart in a logarithmic scale as compared to the former.

Leading Digits of The Powers of Two

As promised, the leading digits of the powers of two do follow Benford’s law. The following python program shows this

In general, the powers of two — along with other sequences — conform more to Benford’s law as they aproach higher orders of magnitude. The relative error against Benford’s Law is shown here

💡 Try gradually increasing the value of N and see how that effects the relative error

More Applications

Benford’s Law is definitely not restricted to the powers of two. In fact, it works with other exponential sequences as well (as they fit well in the logarithmic scale) and even patterns like the Fibonacci sequence.

There are numerous real-world applications as well, with the populations of countries and stock market values (which tend to grow exponentially) tending to Benford’s Law.

The tendency of certain data sets to follow Benford’s Law makes it useful for fraud detection for financials as well, such as tax returns or accounting figures. The law can also tell the difference between honest electoral results, and fraudulent ones. All in all, Benford’s Law finds its way in everything — from the ever changing populations of countries to the fixed constants of the universe.