I get nervous when I write about something I don’t totally understand. As a result, I sometimes resort to writing down an explanation of that something to myself, in an effort to understand it better. While writing an upcoming post I realized that I wasn’t doing a good job of explaining what a log-normal distribution was, and in particular needed a better understanding of what a logarithm was.

This post is my attempt to explain the concept of logarithms to myself, which I do in my usual way by writing as if I’m explaining it to someone else with no background in the subject. If you’re already familiar with the concept of logarithms then you can skip this, and if you’re not then you can find better explanations elsewhere. In other words, nobody should read this post except me.

(Is everyone else gone? OK, here goes…)

### Orders of magnitude

I think the best place to start to understand logarithms may be with the concept of “orders of magnitude,” a concept people use all the time. For example, consider the statement “there are an order of magnitude more users of Facebook than of Twitter, and two orders of magnitude more users of Twitter than of Mastodon.” Here an “order of magnitude more” means “about 10 times more,” and “two orders of magnitude more” means “about 100 times more.”^{1}

The first thing to note is that orders of magnitude can add together: If Twitter has two orders of magnitude more users than Mastodon, and Facebook has an order of magnitude more users than Twitter, then Facebook has three orders of magnitude more users than Mastodon (2 + 1 = 3).

Let’s drop the “about” and for this discussion assume that “an order of magnitude more” means “*exactly* 10 times more.” Then “two orders of magnitude more” would mean (exactly) 100 times more, “three orders of magnitude more” would mean (exactly) 1,000 times more, and so on.

### Adding and subtracting orders of magnitude

But we also have 100 = 10 times 10, and 1,000 = 10 times 100 = 10 times 10 times 10. So an order of magnitude increase means the original amount was multiplied by 10, a two orders of magnitude increase means the original amount was multiplied by 10 and then by 10 again (i.e., by 100), and a three orders of magnitude increase means the original amount was multiplied by 10 and then by 10 again and then by 10 once more (i.e., by 1,000).

In other words, the number of orders of magnitude by which the original amount was increased is the number of times you multiply by 10. If you do successive increases first by, say, two orders of magnitude, and then by three orders of magnitude, the resulting amount corresponds to an increase by five orders of magnitude, or 2 + 3.

Now let’s consider the case where something is an order of magnitude *less* than something else. For example, when we say “Twitter has an order of magnitude fewer users than Facebook,” we typically mean “Twitter has about one tenth the number of users of Facebook,” and when we say “Mastodon has two orders of magnitude fewer users than Twitter,” we typically mean “Mastodon has about one hundredth the number of users of Twitter.”

Again, let’s be exact about this. Then an order of magnitude *decrease* means the original amount was divided by 10, a two orders of magnitude decrease means the original amount was divided by 10 and then by 10 again (i.e., by 100), a three orders of magnitude increase means the original amount was divided by 10 and then by 10 again and then by 10 once more (i.e., by 1,000). In other words, the number of orders of magnitude by which the original amount was decreased is the number of times you divide by 10.

What about an increase followed by a decrease? Let’s suppose the number of Twitter users increases by five orders of magnitude over a period of years, and then it decreases by two orders of magnitude within a year. That means that the original amount first got multiplied by 10 five times (10 times 10 times 10 times 10 times 10, or 100,000), and then the resulting amount got divided by 10 twice (i.e., by 10 times 10 or 100). The final amount is 1,000 times the initial amount, corresponding to an overall three orders of magnitude increase. We have 3 = 5 - 2, so another way to get the final amount is to *add* the number of orders of magnitude by which the number of users increased, and then *subtract* the number of orders of magnitude by which it decreased.

What if something increases by (say) three orders of magnitude and subsequently decreases by three orders of magnitude; in other words it gets multiplied by 10 three times (i.e., by 1,000) and then gets divided by 10 three times (again, by 1,000). The net effect is to return to where it started. But using our rule above, an increase by three orders of magnitude followed by a decrease by three orders of magnitude nets out to an overall increase of 3 - 3 or 0 orders of magnitude. So we can equate “0 orders of magnitude” to mean “no change” or (what’s the same thing) “multiplied by 1.”

### Fractional orders of magnitude

Here’s an interesting question: What does it mean (if it means anything at all) to say that something increased by half an order of magnitude? If something increases by half an order of magnitude, and then increases by another half order of magnitude, then overall it’s natural to say that overall there was an increase by one order of magnitude. After all, we’ve been using a rule that you add orders of magnitude when doing a first increase by a certain number of orders of magnitude followed by a second increase by another number of orders of magnitude. And one half plus one half equals one.

Since an increase of one order of magnitude is equivalent to multiplying by 10, an increase of one half an order of magnitude is equivalent to multiplying by some number X, such that multiplying by X and then multiplying by X again is the same as multiplying by 10. In other words, we should have X times X equal to 10.

Does such a number exist and, if so, how could we find it? Well, we know that 3 times 3 is 9, and 4 times 4 is 16, so X should be somewhere between 3 and 4. If we try 3.5 times 3.5, that comes out to 12.25, which is too high. Trying a smaller number, 3.2 times 3.2 is 10.24, which is still too high, but closer. 3.1 times 3.1 is 9.61, which is too low. So X should be somewhere between 3.1 and 3.2. We have 3.15 times 3.15 equal to 9.925, again too low, and 3.17 times 3.17 equal to 10.0489, again too high, but getting very close. If you do this exercise a couple more times on your phone’s calculator app you will find that 3.1623 times 3.1623 is almost exactly equal to 10. So we can say that an increase of half an order of magnitude corresponds to multiplying the original amount by (a number very close to) 3.1623.^{2}

Similarly, we can imagine a third of an order of magnitude increase as corresponding to a number Y such that multiplying an initial amount by Y three times produces an order of magnitude increase. In other words, Y times Y times Y is equal to 10. We have 2 times 2 times 2 equal to 8, and 3 times 3 times 3 equal to 27. So Y must be a number between 2 and 3, and is probably closer to 2. Trying numbers out like was done above, we end up with 2.154 times 2.154 times 2.154 being almost exactly equal to 10.

What about an increase of tenth of an order of magnitude? This would correspond to a number Z such that multiplying an initial amount by Z ten times produces an order of magnitude increase. In other words, Z times Z times Z times Z time Z times Z times Z times Z times Z times Z is equal to 10. A little thought will convince one that Z must be between 1 and 2, and likely closer to 1. Using the same techniques as above, we end up with 1.2589 as a number that when multiplied by itself ten times is (almost exactly) equal to 10.

### From orders of magnitude to logarithms

Continuing from the discussion in the previous section, what does it mean to have an increase of, say, 2.3 orders of magnitude? If we follow the rule of adding orders of magnitude, we see that 2.3 is 2 plus 1/10 plus 1/10 plus 1/10, and conclude that an increase of 2.3 orders of magnitude corresponds to first multiplying by 100 (two orders of magnitude), then multiplying by (approximately) 1.2589 (one tenth of an order of magnitude), then multiplying by 1.2589 again, and then multiplying by 1.2589 once more. We have 100 times 1.2589 times 1.2589 times 1.2589 equal to (approximately) 199.5141. So a 2.3 order of magnitude increase corresponds to an increase by a factor of approximately 200.

We can then turn this around and say that multiplying by a factor of 200 corresponds to a 2.3 order of magnitude increase. We can do something similar for other numbers. For example, what order of magnitude increase corresponds to multiplying by a factor of 16? Multiplying by a factor of 10 corresponds to one order of magnitude, and multiplying by a factor of 100 corresponds to two orders of magnitude, so multiplying by 16 must correspond to an order of magnitude between 1 and 2.

Based on the discussion above, a 1.1 order of magnitude increase corresponds to multiplying by 10 (one order of magnitude) and then by 1.2589 (one tenth of an order of magnitude), or 10 times 1.2589, equal to 12.5889. This is less than 16, so the order of magnitude corresponding to multiplying by a factor of 16 is more than 1.1. What about an order of magnitude increase of 1.2? That corresponds to multiplying by 10 times 1.2589 times 1.2589, or 15.8483. This is very close to 16, so the order of magnitude increase corresponding to a factor of 16 is likely just a bit more than 1.2. (The actual number is approximately 1.2041.)

We can do similar calculations for other numbers. For example, multiplying by a factor of 126 corresponds to an approximately 2.1 order of magnitude increase, multiplying by 2,500 corresponds to an approximately 3.4 order of magnitude increase, and so on.

We can now say what a logarithm is: *the logarithm of a number is the order of magnitude increase corresponding to multiplying by that number*.^{3} Thus the logarithm of 10 is 1 (one order of magnitude increase), the logarithm of 16 is approximately 1.2 (1.2 orders of magnitude increase), the logarithm of 100 is 2, the logarithm of 126 is approximately 2.1, the logarithm of 1,000 is 3, the logarithm of 2,500 is approximately 3.4, and so on.

### Negative (and zero) logarithm values

What about decreases by some orders of magnitude? They correspond to negative values of the logarithm. A decrease by one order of magnitude corresponds to dividing by 10, and an increase of three orders of magnitude followed by a decrease of one order of magnitude amounts to an overall increase by 3 - 1 = 2 orders of magnitude, according to the rule of adding and subtracting orders of magnitude discussed above. Since dividing by 10 is equivalent to multiplying by one tenth or 0.1, the logarithm of 0.1 is -1. Similarly, the logarithm of one hundredth or 0.01 is -2, the logarithm of one thousandth or 0.001 is -3, and so on.

Also, above we concluded that a “0 orders of magnitude” increase means “no change” or “multiplied by 1.” So the logarithm of 1 is 0.

There is no order of magnitude increase corresponding to multiplying by 0, and no order of magnitude decrease corresponding to dividing by 0 (which isn’t even defined). So the logarithm of 0 is undefined.

There is also no order of magnitude increase corresponding to multiplying by a number less than zero (like -1), and no order of magnitude decrease corresponding to dividing by a number less than zero. So the logarithm is also undefined for numbers less than zero (“negative numbers”).^{4}

The logarithm as we have defined it is thus defined only for numbers greater than zero (“positive numbers”). For numbers greater than one the logarithm is greater than zero, for numbers between 0 and 1 the logarithm is less than zero, and for the number 1 the logarithm is exactly zero.

This is getting pretty long, so I’ll continue the discussion in part 2.

For the record, Facebook has 3 billion users worldwide and Twitter over 300 million, so the “about ten times more” works out in that case. The number of users of Mastodon depends on how you count them, but the number 2.5 million has been thrown around—close enough to 3 million, and thus 100 times less than Twitter. ↩︎

If you have a calculator app on your phone that has a “scientific calculator” mode then you can compute this more exactly by entering the number 10 and then pressing the so-called “square root” key, which should look something like √. On my phone’s calculator app the resulting value is 3.162277660168379—but note that this is still just an approximation. ↩︎

Strictly speaking, this is the so-called logarithm for base 10. ↩︎

It’s possible to define the logarithm of a negative number by allowing the value to be a so-called “complex” number, but that’s beyond the scope of this discussion. ↩︎