# What is the logarithm of a kilometer? Is it a dimensionless number?

In log-plots a quantity is plotted on a logarithmic scale. This got me thinking about what the logarithm of a unit actually is.

Suppose I have something with length $L = 1 km$.

$\log L = \log km$

It seems that the unit of $\log L$ is $\log km$, but I can also say $L = 1000 m$ and now:

$\log L = 3 + \log m$

This doesn't appear to have any units at all.

This suggests that $\log km$ and $\log m$ are actually dimensionless numbers. But wait, I can do this with any unit! Does it actually make sense to talk about the logarithm of a unit, or some other function for that matter?

-
Related (verging on a duplicate): Fundamental question about dimensional analysis. – dmckee Aug 1 '11 at 14:44
Agree with dmckee. The same logic holds: expand to Taylor series, and you see that you add ㎞ and ㎢ – MSalters Aug 2 '11 at 10:42
I think we need some examples of equations that do this, i.e. logarithms or powers of a quantity. Experience says in all equations arising from nature, the units combine to give a dimensionless number, e.g. in Planck's formula or Tsiolkovsky's rocket equation. – Mark C Sep 7 '11 at 4:54
It is also worth noting that a trigonometric function ought to applied in the same way, i.e. to unitless numbers. Otherwise, it does not make physical sense. – Antillar Maximus Jul 28 '13 at 13:15

This is a fun question. I have a hard time getting a good grip on the transformation that is $ln$ so I'll write things in terms of exponents.

$$value = \ln(10\ \mathrm{ km})$$ $$e^{value} = 10\ \mathrm{ km}$$

The number $e$ is, of course, unit-less. If I raise a number to a power, what are the permissible units of the power? If I write $x^2$, I have an intuitive assumption that $2$ has no units, because it is just a count used to express $x \times x = x^2$.

Thus, I have convinced myself of Carl's answer, and I would require a logarithm to have a reference to make sense. For example:

$$e^{value} = \frac{ 10\ \mathrm{ km} }{1\ \mathrm{ km}}$$

The previous alternative of $e$ raised to a power equaling a physical quantity with real units seems like the perfect example of something that is nonsensical.

log plots

I have another question that stemmed from your question and I will try to answer it here. I specifically remember taking the derivative of log-log and linear-log plots in engineering classes. We had some justification for that, but it would appear to be nonsensical on the surface, so let's dive in. Here is an example of a log-log plot. I'll show the graph and then offer an equation of the line that is being represented.

I'll start writing things from the basic $y=mx+b$ form, then change things as necessary. Since I'm using an arbitrary constant, I'll fudge it whenever necessary.

$$\log(p) = a \log(m) + b = a ( \log(m) + b' ) = a \log( b'' m ) = \log( b''^a m^a ) = \log\bigg( \frac{p_0}{m_0^a} m^a \bigg)$$ $$p = p_0 \left( \frac{m}{m_0} \right)^a$$

Like magic, a recognizable form comes through. Observing a linear relation in a log-log plot really means you're observing a power fit, not a linear fit. A student may still ask "but what are a and b", which is a bit more difficult. Firstly, I did no manipulation of $a$, so you can take the meaning directly from the final form, which is to say it's an exponent and thus unitless. For b:

$$b = a b' = a \log(b'') = a \log\bigg( \frac{p_0^{1/a}}{m_0} \bigg) = \log\left( \frac{p_0}{m_0^a} \right)$$

This shows that $b$ is also unitless, but it also gives interpretation to $p_0$, which is the reference y-value at some reference x-value ($m_0$). I'll move on to linear-log plot, or a semi-log scale.

I'll denote $f$ for "surviving fraction" and $d$ for dose. The equation for a regression that appears linear on the above plot will be the following.

$$\log(f) = a d + b$$ $$f = e^{a d + b} = e^b e^{a d} = f_0 e^{a d}$$

It's important to note here that $b$ had dubious units all along, just like in the log-log case, but it doesn't really matter because a more useful form comes out of the mathematics naturally. The value $f_0$ would be the baseline value (100% in this case) at $d=0$.

Summary: assuming a linear relation in log plots really makes the assumption that the actual relation follows some nonlinear form, and the units will work out once you do the mathematics, but the interpretation of the values may be nontrivial.

-
The answer doesn't address the question. The question isn't about logarithmic plots. – Ben Crowell Aug 7 '11 at 17:50
@AlanSE: that's nice enough, but here's the thing: $e^\text{value}=\rm{\frac{10\,km}{1\,km}}$ implies $\text{value} = \ln\rm{\frac{10\,km}{1\,km}} = \ln(\rm{10\,km}) - \ln(\rm{1\,km})$, so it seems unavoidable that taking the log of a quantity with units must be meaningful. I like to think of $\ln(\rm{10,km})$ as having units of log-kilometres. – Nathaniel Apr 10 '12 at 11:42
Continuing that thought, log-units are weird in that (for example), subtracting one log-kilometer quantity from another one results in a dimensionless quantity, whereas dividing one by the other doesn't. Log-units follow different rules from normal ones, but that doesn't mean they couldn't be a useful concept. (Though I don't actually know of anyone using them.) – Nathaniel Apr 10 '12 at 11:49
Now that I've read the whole page I see that Ben Crowell and leftaroundabout had the same idea and take it a bit further in their answers. – Nathaniel Apr 10 '12 at 11:57
@Nathaniel That's interesting, but I can still mathematically remove the $km$ from the first equation and $value$ would still seem to be unitless to me. Sure, they can be log-km units, but that doesn't change the fact that a log-km unit... is 1. Even if it has units, it doesn't follow the ordinary rules of units as you've already noticed. So it seems the more simple explanation is that it's not a unit. – Alan Rominger Apr 10 '12 at 12:41

Somehow units in physics keep confusing people. A simple way to get out of this confusion is to realize that translating physics into math requires casting the problem into one dealing only with pure (so-called dimensionless) numbers.

This can be straightforward. Consider a simple pendulum. Deriving the time period for swinging the bob $t_{swing}$ requires us to cast the problem in math form. This forces us to work not with the time period itself, but with a dimensionless quantity like the ratio between $t_{swing}$ and some other time $t_0$. As a result we can derive equations like $$\frac{t_{swing}}{t_0} \ = \ f(..)$$ In case of a pendulum, the problem contains a time parameter in the form of the square root of its length divided by the local gravitational acceleration: $t_0 = \sqrt{l/g}$. So one attempts to find an expression of the form

$$\frac{t_{swing}}{\sqrt{l/g}} \ = \ f(..)$$

When doing the analysis for small swinging angles, it follows that $f(..) = 2\pi$.

In some other cases the number of parameters available in the problem is not sufficient to render the equation dimensionless. In such cases physicists fall back on generic physical parameters called units. Their sole purpose is to render all parameters in the mathematical equations dimensionless (pure numbers).

Physicists often violate against the rule that prescribes dimensionless math. So you will see equations like

$$x^2+y^2=r^2$$

Strictly speaking this is incorrect. However, people tend to interpret this as shorthand for $$(x/1m)^2 + (y/1m)^2 = (r/1m)^2$$

(or with any other length unit of choice in the denominator). This makes the equation again dimensionless. I would argue that what is really meant, however, is $$(x/r)^2 + (y/r)^2 = 1$$

Also equations like

$$\ln x - \ln r = 2 \pi$$

strictly speaking make little sense. Again, people might turn this nonsense into something meaningful by interpreting it as shorthand for

$$\ln (x/1m) - \ln (r/1m) = 2\pi$$

What is really meant, however, is

$$\ln(x/r) = 2\pi$$

The bottom line is that it makes no sense to have a bare length $x$ or a bare length $r$ in the equations. Neither does it make sense to have a bare $1m$ in there. It does make sense though to have a parameter $\frac{r}{1 m}$ or $\frac{x}{r}$. This is always the case, but it becomes more apparent when the function in question takes the shape of, for instance, a logarithm.

-

I would like to propose an alternative view on the potential "dimensionlessness" of the logarithm function, related to its relationship to integrals and derivatives of power functions, and its closeness to the 0th-power function. If ones computes a primitive $\int t^p dt$, of $t^p$, $p \neq -1$, one gets, on well-set intervals: $c_p \times t^{p+1}$. Each time, one gains another dimension. When you differentiate, you loose dimensions up to degree 0 for positive powers. For negative powers, this goes to $-\infty$. Something is going on around zero. It is customary to set a zeroth-power of a non-null scalar to 1. If you now fix a non-null $t$, the coefficient of variation for a real p-power near 0 goes like: $$\frac{e^{p \log x} - x^0}{p-0} \approx \frac{1 + p\log x - 1}{p}$$ as $p$ tends to $0$. So $\log x$. So in a way, a constant is a limit behaviour of the logarithm, or the other way around. Hence, the logarithm should be somehow unitless.

There are similar concepts in statistical experimental data analysis. When you try to find a relationship between variables $y$ and $t$, and cannot find a linear one, some try to modify at least one variable with a power function. J. Tukey ("inventor" of the box-plot and the FFT) proposed the transformation ladder, or ladder of powers, by looking at $y = a+ bt^{p}$. A more satisfactory solution lies in the Box-Cox transform: if $\hat{t}$ denotes the geometric mean of $t$, and $\alpha$ some shift, then: $$t_\alpha^{(p)} = \frac{(t-\alpha)^p - 1}{p \hat{t}^{p-1}}$$ where you see that a good care is taken at keeping the same "unit" between $t_\alpha^{(p)}$ and $t$. Guess what? For $p=0$, they set $t_\alpha^{(0)} = \hat{t}\log (t+\alpha)$.

In a word, the 0th-power of a constant is 1, the 0th-power of a variable is its $log$. Somewhat.

References:

J. W. Tukey, Exploratory Data Analysis. Addison-Wesley, 1977.

G. E. P. Box and D. R. Cox, An analysis of transformations, Journal of the Royal Statistical Society. Series B, 1964.

Related at Stackexchange: Modern successor to Exploratory Data Analysis by Tukey?

-

Logarithmic function is readily used for transformation from one scale to another. Infact a scale/unit is a measurement and hence dimentionless, but to construe in physical sense we appropriate a unit relative to a absolute standard for the value to make sense and be reproducible. Thus answering your question. Log (x) is unitless, for all the mathematical operation performed are intrinsically unitless.. For better understanding i would like to give an imaginary example: "When i go running with my friend the distance between us is proportional to the speed my friend runs at" In this example the units on either side of equality are entirely arbitary depending on the formulation of situation it could well be dimentionless--m/s or lets say weather then celsius--m/s !

Hope this helps.

-

My two cents is that this is a classic mix up of meta levels.

A kilometer is a measure on the ground of the earth. When we make a map, a meta level to the actual measure, the length on the map is maybe 1cm per ten kilometers, and we take that in our stride not wondering how it is possible. It is possible because we have very clearly the concept of the map being a meta level.

Suppose we make the map on a logarithmic scale ( funny maps of the globe exist depending on functions). This would mean that what would be marked as a kilometer on this map will be getting logarithmically larger as the real (non-meta) data increase in kilometers. The reason one uses meta levels for quantities that have units is for convenience, projecting the globe on a plane is convenient for what we want to do, though it distorts the relative size of the kilometer on the map , which our "intuition" wants constant.

When we are dealing with exponents and logarithms in physics equations we are very careful to have dimensionless numbers there. It is actually one of the tools, balancing units. Study the Boltzmann distribution as an example.

-

First, the question is a little ill-posed. In a log plot, for example, the quantities are (log X) km, not log(X km). We need to define the question further: What does it mean to "take a logarithm"? The logarithm, or any such function, is defined to take a real or complex number and give a new number based on a certain rule. Giving it something other than a number is a little like asking "How much does the number three weigh?"; it does not make sense because the function that gives the weight of an object does not accept numbers.

(Consider physical equations that involve physical quantities as arguments of logarithms, trigonometric functions, or as exponents. Experience tells us that, in equations arising from nature, the units of quantities within exponents and functions always combine to give a dimensionless number. Any meaningful expression must come from physical reasoning, so you would need to arrive at this question from physical reasoning as well..)

As Ben Cromwell noted in his comment, I am sure there are ways of representing units in mathematics.

-
Actually you plot $\log (X/km)$ – Rob Jeffries Sep 15 '15 at 9:20

It is something that's neither a physical quantity nor a dimensionless number, but something that can just be described as logarithm of a physical quantity. There is not much problem with this: let $\mathcal{P}$ be the space of physical quantities. We can span this space in a vectorspace-like manner by base-physical units (eg. SI) as described by Willie Wong. What's important: we know that we can't perform certain operations in this space, for instance we cannot add a mass to an electrical current. Addition of quantities $a,b\in\mathcal{P}$ is only defined if $a$ and $b$ have the same dimension, that is, if $\exists x\in\mathbb{R}$ such that $a=xb$. Multiplication is always defined and always yields a physical quantity again. (This also defines powers of physical quantities, but not what, say, the exponential of one of them is.)
We then know that $\mathbb{R}\subset\mathcal{P}$, since for, say, two lengths $a,b\in\mathcal{P}$ the ratio $\tfrac{a}b$ will be a dimensionless number. For these dimensionless quantities, the logarithm is defined right from the start.

It's quite simple to extend this to a full space $\ln\!\!\mathcal{P}\supset\mathbb{R}$: for $a\in\mathbb{R}\subset\mathcal{P}$, the logarithm is defined as usually. For $a\not\in\mathbb{R}$, we define the logarithm axiomatically: first we require $\ln\!\!\mathcal{P}$ to be an abelian group WRT addition, even a vector space over $\mathbb{R}$. Then, for $\lambda\in\mathbb{R}$, \begin{align} \ln(a^\lambda) &:= \lambda\ln(a) \end{align} and for $b\in\mathcal{P}$, $$\ln(ba) := \ln(b) + \ln(a).$$ Provided that $a$ and $b$ have the same dimension and therefore can be added, this already tells us the logarithm of the sum: we know that then $\exists x\in\mathbb{R}\colon b=ax$, in other words we can write any sum of physical quantities as a product of one of them with a real number, so the logarithm of any length cooks down to the logarithm of any one particular length, plus the logarithm of the ratio between the lengths.

Coming back to your question: what is the logarithm of a kilometre? The answer: $\ln(1\:\mathrm{km})=\ln(\mathrm{km})$. If you treat kilometres as the basis unit of length, then this is all you need. If you prefer metres or inches or whatever, you just get $$\ln(1\:\mathrm{km}) = \ln(1000\:\mathrm{m}) = \ln(1000) + \ln(\mathrm{m})$$ $$\ln(1\:\mathrm{km}) = \ln(\tfrac{1\:\mathrm{km}}{1"}\:\mathrm{"}) = \ln(\tfrac{1\:\mathrm{km}}{1"}) + \ln(\mathrm{"}) \approx 10.58 + \ln(\mathrm{"})$$ Here, $\ln(\mathrm{km}),\ln(\mathrm{m}),\ln(\mathrm{"})$ are not dimensionless numbers. Rather think of them as elements of a vector space that has the real numbers as a subspace.

-

The best way to think about it is that a number like 1 km consists of a dimensionless 1 multiplied by a unit, km. When you take the log of a product, you get the sum of the logs, so log(1 km) is the same as log(1)+log(km). This shows that the log of 1 km is neither a dimensionless quantity nor a dimensionful one. If it was dimensionless, then it would be expressible without reference to any system of units. If it was dimensionful, then it would change by multiplication when the system of units was changed. It's neither of these things.

-
1 km isn't a number. 10 km consists of the number 10 and the definition of 1 in that system of units. Therefore, you decomposing log (1 km) into log(1) + log(km) lacks a sensible reason for doing so. – John McVirgo Aug 7 '11 at 20:38
@John McVirgo: "1 km isn't a number." Different people have different ways of thinking about this. Mathematicians would typically say that in x=1 km, 1 is the value of x, and the "km" is part of the definition of x. Scientists usually consider the "km" to be part of the value of x. This can all be formalized, e.g., you can define a group of SI units under multiplication, which is isomorphic to a three-dimensional vector space with one basis vector for each SI base unit. – Ben Crowell Aug 8 '11 at 15:26
I found this to be a clever answer :) – Alan Rominger Aug 26 '11 at 12:24

Here's one "mathematical" but highly unphysical answer.

Using that $km\cdot km = (km)^2$ etc, we can formally define arithmetic of numbers with units over a graded algebra $A = \oplus_{k\in \mathbb{N}} V_k$ where $V_k = \otimes^k V$ where $V$ is treated as a one-dimensional real vector space ($V_0$ is the scalar $\mathbb{R}$). The choice of unit is the choice of a basis vector in $V$. $V_0$ is the pure scalars. So for each choice of a basis vector $v \in V$, we get mapping from the infinite sequence $\mathbb{R}^{\mathbb{N}}\to A$ realizing that sequence via $(r_k) \to [r_k]_v = \sum r_k (\otimes^k v)$. We define multiplication $V_k\times V_{k'} \to V_{k+k'}$ as usual.

(We'll not define the negative power units for now. But they probably can be incorporated analogously.)

Then formally we can define $\exp: A \to A$ by the power series expansion

$$\exp a = \sum_{k = 0}^{\infty} \frac{1}{k!} a^k$$

where $a^k$ is defined in the sense of the graded algebra. And there, we have defined what it means for $\exp$ of something with units. Change of base of $\exp$ is handled by $y^a = \exp (\ln(y)\cdot a)$. And similarly the change of units is naturally incorporated, using the fact that a change of basis on a one dimensional real vector space is just multiplication by scalars. In other words, we have $[r_k]_v = [r'_k]_{v'}$ where $r_k = s^kr'_k$ when $v = s v'$.

Using this we can formally invert the power series expansion to find what $\ln$ "should" be. Fix a unit $v$. Take $(r_k) \in \mathbb{R}^{\mathbb{N}}$ and consider $[r_k]_v \in A$. To find $\ln [r_k]_v$ we need to find $(s_k)\in \mathbb{R}^{\mathbb{N}}$ such that

\begin{align} r_0 & = \exp s_0\\ r_1 & = e^{s_0} s_1 \\ r_2 & = e^{s_0} (s_2 + \frac{1}{2} s_1^2)\\ & \vdots \end{align}

(we can also use the Taylor expansion of $\ln$ around $1\in\mathbb{R}$ to get the expression for $(s_k)$ in terms of $(r_k)$.)

Unfortunately, even in this frame work $\ln 1 km$ is still not well-defined: in the image of $\exp$, $r_0$ is necessarily positive. Formally, it is possible to define $\ln (1 km) =$\ln (1 + (1 km - 1))$as the rather divergent, power series $$\ln (1 m) = \sum \frac{(-1)^{k+1}}{k} (-1 + 1 (m))^k = \sum \frac{-1}{k} + \sum 1(m) - \sum \frac{k-1}{2} (m^2) + \cdots$$ Now some fun with divergent series: note that$\sum 1 = \sum (-1)^k(-1)^k = \sum (-1)^kx^k |_{-1}$is the Taylor series expansion of$1/x$around$x_0 = 1$evaluated at$-1$, so the second term is nominally$\lim_{x\to 0+} 1/x$. So even if we regularise: $$\lim_{\delta \to 0+} \ln (\delta + 1m) = \lim_{\delta \to 0+} \ln \delta + \delta^{-1} m + \cdots$$ is still heavily divergent. (Observe, that, however,$\ln (1 + 1km) = \sum (-1)^{j+1}/j (km)^j$is well defined as a formal power series.) So what was the point of this post? This post is primarily addressed at the conclusion that$\log m$is a "dimensionless number" as stated in the statement of the question. While in the usual arithmetic we are taught that we cannot add apples to oranges, that is only if we take the point of view of trying to add an object in the$\mathbb{Z}$-module of apples to a separate object in the$\mathbb{Z}$-module of oranges. If you are willing to work in the direct sum module of apples$\oplus$oranges, you can indeed add apples to oranges. Now, implicitly in asserting that$\log$makes sense for objects with units, (and similarly that$\exp$makes sense for objects of units), it is necessary that we already work in a system, that of the graded$\mathbb{R}$-algebra, in which you can add a scalar (an object with no units) to a vector (some object with units). So in asserting that you want to make sense of$\log km$, you cannot conclude from it that$3$and$\log m$must have the same units. - Nice answer. I was just about to post something similar. – goblin Feb 20 '15 at 11:35 The closest thing to "Logarithm units" are decibels, which are 10 times the base 10 logarithm of a ratio. To put any physical quantity into a decibel-like unit, you need to first divide by some reference quantity. For example, the "decibel" unit for power is "dBm", which is the ratio of the power in question over 1 mW, expressed in dB: [dBm] = 10 log_10 (Power / (1 mW)) - Yes, logarithms always give dimensionless numbers, but no, it's not physical to take the logarithm of anything with units. Instead, there is always some standard unit. For your example, the standard is the kilometer. Then 20 km, under the log transformation, becomes$\ln(20\;\textrm{km}\;/\;\textrm{km}\;)$. Similarly, the log of 10 cm, with this scale is $$\ln(10\;\textrm{cm}\;/10\;\textrm{km}\;) = \ln(10\times 10^{-3} / 10^{3}) = \ln(10^{-5})$$ - can you explain why it isn't physical to take the log of anything with units? – Larry Harson Aug 1 '11 at 14:15 @user: See the link I put in the comments on the question which addresses that issue directly. – dmckee Aug 1 '11 at 14:45 @dmckee nice link, but I was hoping to get a different view from Carl. I don't think people are getting to the heart of the question and are merely hand waving: "It's not physical to take the logarithm of anything with units" is easy to regurgitate from high-school physics. To offer physical insight into the why involves understanding. – Larry Harson Aug 1 '11 at 16:54 @user2146: the 'why' is justified by the Buckingham Pi Theorem: if you see$\ln(20 \text{km})$somewhere in a physics equation, it means that there must be a counterterm$-\ln(16 \text{km})\$ somewhere else. – Gerben Aug 3 '11 at 12:41

## protected by Qmechanic♦Jul 27 '13 at 17:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.