Suppose we have the following equation: $$ \frac{1}{r}\mathrm{d}r=\frac{1}{T}\mathrm{d}T $$ where $r$ be the distance and $\dim r=L^1$, and T can be the temperature with $\dim T =\Theta^1$. In this equation, both the LHS and the RHS are Dimensionless, so the equation is legal in physics.

However, if we integrate it, then we have: $$ \left.\ln r\right|_i^f=\left.\ln T\right|_i^f $$ where i and f means initial state and final state. Now comes the problem: any expression appeared in $\ln$ should be dimensionless, but this equation doesn't obey the rule.

If we use $\exp$ to fetch out the expression the problem can be bigger, we get $r=T$ while they have different dimension.

What's the problem here?


The expression is still dimensionless, since special functions generally take dimensionless quantities as arguments. You can rewrite the logarithm as $$ \ln r\Big|_i^f = \ln r_f - \ln r_i = \ln \left(\frac{r_f}{r_i} \right) $$ which is dimensionless.

For the record the intermediate step might raise some concerns, but as commented by ZeroTheHero you can make the whole procedure rigorous by picking some length scale ($r_0$ and $[r_0]=$ m) and non dimensionalizing the equation $$ \bar{r} = \frac{r}{r_0} \quad\Rightarrow \quad \mathrm{d}r = r_0\mathrm{d}\bar{r} $$ which leads to $$ \frac{1}{r}\mathrm{d}r = \frac{1}{\bar{r}r_0}r_0\mathrm{d}\bar{r} = \frac{\mathrm{d}\bar{r}}{\bar{r}} $$ so the solution would look like $$ \ln \bar{r} \Big|_{i}^{f} = \ln \bar{r}_f - \ln \bar{r}_i = \ln\left(\frac{\bar{r}_f}{\bar{r}_i}\right) = \ln\left(\frac{r_f}{r_0}\frac{r_0}{r_i}\right) = \ln\left(\frac{r_f}{r_i}\right) $$

  • $\begingroup$ Do you think that your middle step ($\ln r_f - \ln r_i$) is illicit? ['m reminded of cancellation of infinities in QED !] $\endgroup$ Sep 1 at 9:27
  • 5
    $\begingroup$ @PhilipWood. No. Just use some length scale $\Lambda$, the dimensionless variable $\bar r=r/\Lambda$ and proceed so that everything is dimensionless. $\endgroup$ Sep 1 at 10:50
  • $\begingroup$ If you make that substitution at the very beginning (in $\frac1r dr=\frac1T dT$ then – agreed – you're fine. $\endgroup$ Sep 1 at 11:21
  • $\begingroup$ @PhilipWood The middle step is fine. You get log-units from both sides of the minus sign, which cancel in the subtraction, e.g. $\ln (5\ \mathrm{m}) - \ln (2\ \mathrm{m}) = \ln (5) - \ln (2) + \ln (\mathrm{m}) - \ln (\mathrm{m}) = \ln (5) - \ln (2)$. $\endgroup$
    – Brick
    Sep 2 at 15:53
  • 1
    $\begingroup$ @PhilipWood You could posit that the answer to your question is that you get 5 m from raising $e$ to the $\log (5\ \mathrm{m})$ power. If you take that as a definition, then the question would be whether that meets the basic criteria, e.g., of being consistent, unique, etc. There are questions about what sense it makes via the power-series definition of $\log$, but if you define it by the algebraic property then I believe you have uniqueness, consistency, etc. I don't think it necessarily works for arbitrary functions, but the question doesn't require arbitrary functions. Only log. $\endgroup$
    – Brick
    Sep 2 at 16:47

Yes you have spotted an issue which is an example of something much more widely prevalent in mathematics and physics, but which usually gets noticed with the log function first of all.

First of all, let's be clear: the $\ln(x)$ on its own is only well-defined when $x$ is dimensionless.

Let's now consider $\ln(x/y)$. If both $x$ and $y$ are dimensionless then one can write $$ \ln(x/y) = \ln(x) - \ln(y). $$ Now it is quite widespread in physics for people to write this same result even when $x$ and $y$ are dimensional quantities. Strictly speaking one ought not to do that unless one warns the reader that one is employing a shorthand for the sake of clarity, and any logs of dimensioned quantities are going to be combined with further logs such that overall the log function will only need to be evaluated on a dimensionless quantity in the end.

Next the question arises, do we find similar issues with other functions? The answer is yes. For example $$ x^{a/b} = (x^a)^{1/b} $$ makes sense if $a$ and $b$ are dimensionless, but becomes problematic when $a$ and $b$ are dimensional (how do you raise anything to the power of one kilogram for example?) It turns out that as long as the algebraic manipulations are correct then all such expressions will retain their validity as one works through a sequence of steps, in the sense that one can always recombine the parts of the expression so that dimensionless quantities appear where they ought to. But writers sometimes fail to do this correctly, for example by dropping a constant term. In thermodynamics discussions you often see things like $\ln(V)$ where $V$ is a volume; in electromagnetism you might encounter $\ln(r)$ where $r$ is a distance. In all such cases there is always some other volume or distance or whatever which has been dropped, and really the expression is $\ln(V/V_0)$ or $\ln(r/r_0)$ or whatever.


Let's see now how this issue could go by 'under the radar' and not be noticed by many working scientists. It is because when we evaluate something like $$ \ln(T_1) - \ln(T_2) $$ where $T_1$ and $T_2$ are temperatures then as long as we use the same units for both then it will be ok. Here is why. Let $T_0$ be a temperature equal to 1 kelvin. Let $y_1$ and $y_2$ be dimensionless numbers such that $$ T_1 = y_1 T_0, \;\;\;\;\; T_2 = y_2 T_0 $$ Then $$ \ln(T_1) - \ln(T_2) = \ln(y_1) + \ln(T_0) - \ln(y_2) - ln(T_0) \\ = \ln(y_1) - \ln(y_2) + \ln(T_0/T_0) = \ln(y_1) - \ln(y_2). $$ In this sequence of steps, only the expressions on the second line are strictly legal with all parameters of functions dimensionless. When evaluating the first expression the unsuspecting scientist might think they are evaluating first $\ln(T_1)$ and then $\ln(T_2)$ and then taking the difference. They are not. The numbers they actually enter into their calculator or computer are not $T_1$ and $T_2$ but $y_1$ and $y_2$, and they take the logs of those. It works as long as they have used the same units for both temperatures, since then the final term $\ln(T_0 /T_0) = 0$.

  • 2
    $\begingroup$ This is really interesting. I started thinking about ways you could be clever with this... then I figured someone else would have done it, and Google produced this page by John Baez: math.ucr.edu/home/baez/physics/General/logs.html ... who warns at the end not to bother trying because it goes nowhere. Oops! Heh. $\endgroup$ Sep 2 at 2:04
  • $\begingroup$ Radar range equation as written by an EE will be written in log units. Left-hand side is log-power and right-hand side is also log-power. That's perfectly well-defined, used in practice, and not really consistent with what you're saying that the combination of log-units has to result in something unitless. As with all units, what matters is that you end up with consistent units on both sides. $\endgroup$
    – Brick
    Sep 2 at 17:35
  • $\begingroup$ @Brick Have a look at the answers to physics.stackexchange.com/questions/364771/… $\endgroup$ Sep 2 at 17:36
  • $\begingroup$ Yes, I saw those and thought they were unfortunate too. $\endgroup$
    – Brick
    Sep 2 at 17:40

Interesting question. Two ways to look at it:

  1. $\ln T\Big|_i^f = \ln (T_f)-~ \ln(T_i) = \ln \frac{T_i}{T_f}$, which helps a bit but is still perhaps unsatisfying because units shouldn’t depend on form.

  2. $\ln(\cdot)$ is an exponent and hence is unitless. $\ln(\cdot)$ reports to us what the exponent was. There can never be an incidence in any system (therefore in any equation) in physics where the $\ln$ or $\log_k$ function appears and equality or inequality depends upon units.

For example, using $\exp(\cdot)$ to fetch it out will give the same result in Rankine or Kelvin, because $$\ln(T_{R,f}) - \ln(T_{R,i}) = \ln(T_{K,f})-\ln(T_{K,i})$$ because the exponents differ by the same amount because $\ln(T_R)=\ln(T_K) + c$, where $c$ is a constant.

  • $\begingroup$ What does "units shouldn't depend on form" mean? $\endgroup$
    – LSpice
    Sep 1 at 23:25

(Original answer below the line was more mechanical in how the operations work out. Edit at the top addresses some theoretical issues.)

Empirically we have identified certain "dimensions" like length, time, and mass that correspond to phenomena in the world. Historically, we assigned "units" so that we could compare information about those dimensions. Later we understood that there are fundamental constants of nature that are themselves measurable. The constants provide relationships between units that, historically, we said belonged to different dimensional quantities. For example $c = 3 \times 10^8\ \mathrm{m/s}$ (up to some rounding that's beside the point for now). That's a relationship between one constant and two units.

You could take a different perspective on that equation, however, and think of it as one equation for three unknowns. That let's us eliminate one unknown, but we're stuck with two that physics doesn't (apparently) uniquely determine. From this perspective those are real numbers in an equation, they are just not numbers that we can uniquely determine. So we have to carry them around as appropriate multiplicative factors in expressions.

Now look at something like $\log(5\ \mathrm{m})$. For a lot of good reasons we usually do NOT want to write a log with a unit like that. But it's not ill-defined mathematically as 5 is clearly a real number and, as above, we can think of $\mathrm{m}$ as a real (but unknown) number as well. We also know that it's not zero from the equation and by convention we choose both it and $\mathrm{s}$ to be positive. So, from that perspective, we don't know what specific numerical value to assign to $\log(5\ \mathrm{m})$ but we should expect that it has some value and that, more importantly for your original question, that it obeys the usual rules of log.

Once we accept that it obeys the usual rules of log, then your problem about inconsistent dimensions on the two sides of your equations goes away via a cancelation. Now follows the original answer that get's specific in how that plays out for a sample calculation of differences of log.

(Original answer)

You need to get consistency of units. With the logarithm that can happen in two ways. One way is that the argument is unitless and then the log of that is also unitless. That can happen with a ratio of two values that have units or because you started with values that had no units somehow.

For simplicity of explanation, we usually say that the arguments to the log must be dimensionless, but that's not quite precise. (Though if you ensure it, then you are always good, which why it's stated as the "rule".)

If you want to be general, the unit, is essentially a constant multiplicative factor, so several of the answers are wrongly stating things about expression of the form $\log (x/y) = \log x - \log y$. This is well-formed even when the variables represent dimensionful quantities.

For example, assume they are lengths, and pick some numbers for a sample calculation. Then, e.g.,

$$ \log(5\ \mathrm{m} / 2\ \mathrm{m}) = \left[ \log(5) - \log (2)) \right] + \left[ \log(\mathrm{m}) - \log(\mathrm{m}) \right] = \log(5) - \log (2)) $$

So you get the same answer whether you cancel the units in the expression all the way on the left "first" or if you carry them through the middle expression, so long as you are consistent.

Technically this even works if you use different units for length, but then you have some nasty expressions involving logs of units that don't cancel:

$$ \log(5\ \mathrm{m} / 2\ \mathrm{mm}) = \left[ \log(5) - \log (2)) \right] + \left[ \log(\mathrm{m}) - \log(\mathrm{mm}) \right] \neq \log(5) - \log (2)) $$

So in practice we usually ensure that this doesn't happen. It's not wrong per se, but it's practically useless. Note that you can still work through the mixed-form in a consistent manner though.

You could do it the conventional way: $$ \log(5\ \mathrm{m} / 2\ \mathrm{mm}) = \log(5000\ \mathrm{mm} / 2 \ \mathrm{mm}) = \log(5000/2) = \log 5000 - \log 2 $$

Or equally well:

$$ \begin{align} \left[ \log(5) - \log (2)) \right] + \left[ \log(\mathrm{m}) - \log(\mathrm{mm}) \right] & = \left[ \log(5) - \log (2)) \right] + \left[ \log(1000\ \mathrm{mm}) - \log(\mathrm{mm}) \right] \\ & = \log 5 - \log 2 + \log 1000 = \log 5000 - \log 2 \end{align} $$

  • $\begingroup$ I think the objection is that $\log(\mathrm m)$ is a meaningless collection of pen strokes, and if that's not well-defined then separating the log of the "product" $5\ \mathrm m$ is questionable. For example, $\log(0)=\log(0\cdot 5) = \log(0) + \log(5) \implies \log(5) = 0 \implies 5 = 1$. Of course, I agree that if you treat it as a symbol which formally obeys the algebraic rules governing (nonzero) real numbers and keep it around for bookkeeping then things will turn out okay. $\endgroup$
    – J. Murray
    Sep 2 at 16:31
  • $\begingroup$ This doesn't require a definition of $\log \mathrm{m}$ at all. Only of $\log \mathrm{m} - \log \mathrm{m}$. Even if you define it by the Taylor series, the difference is well-defined because of term-by-term cancelation. @J.Murray $\endgroup$
    – Brick
    Sep 2 at 16:32
  • $\begingroup$ What you're arguing is described in the last sentence of my previous comment. If $\log(m)$ isn't defined, then you can't very well apply algebraic operations like $+$ and $-$, which are defined only for certain mathematical objects (real numbers, functions, etc) but not others (graphs, logical symbols, etc). However, if you say "I am defining $m$ as a formal symbol which is to be treated like a nonzero real number", then you're good to go. $\endgroup$
    – J. Murray
    Sep 2 at 16:42
  • $\begingroup$ Yes, I guess I'm saying something stronger, namely that $\mathrm{m}$ is a positive real number, although I agree that my earlier comment did not communicate that well. Hence I don't see where a new definition is needed at all. @J.Murray Though the "fallback" would be what you said - There's a unique definition as a formal symbol that will also make it hold together. (Unlike your example with $\log 0$ where - as you proved - there is probably no definition that will be consistent.) $\endgroup$
    – Brick
    Sep 2 at 17:25
  • $\begingroup$ Which positive real number would you say that it is? $\endgroup$
    – J. Murray
    Sep 2 at 17:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.