Units and Logarithms

Part 0: Quantities, Dimensions, and Units

Units aren’t the primary focus of this post, but to make this accessible to a wider audience, I’ll try to explain them a bit here.

Measurements

Wikipedia defines a measurement as “the quantification of attributes of an object or event, which can be used to compare with other objects or events” and a quantity as “a property of a material or system that can be quantified by measurement.”

Quantifying basically means assigning a number, but what is that number supposed to mean?

That’s where units come in. Often times, there’s no good way to interpret a simple number as the outcome of a measurement, so a unit, in the broadest sense, is any well-defined way of converting any measurement of a given quantity into a number.

This is all a bit abstract, so let me give you some examples:

The last two examples gave us another important concept: Unit conversions.

Dimensions

If a unit can be given in terms of another unit (and vice versa), they are said to have the same dimension. This is not the kind of “dimension” you might be familiar with (the one in “2D” and “3D”), but something different and more abstract.
To go back to our examples:

A value like 10m is called a dimensioned value. It always consists of a number and a unit which gives meaning to that number.

Note that two different quantities can have the same dimension, for example “length” and “width” both have the dimension of distance. Now, you might argue that “length” and “width” are really the same quantity, in which case I will add that “torque” and “energy” both have the same dimension as well and that most physicists will be able to tell you that those two are really distinct quantities.

This perfectly leads me to my next point: What quantities and what dimensions there are is subjective. A system of quantities (which is a bit of a misnomer) defines a set of dimensions to work with, but note that it is a definition. Similarly, you can define length and width to be the same. You can even define all quantities with the same dimension to be the same, in which case the two concepts “quantity” and “dimension” collapse into one.

A notorious example of this are several systems of quantities, used in physics, that are all grouped under the term natural units (which is also a misnomer since it’s also about dimensions and not just units).
One possible part of natural units is letting “distance” and “span of time” be the same dimension, in which case you can define 𝑐 (the speed of light in a vacuum) to be the plain number 1. Then, a second can be a measure of distance (the distance travelled by light in a vacuum in a second) and a meter can be a measure of time (the time it takes for light to travel a meter in a vacuum).

Another example, taken from the International System of Quantities (ISQ), which is the system of quantities used by most if not all scientists today, is the dimension amount of substance.
This could just be a number. In fact, its unit, the mole (mol), is defined such that 1mol of a substance is equivalent to exactly 6.02214076×1023 molecules of that substance. However, the ISQ insists that these two things (amount of substance and number of molecules) have different dimensions. In my opinion, this is a bit weird, but there are two ways to think about this to make it less so:

  1. Try to separate “substance” from “molecules contained in it”. Essentially, this represents the approximation we all make at large scales, that matter isn’t made of individual particles but rather a single contiguous thing. The distinction between “amount of substance” and “number of molecules” then just reflects that distinction between the macroscopic and the microscopic world.

  2. If you’re willing to relax the interpretation of “amount of substance” a bit, you can also just define a unit “molecule” as 1/(6.02214076×1023)mol and treat that as the base unit instead. The dimension “amount of substance” could then be renamed “molecules” and it’d suddenly make a lot more sense.
    Note that the number of molecules could be a dimensionless quantity, but giving it a separate dimension is useful for dimensional analysis (which I’ll get to later).

Another example in the same vein is that of electrical charge. The commonly used unit for it is the Coulomb (C), but that was originally defined before we knew about electrons. Modern physics states that there is an elementary charge and that all electrical charges that can occur in the world are whole number multiples of that (ignoring quarks, but those are still charged a whole number of thirds of that and also never occur on their own).
So why don’t we use plain numbers to measure charge when there’s a clear and unambiguous way to do so? Because keeping the distinction is useful.

Finally, I’d like to convince you of another opinion of mine, which is that angles are not dimensionless either.
With how there are two commonly used units of angles, it should seem intuitive to give them their own dimension as well. In fact, angles can be thought about as measures of rotation, which should seem like enough of a distinct thing to be given its own dimension at this point.

Proportional Units

As I said before, two units of the same dimension can be used interchangably, by converting a value from one to the other. The procedure of conversion depends on both of the units, but let me give some examples again:

As you can see, there are many possible conversion procedures. In fact, you can define a unit using any such procedure you could ever come up with (given that it’s reversible).

Let’s look more closely at the first example for now.
You can think of the meter as a measuring stick (which it was for some time in the past) and the value 𝑥m just says you how often that measuring stick fits inside your given distance (at least if it is a straight line). Of course, 𝑥 doesn’t have to be a whole number, but it should be clear how that works too.
Importantly, the expression 𝑥m can be thought of as a multiplication, 𝑥m. In this way, we can interpret “km” as a variable with the value 1000m, or, alternatively, “m” as a variable with the value 0.001km (It’s important to note that you can choose either one as the “basic” one and that this choice is arbitrary).

For this reason, I will call the units “m” and “km” proportional. The general definition would be “any two units of the same dimension whose conversion is a simple multiplication with a non-zero constant”.
(Note that this is true for one direction of conversion if and only if it is true for the other one.)

Note that the conversion equation naturally emerges from the proportionality of the two units:

𝑥km=𝑥km=𝑥(1000m)=(𝑥1000)m=(1000𝑥)m.

Can we think of all dimensioned values as products of number and unit? Not exactly.
Consider the second example and assume we could write both sides as products of number and unit:

𝑥K=(𝑥273.15)°C.

First set 𝑥=1 to obtain K=272.15°C, then multiply by 𝑥 again to get

𝑥K=(272.15𝑥)°C,

which is not at all what we had before.
The problem can already be seen in the previous equation, since not all terms on the right hand side are proportional to 𝑥.

So how do we save this? Simple, really: Just limit with what units a dimensioned value can be thought of as a product. The procedure is quite trivial and works one dimension at a time:
Pick any unit you like from a given dimension and decree that dimensioned values with this unit can be seen as products. Then, all units (of the same dimension) that convert to/from that unit with a simple multiplication can have the same property, but no others.

In the case of temperature, it was decided that Kelvin would be the unit with this “product property”, so (in this system) you cannot write 𝑥°C=𝑥°C.
The reason for this has to do with the concept of absolute temperature: There is a lowest possible temperature in the universe and it is, by definition, 0K.
I could talk about this for a bit longer and try to justify it more, but the extent to which I’ve discussed it here should be enough for my purposes.

A quick aside about prefixes

There’s a standard way of forming units proportional to any given units and that is by using metric prefixes. Basically, you add a prefix to a unit’s name, which defines a new unit which is a pre-defined power of 10 times the base unit. You’re not supposed to combine these, instead there is a big list of them, enough to encompass basically every scientifically relevant order of magnitude. You can find the complete list on Wikipedia, but here are the first few:

Prefix (name)Prefix (letter)Multiplier it represents
deci-d0.1
centi-c0.01
milli-m0.001
deca-da10
hecto-h100
kilo-k1000

So for example, a millimeter has the symbol “mm” and is equal to 0.001m and a hectopascal has the symbol “hPa” and is equal to 100Pa.

Dimensional Algebra

The thing about units being like constants is that you can do algebra with them.

First of all, you can divide units of the same dimension, for example

kmmm=1000m0.001m=1000000mm=1000000.

Next comes the fun part: You can create new dimensions out of old ones by combining them with multiplication or division.
For example, the dimension “area” is given as the product of “distance” with itself, so a unit of area is

m2=mm.

Similarly, you can divide dimensions, for example “speed” is “distance” divided by “span of time”, a unit of which is m/s.

The nice thing about this is how it transfers to dimensioned values. If you have a rectangle and measure its width 𝑤 and height , where both 𝑤 and are dimensioned values (both of dimension “distance”), then its area is simply given by

𝐴=𝑤.

Whatever units you measure 𝑤 and in will determine what unit the result will be. For example, if 𝑤=𝑥m and =𝑦dm, then you will get

𝐴=𝑥m𝑦dm=(𝑥𝑦)m(0.1m)=(𝑥𝑦)𝑢,

where 𝑢=0.1m2.

Note that prefixes conventionally apply inside a power, so dm2=(dm)2=(0.1m)2=0.01m2.

Additionally, you can raise a single unit to any real number power, but that isn’t used very often with non-integers. For example, m=m0.5 is a valid unit of dimension “square root of distance”. That dimension seems weird and wrong, but mathematically it works just like any other one. As for interpreting it, that’s left to equations involving it.

To illustrate this, think about the unit s2. What exactly is the square of time? Time-Area??? As stated, it’s hard to imagine what this could mean. But when divided by, this unit suddenly makes a lot of sense: The unit m/s2=(m/s)/s is a unit of acceleration, describing an acceleration in terms of how much speed (in units of m/s) is added per second.

Anyway, from the math’s point of view, the previous paragraph wouldn’t have even been necessary. Products, Quotients and powers of units/dimensions are just defined abstractly and we work with them using the usual rules of algebra.

You might notice the abscense of addition and subtraction, and while you could define the sum or difference of dimensions in the same way, it isn’t really that useful in practice, so the usual stance is to say that only dimensioned values of the same dimension can be added or subtracted.
For those, we just define their sum/difference using distributivity (after expressing them in the same unit). Using the meter as an example again:

(𝑥m)±(𝑦m)=(𝑥±𝑦)m.

Again, all of this only works because we said that dimensioned values are a product of a number and a unit. So be careful when working with units like °C: It doesn’t have any of these properties because “°C” isn’t a free-standing variable, but rather only part of the notation 𝑥°C for a dimensioned value, because we had previously defined the Kelvin to be the free-standing variable and the Degree Celsius is a unit of the same dimension as the Kelvin, but not proportional to it.

As an additional note, we can now see why I said that the dimension of dimensionless values could be said to be 1: Multiplying a dimensionless number 𝑥 with a dimensioned value 𝑦m gives (𝑥𝑦)m, which should have the product of the dimensions of the input, but actually has the same dimension as the dimensioned input value.
That means that, from a mathematical perspective, the dimension of dimensionless values is the multiplicative identity for the product of dimensions, so it is apt to call it “1”.

Another note I’d like to add is that this dimensional Algebra has a really useful application called dimensional analysis (“analysis” here using the common meaning, not the one from “real analysis”).
By only looking at the dimensions of each variable in an equation, we have a quick way to find some mistakes. For example if I wanted to write down the Pythagorean Theorem, but forgot a power of 2,

𝑎2+𝑏2=𝑐,

then I would replace all variables (and physical constants, but there are none here) by their dimensions and see that

distance2+distance2=distance.

Since area=distance2, I find the left hand side to be

area+area=distance,

and since addition of the same dimension is well-defined, this finally reduces to

area=distance,

which is false.
Of course, this example is a bit silly. You don’t actually save any effort by using dimensional analysis here, but it’s good as an example to explain the process.

As another example, if I accidentally wrote

𝑎2+𝑏3=𝑐2,

then I could see that, on the left hand side, I am adding an area to a volume, which we had previously forbidden.
This is actually the reason that we go as far as to forbid adding values of different dimensionalities: No part of physics actually deals with sums of differently dimensioned values, so if you encounter such a thing, you can be quite sure that it must have been an error on your part. (Of course, I’ll reiterate that it’s not mathematically impossible, but rather a very useful definition that this is illegal.)

Finally, let me say a word on functions.
In math, you usually only work with dimensionless values, so for most functions (on the real numbers) you need to check that the argument is dimensionless (which can also be said to be a part of dimensional analysis).

A particular example I want to point out is the exponential function, which can be defined as

exp(𝑥)=𝑛=0𝑥𝑛𝑛!=1+𝑥+𝑥22+𝑥36+

Note the sum of different powers of 𝑥, which would be illegal if 𝑥 had any dimension other than 1.
The same is true for any power function 𝑓(𝑥)=𝑎𝑥.

Monomials like 𝑓(𝑥)=𝑎𝑥𝑝 are fine, since they only consist of operations we defined for all dimensioned values, but general polynomials like 𝑓(𝑥)=𝑎𝑥2+𝑏𝑥+𝑐 have the same issue again.

The way to use these with dimensioned values is to divide by a unit first, so for example exp(𝑑/m) would work if 𝑑 had dimension “distance”.

The same could be true for trigonometric functions like sin(𝜃) and cos(𝜃), but, as I said before, I think it’s better to define angles as having a dimension different from 1, so these functions would actually require their argument to be an angle, and not dimensionless.
(An issue with this is that exp(𝑖𝑡) only works for dimensionless 𝑡, which turns out to be the value of an angle in radians, but I don’t think that’s enough to refute my viewpoint.)

Part 1: Logarithms

After this long and arduous prologue, we’re finally ready to talk about logarithms (and this part will be laughably short in comparison).
Or maybe you skipped the previous section, in which case: Welcome aboard.

You might’ve learned in school that the function 𝑥𝑏𝑥 has an inverse (at least as long as 𝑏>0 and 𝑏1), called the logarithm to the base 𝑏, 𝑥log𝑏(𝑥), which thus fulfills the equation

log𝑏(𝑏𝑥)=𝑏log𝑏(𝑥)=𝑥.

We can translate the three power rules

𝑏0=1,𝑏𝑥𝑏𝑦=𝑏𝑥+𝑦,(𝑏𝑥)𝑦=𝑏𝑥𝑦

into logarithm rules by setting 𝑥̃=𝑏𝑥,𝑦̃=𝑏𝑦 and then applying log𝑏:

(1)log𝑏(1)=log𝑏(𝑏0)=0,(2)log𝑏(𝑥̃𝑦̃)=𝑥+𝑦=log𝑏(𝑥̃)+log𝑏(𝑦̃),(3)log𝑏(𝑥̃𝑦)=𝑦𝑥=𝑦log𝑏(𝑥̃).

The logarithm rule we’ll be interested in is obtained by taking the equation

𝑥=𝑏log𝑏(𝑥)

and applying log𝑐 to both sides:

log𝑐(𝑥)=log𝑐(𝑏log𝑏(𝑥))=(3)log𝑏(𝑥)log𝑐(𝑏)log𝑏(𝑥)=log𝑐(𝑥)log𝑐(𝑏).

Note that this holds for any 𝑐 (as long as log𝑐 is defined), so you can basically change the base of a logarithm to anything you want.

This allows us to use a “standard” base (usually Euler’s number 𝑒) and define lnlog𝑒, whence

log𝑏(𝑥)=ln(𝑥)ln(𝑏).

This allows us to rewrite the previous equation in the “trivial” form

ln(𝑥)ln(𝑏)=ln(𝑥)/ln(𝑐)ln(𝑏)/ln(𝑐).

This is the point I want to get at. Think about meters and kilometers again. We know that km/m=1000, so, for a dimensioned distance 𝑑=𝑥km, we have

(𝑥=) 𝑑/km=𝑑1000m=𝑑/m1000=𝑑/mkm/m.

Notice the similarity? 𝑑 is exactly analogous to ln(𝑥) and “km” and “m” correspond to ln(𝑏) and ln(𝑐) respectively.
But that isn’t all. Note that ln is still defined as a logarithm to a specific base. Why should we prefer one base over another? It’s the same thing as with units of distance: There’s no preferred unit, so it’s best to treat the dimensioned quantity abstractly, without giving its value in any concrete unit (except when calculating).

Thus, I propose to treat logarithms the same. For a positive real number 𝑥, I define the abstract, dimensioned quantity log(𝑥) (with no base). Then, each other positive real number 𝑏1 defines a unit log(𝑏), such that the value of log(𝑥) in the unit log(𝑏) is

log(𝑥)log(𝑏)=log𝑏(𝑥).

(Note that you’ll often see log(𝑥) without a base used to mean an implied base, most often 𝑒 or 10. This is not what I mean.)

This is particularly natural in information theory, where logarithms are already used in conjunction with units. There, you’ll see logarithms to the base 2 be referred to with the unit “bit(s)” and those to the base 𝑒 with the unit “nat(s)”. This is complete nonsense as practiced currently, however, since these “units” are just reminders what logarithm was used, and not actually units at all (they are equal to 1).

Using my new formalism, we can make these into actual units of the dimension “logarithm” by just defining

nat=log(𝑒),bit=log(2).

There’s another quantity that works perfectly in my framework, and that’s the bel (B), or its more commonly used sibling, the decibel (dB). This is just defined as

B=log(10)

and then dB=0.1B as usual.

Using these definitions, we can have the perfectly coherent, properly dimensioned equation

log(16)=4bit2.77nat12dB.

Part 2: Logarithms of Units

Remember the part on the dimensional analysis of functions, where I said that exp(𝑥) has to have a dimensionless argument.
The same could be said about log(𝑥).

But what if we don’t do that?

What if we just work with expressions like log(𝑥m) and see where that leads us?

Well, as a start we should work with units with the product property, so that we can apply logarithm rule (2) to get

log(𝑥m)=log(𝑥m)=log(𝑥)+log(m).

(Note that I’m still using my dimensioned, base-less logarithm, but you can also apply this concept to logarithms with a base.)

The expression log(𝑥) is something we’re already familiar with: It’s a dimensioned value with dimension “logarithm”.
Now what about log(m)?

Let’s just say that that also has the dimension “logarithm” so that we can keep our rule of only adding values of the same dimension.
You might object and say that there should be a new dimension, maybe call it “logarithm of distance”, but take another look at what we just derived. When we take the logarithm, the unit itself goes in a logarithm on its own. This is a single thing for each dimension.

In fact, using logarithm rule (3), we can see that for the power units m𝑝, which, I want to emphazise, have a different dimension for each value of 𝑝, we get

log(m𝑝)=𝑝log(m).

Also, if we take the logarithm of a unit of speed, say m/s, we get

log(m/s)=log(ms1)=log(m)log(s).

The general picture is that the logarithm lets us see how the dimensional algebra actually defines a vector space structure on the set of dimensions.

When units come into the mix, that vector space gains a basis vector “1”, where the scaling factors go, e.g.

log(km)=log(1000m)=log(1000)1+log(m).

If all of that hasn’t blown your mind yet, let me have one more go.

Consider the unit “dBm”, which is used to describe power logarithmically.
(There are more such suffixed-decibel units, all defined analogously, so I’ll just stick to dBm here.)

The usual formula is

𝑃log=10log10(𝑃mW)dBm

where 𝑃/mW is the power in milliwatts and 𝑃log=𝑥dBm is the logarithmic power, given in dBm as stated.

Now, apply our new framework to the numerical value 𝑥 given there.
First, expand log10 into the base-less logarithm to get

𝑥=10log(𝑃mW)log(10)=10log(𝑃mW)𝐵=log(𝑃mW)dB.

Then, expand the quotient 𝑃/mW using the logarithm rules to get

𝑥=log(𝑃mW1)dB=log(𝑃)log(mW)dB.

Rearrange to get

log(𝑃)=𝑥dB+log(mW).

Now, log(𝑃) is what we actually wanted to express when we defined 𝑃log above, so why not equate the two? That yields

𝑃log=log(𝑃)𝑥dBm=𝑥dB+log(mW).

We now have a definition of “dBm” as a non-proportional unit, similar to °C!
(Keep in mind that we shouldn’t think of 𝑥dBm as a product, but rather just as notation.)

At this point, I can say that my excitement is immeasurable and my mind is blown.
I hope that you can say the same too.