12 Logarithm function
The earth would explode if hit by an earthquake of magnitude 181
On May 11, 1950, a strong earthquake struck Madagascar with an estimated Richter magnitude of 6.2. In 1960, the Great Chilean earthquake—the strongest earthquake ever recorded—reached a magnitude of 9.5. According to standard seismic classifications, a magnitude 6.0–6.9 event is classified as “strong,” whereas a magnitude 9.0–9.9 event is categorized as “extreme,” resulting in near-total destruction.
Why is a jump of just three units—from roughly 6 to 9—such a dramatic, catastrophic leap?
The answer lies in the non-linear nature of the metric: the Richter scale is a base-10 logarithmic scale. Moving up by a single integer on the scale does not add a fixed amount of energy; instead, it multiplies the amplitude of the seismic waves by a factor of 10.
Concretely, comparing a magnitude 6 earthquake to a magnitude 9 earthquake reveals the exponential scaling: the amplitude of wave motion in a magnitude 9 earthquake is:
\[10^{9 - 6} = 10^3 = 1{,}000 \text{ times greater}\]
In terms of total mechanical energy released, each unit increase on the Moment Magnitude Scale corresponds to approximately a \(31.6\)-fold multiplier, meaning a 3-unit difference releases over \(31{,}600\) times more energy—the equivalent of detonating a single explosive device versus thousands simultaneously.
Because human intuition tends to think linearly, it is easy to assume that going from magnitude 6 to magnitude 12 represents a simple doubling of intensity, or that magnitude 18 is tripling it.
In a base-10 logarithmic system, an increase of \(6\) units corresponds to a wave amplitude multiplier of \(10^6 = 1{,}000{,}000\) (one million times larger). And an increase of \(12\) units corresponds to a multiplier of \(10^{12} = 1{,}000{,}000{,}000{,}000\) (one trillion times larger). An event of such unimaginable magnitude it would theoretically fracture the Earth’s crust entirely.
This real-world behavior highlights the defining feature of the logarithmic function. By converting multiplicative and exponential processes into additive ones, logarithmic functions allow scientists and analysts to plot, model, and interpret phenomena that span vast ranges of magnitude.
Formal
The natural logarithm, denoted \(\ln: (0, \infty) \to \mathbb{R}\), is defined as the inverse function of \(\exp(x)\):
\[\ln(x) := \exp^{-1}(x) \quad \text{for } x \in (0, \infty)\]
This relationship is characterized with the visual symmetry between the two curves with respect to the identidy function \(y = x\) .
The logarithm to base \(a\), denoted \(\log_a: (0, \infty) \to \mathbb{R}\), is defined as the inverse function of \(f_a(x) = a^x\):
\[\log_a(x) := f_a^{-1}(x) \quad \text{for } x \in (0, \infty), \; a > 0, \; a \neq 1\]
\[\log_a(x) = y \iff a^y = x\]
It can be proven that \[ \log_a(x) = \frac{\ln(x)}{\ln(a)} \]
Thus, all logarithms with base \(a\) are simply scalar rescalings of the natural logarithm \(\ln(x)\) by the constant factor \(\dfrac{1}{\ln(a)}\).
Linearization property of logarithm: it allows to transform multiplication to addition
\[\ln(x \cdot y) = \ln(x) + \ln(y)\]
Examples
\(\ln(1) = 0\) where the curve intersect with x-axis.
\(\ln(e) = 1\) by definition.
Any number \(y\) between \(0\) and \(1\) can be represented by \(y = \dfrac{1}{x}\) where \(x > 1\) then \[ \ln(y) = \ln\left(\dfrac{1}{x}\right) = \ln\left(x^{-1}\right) = - 1 \times \ln(x) = - \ln(x) \] so \(\ln (y)\) is always negative. This is also true for any base \(\log_a\).
The logarithm of a factorial expands the product inside \(n!\) into a sum of logarithms
\[ \begin{align*} \log_a(n!) &= \log_a(1 \times 2 \times 3 \times \cdots \times n) \\[4pt] &= \log_a(1) + \log_a(2) + \cdots + \log_a(n) \\[4pt] &= \sum_{i = 1}^n \log_a(i) \end{align*} \]
Another illustration of the inverse relationship between the logarithmic and exponential functions is how the natural logarithm simplifies exponentiated expressions, undoing the exponential mapping directly:
\[ \ln\left(\exp\left(-\frac{x^2}{2}\right)\right) = \ln\left(e^{-\frac{x^2}{2}}\right) = -\frac{x^2}{2} \]
This identity is frequently applied in statistics when working with normal distributions, transforming multiplicative Gaussian kernels into manageable quadratic sum forms (such as in log-likelihood calculations).
Tips and warnings
The logarithmic function is primarily used to rescale data for clearer visualization or to reveal hidden underlying patterns. Below are a few key applications:
- Transforming Plot Axes vs. Transforming Data Values: There is an important distinction between setting a plot’s axis to a logarithmic scale (left) and plotting log-transformed data values on a standard linear scale (right). The left panel illustrates the modern, best-practice approach: keeping raw, un-transformed data in the dataset while adjusting the plotting scale parameters. In contrast, the right panel requires manually transforming the variable prior to plotting. Beyond adding an unnecessary data transformation step, the resulting \(y\)-axis values are less visually intuitive to interpret2.

Log-Transforming the \(y\)-Axis to Reveal Obscured Data: Log-transforming the vertical axis helps expose trends hidden by wide numerical ranges. On the left, smaller data points are visually compressed (“squished”) because the axis range is dominated by extreme high values. On the right, using a log scale spreads out lower-range data, making the relative trends in salary far more visible.

Log-Scale on the \(x\)-Axis: Applying a logarithmic scale to the horizontal axis is particularly useful for diagnostic visualization—for example, determining whether a curve has reached a true asymptote or continues to grow at extreme inputs.

Log-Log Scales for Power-Law Relationships: Transforming both the \(x\)- and \(y\)-axes to logarithmic scales converts power-law relationships of the form \(y = a x^b\) into linear equations (\(\log(y) = \log(a) + b \log(x)\)). Below is a classic ecological example illustrating the species–area relationship (MacArthur and Wilson, 1967) with a fitted curve.

A common practice in ecological data analysis is applying a log transformation to variables (see Chapter 16) like species abundance. However, when a species is absent, its abundance is \(0\), and \(\log(0)\) is mathematically undefined. A standard solution is using a \(\log(x+1)\) transformation. In R, this transformation is implemented directly via the
log1p()function, while the natural, base 2, and base 10 logarithms are available vialog(),log2(), andlog10().
Notation/Semantic/Terminology
Integral defintion: For every \(x>0\), the natural logarithm of x could also be defined as \[ \ln(x) = \int_{1}^{x} \frac{1}{t} \, dt \]
Unspecified Logarithmic Base (\(\log(x)\) vs. \(\ln(x)\)): What does \(\log(x)\) represent when its base is not explicitly written? In advanced mathematics, calculus, and standard programming environments (such as R, Python, and C++), the default assumption is the natural logarithm:
\[\log(x) = \log_e(x) = \ln(x)\]
However, notation varies across disciplines and software platforms. To prevent ambiguity in technical writing, it is best practice to use \(\ln(x)\) for base \(e\) and explicit subscripts (\(\log_{10}(x)\), \(\log_2(x)\)) whenever a non-natural base is intended.
unless dealing with standardized logarithmic metrics, such as the Richter scale↩︎