# The logarithm is non-linear

Almost unexceptionally, I hear people say that the logarithm was a non-linear function. If asked to prove this, they often do something like this:

We have $$\ln(x + y) \neq \ln(x) + \ln(y) \quad\text{and}\quad \ln(\lambda \cdot x) = \ln(\lambda) + \ln(x) \neq \lambda \cdot \ln(x),$$ and therefore $\ln$ is not linear.

And indeed, the literature is abundant with the claim that...

... a function $f : V \to W$ is linear, if and only if $$f(x + y) = f(x) + f(y) \quad\text{and}\quad f(\lambda \cdot x) = \lambda \cdot f(x)$$ for all $x,y$ and all scalars $\lambda$.

Often, there is no hint that the symbols $+$ and $\cdot$ on the left belong to $V$, whereas the symbols $+$ and the $\cdot$ on the right belong to $W$.

# The logarithm is linear

My proof that the logarithm is a linear function goes like this:

$$\ln(x \cdot y) = \ln(x) + \ln(y) \quad\text{and}\quad \ln(x^\lambda) = \lambda \cdot \ln(x).$$

The rationale for this is that $\ln : \mathbb{R}_{>0} \to \mathbb{R}$, i.e., the logarithm is a function from the $\mathbb{R}$-vector space $\mathbb{R}_{>0}$ (the positive-real numbers), to the $\mathbb{R}$-vector space $\mathbb{R}$ (the real numbers). Vector addition in $\mathbb{R}_{>0}$ is, however, not usual addition, but multiplication. Likewise, scalar multiplication in $\mathbb{R}_{>0}$ is not usual multiplication, but potentiation.

In fact, the linear-algebra definition of linearity is (e.g. Ricardo, 2009; Bowen and Wang, 1976):

A function $f : V \to W$ from a vectors space $(V,\oplus,\odot)$ over a field $F$ to a vector space $(W,\boxplus,\boxdot)$ over $F$ is linear if and only if it satisfies $$f(x \oplus y) = f(x) \boxplus f(y) \quad\text{and}\quad f(\lambda \odot x) = \lambda \boxdot f(x)$$ for all $x,y \in V$ and $\lambda \in F$.

Another proof goes as follows:

The logarithm is an isomorphism between the vector space of positive-real numbers to the vector space of real numbers. And as every isomorphism is a linear function, so is the logarithm.

# Question

We have two conflicting statements here:

1. The logarithm is non-linear.
2. The logarithm is linear.

Can both statements be correct simultaneously, depending on something I cannot imagine now? But wouldn't this also imply that two conflicting concepts of linearity exist?

Or is this a case of sloppy notation, e.g., abuse of the same symbol $+$ for vector addition or $\cdot$ for scalar multiplication even though two different vector spaces are involved?

## Update

The solutions given to rescue the first statement haven't convinced me yet, because they are inconsistent:

• Using usual addition and multiplication on $\mathbb{R}_{>0}$ implies that $(\mathbb{R}_{>0},+,\cdot)$ is not a vector space anymore. But a precondition of the linearity proof is that the domain and the range of $f$ are vector spaces.
• Allowing the domain of $\ln$ to be $\mathbb{R}$ with usual addition and multiplication instead of $\mathbb{R}_{>0}$ doesn't work, because then the image of $\ln$ is the set of complex numbers.
• A mathematically consistent definition of "linearity" for subsets (but not subspaces) of a vector space was given in a comment by @Alex G. Let $S$ be an arbitrary subset of a real vector space $V$, and let $W$ be a real vector space. A function $f : S \to W$ is called "linear" if for all $x,y \in S$ such that $x+y \in S$, then $f(x+y) = f(x)+f(y)$, and for all $x \in S$, $k \in \mathbb{R}$ such that $kx \in S$, then $f(kx)=k⋅f(x)$. However, this definition is not what is meant by the concept of linearity coming from linear algebra. One would actually need to use another term for "linearity" here.
• Concise, but not a fleshed-out answer: when people say the logarithm is non-linear, they mean that it is not a linear endomorphism of the natural (additive) vector space $\mathbb R$ over $\mathbb R$. (I know I'm late to the party :-) – theage Aug 15 '15 at 18:44
• But then you would not neccessarily need to go through the steps of the linearity proof. It might be enough to check whether the domain and the image of the function are identical. If they are not, $f$ is not an endomorphism and therefore "non-linear". However, this concept of "linearity" differs from the concept used in linear algebra where domain and image can differ, right? – Björn Friedrich Aug 15 '15 at 19:26
• They are not conflicting because they mean two different things. Language is funny that way. You've found a trivial way to make any one-to-one and onto function to $\mathbb R$ linear. It's not really interesting. – Thomas Andrews Aug 15 '15 at 21:18
• With your idea, any bijective fuinction $f\colon \mathbb R\to X$ would be linear, simply by endowing $X$ with the induced linear structure. – Hagen von Eitzen Aug 17 '15 at 9:22
• What you notice is that $\ln$ is in fact an isomorphism between the additive group, and the multiplicative group of the positive reals. – Asaf Karagila Aug 18 '15 at 8:48

You are correct if we endow $\Bbb R_{> 0}$ with the strange vector space structure in which "addition" is given by the usual multiplication, and "scalar multiplication" is given by exponentiation. When people say that logarithms are not linear, they are usually thinking of giving $\Bbb R$ the usual vector space structure, and with this being understood, then logarithms really are not linear.

The takeaway here is that the statement "the logarithm is linear" depends on what vector space structure you have in mind. With your strange vector space structure, this is true. With the usual one, this is false.

• Well, but the domain of the logarithm is just $\mathbb{R}_{>0}$ and not $\mathbb{R}$. So let us assume the set of the domain is fixed to be $\mathbb{R}_{>0}$. But if you now want to apply the "usual" vector space strucutre of $\mathbb{R}$ to $\mathbb{R}_{>0}$, then $(\mathbb{R}_{>0}, +, \cdot)$ is not a vector space anymore, because there are no additive inverses. As a conseque, the preconditions for the linearity proof would not be satisfied, implying that the "proofs" are no proofs. Only if the correct vector space strucutre of the domain is taken into account, is the proof valid. – Björn Friedrich Aug 15 '15 at 14:15
• People will call a function "linear" even if its domain is only a subset of a vector space. The function would be called linear if it satisfies the linearity properties whenever addition and scalar multiplication are actually defined. This definition applies in this case and is what people mean when they say the logarithm is not linear. – Alex G. Aug 15 '15 at 15:08
• Let me clarify the words you just repeated. Let $S$ be an arbitrary subset of a real vector space $V$, and let $W$ be some other real vector space. A function $f: S \to W$ is called linear if for all $x, y \in S$ such that $x+y \in S$, then $f(x+y) = f(x)+f(y)$, and for all $x \in S$, $k \in \Bbb R$ such that $kx \in S$, then $f(kx) = k \cdot f(x)$. The logarithm does not satisfy this property, so people will say that it is not a linear function. – Alex G. Aug 15 '15 at 15:31
• @AlexG.: If a function is only defined on a subset of a vector space, and it has the linearity property on that subset, then it trivially extends to a linear function on the subspace spanned by that subset. In the case where that subset spans the whole vector space, it then extends to a linear function on the whole vector space, of course. So IMO it's rather pointless to talk about functions being linear but only defined on a non-subspace subset. The only case where they're not extendable is when they're not linear. – R.. GitHub STOP HELPING ICE Aug 16 '15 at 2:30
• @R.. What you've written is not correct. For instance, as Milo suggests, take $S = \{(x,y)|x=1\} \subset \Bbb R^2$ and let $f:S \to \Bbb R$ be given by $f(x,y) = y^2$. Then $f$ is linear under my definition, but it is not the restriction of any linear function $\tilde{f}: \Bbb R^2\to \Bbb R$ – Alex G. Aug 16 '15 at 2:53

it's worth noting that with your argument, any bijection is linear!

We have a set $X$ and a vector space $Y$. We have a bijection $$f: X \to Y.$$

We simply define the operations $$x+y = f^{-1}(f(x) + f(y)), \;\;\; \lambda x = f^{-1}(\lambda(f(x)).$$ Now $f$ is linear.

The issue is that when we say $f: V \to W$ is linear, we generally already have linear structures on $V$ and $W$ that are not defined in terms of $f.$

• Although the logarithms are unique as they are the only ones which turn the basic operations multiplication into addition and exponentiation into multiplication (?) – mathreadler Aug 16 '15 at 3:24
• once you fix the structures the number of linear functions becomes small. Take any linear function, g, from R to R (with the usual structures) and consider $g \circ \log$. This will be linear with your structure. – Mark Joshi Aug 16 '15 at 3:29

The first statement you have is:

The logarithm is not the restriction of linear map $(\mathbb R,+)\rightarrow (\mathbb R,+)$ to $\mathbb R_{>0}$.

The second one you have is:

The logarithm is a linear map $(\mathbb R_{>0},\cdot)\rightarrow(\mathbb R,+)$.

I don't see any contradiction there. Certainly $f(xy)=f(x)+f(y)$ does not imply $f(x+y)=f(x)+f(y)$ and neither does the latter imply the former, so the statements are unrelated (and both true). It's not like we magically get a contradiction when we refer to both those two equations as a condition of linearity. We call the logarithm "non-linear" because the first statement refers to the canonical vector space structure on $\mathbb R$, which what we'd assume if nothing is specified.

It's also worthy of note that, if we're considering the logarithm, we're probably considering it as a map on a single structure with both addition and multiplication, rather than a map between two separate structures; the identity $\log(xy)=\log(x)+\log(y)$ relates multiplication to addition, which is only particularly remarkable when we've defined both in a sensible way (like in a ring or field).

• @BjörnFriedrich I did not restrict the domain of the logarithm (I just used what you'd discussed in your question). My point is that there is no linear function $(\mathbb R,+)\rightarrow(\mathbb R,+)$ that agrees with the logarithm on every point of the logarithm's domain (whatever we take that to be). This is what is meant by "the logarithm is non-linear" and this is by convention, since that phrase would be meaningless if we did not assume it applied to the canonical structure. – Milo Brandt Aug 15 '15 at 19:41

I will work through this, trying to justify everything I do to the detail. What I'll end up with will probably be something like a summary of the other answers and the question statement, but it is done with the hope that nothing at all "sketchy" appears in arguments.

• The fundamental definition. A function $f:(V,+,\cdot)\to(W,\oplus,\odot)$ of vector spaces, both over a field $K$, is said to be linear if, for all $x,y\in V$ and $\lambda\in K$ we have $$f(x+y)=f(x)\oplus f(y)\qquad f(\lambda\cdot x)=\lambda\odot f(x).$$

• Our vector spaces. We will denote by $\mathbb R^+$ the vector space $(\mathbb R,+,\cdot)$ over the field $\mathbb R$, where $+,\cdot$ are assumed to be the usual operations on $\mathbb R$. This is a vector space. We will denote by $\mathbb R^\times$ the vector space $(\mathbb R_{>0},\oplus,\odot)$ over $\mathbb R$, where by definition $x\oplus y=x\cdot y$ and $\lambda\odot x=x^\lambda$ with the universal quantifiers of Point 1. This is also a vector space.

• Linearity on general subsets. The only canonical way to even potentially think about defining linearity of a function $f:S\to(W,\oplus,\odot)$ where $S$ is a subset of the underlying space of the vector space $(V,+,\cdot)$ (all over $K$) is simply to generalize and use AlexG's definition. To quote: A function $f:S\to W$ is called linear if for all $x,y\in S$ such that $x+y\in S$, then $f(x+y)=f(x)\oplus f(y)$, and for all $x\in S$, $k\in\mathbb R$ such that $k\cdot x\in S$, then $f(k\cdot x)=k\odot f(x)$. However, this notion is unfortunately not very useful: indeed, as in another comment we can consider a horizontal translate of the $y$-axis in $\mathbb R^2$. It is easily verified that every function from this subset to any vector space is vacuously linear, which is quite undesirable. This is why we in general reserve the notion of linearity for linear domains. (Mathematicians knew what they were doing as linear algebra was developed!) The conclusion is that linearity is not naturally definable on non-subspace subsets of a vector space, and thus we discard the notion (as mathematically consistent, whatever that means, as it is.)

• The logarithm. The range of the logarithm is in general dependent on which domain we choose. We have essentially two options: either take our domain to be $\mathbb R_{>0}$ in which case the range is $\mathbb R$, or take our domain to be $\mathbb R$ in which case the range is $\mathbb C$. For the purposes of this discussion, we work entirely in real numbers (or subsets of the real numbers) and thus choose the logarithm to be the natural function $\ln:\mathbb R_{>0}\to\mathbb R$. For all elements $x,y\in\mathbb R_{>0}$ of the domain and $\lambda\in K=\mathbb R$, the logarithm satisfies the relations $$\ln(x\oplus y)=\ln(x)+\ln(y)\qquad\ln(\lambda\odot x)=\lambda\cdot\ln(x)$$ where $\oplus,\odot$ are defined in Point 2, and $+,\cdot$ are the natural operations on $\mathbb R$.

• "The logarithm is non-linear." The logarithm is not even a function $\mathbb R^+\to\mathbb R^+$ of vector spaces (by the last Point), so that it is trivially not a linear function. Further, even under subset linearity (a pathological and unnecessary definition), it is non-linear by the first proof in your post as a function $\mathbb R_{>0}\to\mathbb R^+$ for $\mathbb R_{>0}$ viewed as a subset of the vector space $\mathbb R^+$. This, formally or informally, is the truth behind "nonlinearity of the logarithm."

• "The logarithm is linear." By your second proof, the logarithm is a linear function of vector spaces $\ln:\mathbb R^\times\to\mathbb R^+$ over $\mathbb R$. This is a distinct notion of linearity, and there is neither sloppy notation nor a contradiction.

This answer, like those before it, is probably incomplete. However, I hope I've at least demonstrated to some extent that no contradictions are actually arising.

• Good summary. Thanks :-) – Björn Friedrich Aug 16 '15 at 8:02
• "Linearity on a subset of X" is generally understood to be the perfectly sensible concept of "being the restriction of a linear function on X to that subset" (assuming linear function on X is a sensible concept, perhaps by inheritance from a still larger domain). For example $f(n)=3n$ is a nice linear function from the odd integers to themselves, by restriction, but defining it in terms of properties of $f(x+y)$ runs into the problem that $x+y$ is not in domain or range. OP is confusing linear functions, which need no structure on the range, with linear operators, which do. – ASCII Advocate Aug 16 '15 at 22:49

You are correct, $\ln$ is linear for this vector space structure on $\mathbb{R}_*^+$ (though not for the usual vector space structure on $\mathbb R$.

The thing is that this vector space structure you defined has no real interest, so people don't use it. In fact probably most functions could be made into something linear for a weird, custom-made vector space structure, but there would be no point.

• Actually any invertible function $f: V\to X$ from a vector space $V$ to an arbitrary set $X$ can be made linear by giving $X$ the vector space structure defined by $x+y := f(f^{-1}(x) + f^{-1}(y))$ and $\lambda x := f(\lambda\,f^{-1}(x))$. Of course, due to invertibility, it doesn't matter on which side the original vector space sits: for $f: X\to V$ just use the same construction on the inverse function. – celtschk Aug 15 '15 at 14:08

The error in the question is to assume that people say "linear" only in the context of algebra (where log can be interpreted as linear in the way you explained) when in fact the usage almost everywhere else is incompatible with this alternative interpretation. Examples include

• linear functions in geometry (and physics, science, economics, etc), as ones whose graph belongs to a straight line
• linear growth and linear estimates in analysis
• linear time and space in computational complexity theory
• sublinear, superlinear, quasilinear

Even in algebra there are

• linear algebraic groups, general linear group $GL_n$, special linear group $SL_n$. There is no linear algebraic group representation using the logarithm.

In some of these uses there is no $\mathbb{R}$ or $\mathbb{R}^{\ast}$ involved. It would be unbelievable to argue that in all these cases there is some hidden choice of "linearizing structure" that was not specified but can be consistent with log(x) being linear, so that LOGSPACE is really linear space for some other convention than the one actually in use in this universe.

Thus the resolution of this "paradox" is to recognize that logarithm is necessarily nonlinear in most situations, and in algebra having it be nonlinear is just the default option that one can over-ride locally (with suitable warning to the reader or listener) in a particular context.

• Linear, meaning of degree 1 when written using algebraic formulas (or strongly tied to that, such as piecewise linear, O(n) bounds being linear, etc), was in use for centuries before the appearance of the concepts you are appealing to in order to (unconvincingly) overthrow the standard language habits. That is the "basis of all areas" and the "most fundamental concept" as you call them, and this is reflected in the totally robust and consistent usage of the term in practically every area of mathematics. – ASCII Advocate Aug 16 '15 at 15:29
• The majority of 21st century mathematicians, and an equally large number of scientists/engineers/etc, are pretty well aware of this "problem" you have impressed yourself with, and have been for at least the past 50 years. Despite this, they succeed in using phrases like "log(x) is nonlinear" without confusion and without your personal authorization. This might be a big clue for you that there is probably nothing wrong in what they do, but there might be something wrong in your understanding of the language and mathematical issues. Or just ignore that if it curves your reality too much. – ASCII Advocate Aug 16 '15 at 23:40